I am currently completing a proxy for Imdisk to reach iscsi targets.
I am conscious windows natively includes an iscsi client but, for one, imdisk+iscsi may be of interest in some cases (winpe?) and for two, this is mostly a first step for myself leading to further developement later on (like a dd like to allow read/from iscsi targets on the command line, etc).
While playing around with read/write thus, i discovered that many iscsi targets will simply crash (or hang) if you attempt to write more than 256KB as a buffer.
Therefore, in my imdisk proxy, I am setting the write size to 256KB whenever it is superior to this number.
Doing so, I assumed that the "caller" will be smart enough to detect a partial write and deal with it.
This what I get (below) as a message from devio.
Is it safe to ignore and assume the caller will deal with it or is setting the max buffer size to 256KB (programatically speaking) not a good thing as there could a be more elegant/safe way to proceed (a command line switch I may have missed?).
The "partial write" devio message below seems to indicate that the caller is "only" moving to the next 1MB (the buffer size) rather than pushing a new write request with a smaller buffer size (which i kind of expected/wished...).
In all cases, I would like to avoid to implement a logic where I have to split any buffer size > 256KB into several iscsi write requests...
My skeleton code setting the buffer size to max 256KB.
function my_write_proc(handle:thandle; buf:pointer; size:cardinal; offset:int64): integer; cdecl; begin result:=-1; if size>1024*256 then size:=1024*256; writeln('Write request - size:'+inttostr(size)+' offset:'+inttostr(offset)); //some iscsi code eventualy sending back the number of bytes written ... // end;
My temp work is there for now : http://erwan.labalec...iscsi-proxy.zip.