On 22/02/2017 18:11, Eric Blake wrote: >>> + /* preferred - At least 4096, but larger as appropriate. */ >>> + sizes[1] = MAX(blk_get_opt_transfer(exp->blk), 4096); > > The NBD specification requires a non-zero power-of-2 number if the > server transmits the block size at all; 1 is the ideal number, followed > by whatever actual size we learn from the request_align of the device.
Oh, so it's the smallest "good" transfer size, or the preferred alignment. That's not the same as the SCSI definition, which is: If a device server receives one of these commands with a transfer size greater than this value, then the device server may incur delays in processing the command. An OPTIMAL TRANSFER LENGTH field set to 0000_0000h indicates that the device server does not report an optimal transfer size. It's more similar to the physical block size: When using logical block access commands (see 4.2.2), application clients should: a) specify an LBA that is aligned to a physical block boundary; and b) access an integral number of physical blocks, provided that the access does not go beyond the last LBA on the medium. So I'd rather ignore it in the client, and send 4096 in the server. Paolo
signature.asc
Description: OpenPGP digital signature