qemu-patch-raspberry4/nbd
Eric Blake 0c1d50bda7 nbd: Implement NBD_INFO_BLOCK_SIZE on server
The upstream NBD Protocol has defined a new extension to allow
the server to advertise block sizes to the client, as well as
a way for the client to inform the server that it intends to
obey block sizes.

Thanks to a recent fix (commit df7b97ff), our real minimum
transfer size is always 1 (the block layer takes care of
read-modify-write on our behalf), but we're still more efficient
if we advertise 512 when the client supports it, as follows:
- OPT_INFO, but no NBD_INFO_BLOCK_SIZE: advertise 512, then
fail with NBD_REP_ERR_BLOCK_SIZE_REQD; client is free to try
something else since we don't disconnect
- OPT_INFO with NBD_INFO_BLOCK_SIZE: advertise 512
- OPT_GO, but no NBD_INFO_BLOCK_SIZE: advertise 1
- OPT_GO with NBD_INFO_BLOCK_SIZE: advertise 512

We can also advertise the optimum block size (presumably the
cluster size, when exporting a qcow2 file), and our absolute
maximum transfer size of 32M, to help newer clients avoid
EINVAL failures or abrupt disconnects on oversize requests.

We do not reject clients for using the older NBD_OPT_EXPORT_NAME;
we are no worse off for those clients than we used to be.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20170707203049.534-9-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-07-14 12:04:42 +02:00
..
client.c nbd: Implement NBD_OPT_GO on client 2017-07-14 12:04:42 +02:00
common.c nbd: Expose and debug more NBD constants 2017-07-14 12:04:41 +02:00
Makefile.objs nbd: Split nbd.c 2016-01-15 18:58:02 +01:00
nbd-internal.h nbd: Implement NBD_OPT_GO on client 2017-07-14 12:04:42 +02:00
server.c nbd: Implement NBD_INFO_BLOCK_SIZE on server 2017-07-14 12:04:42 +02:00
trace-events nbd: Implement NBD_INFO_BLOCK_SIZE on server 2017-07-14 12:04:42 +02:00