diff options
author | Eric Blake <eblake@redhat.com> | 2019-08-23 09:37:22 -0500 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2019-09-05 16:02:54 -0500 |
commit | dbb38caac54af7cd2432bec715da6ad33b3bdc22 (patch) | |
tree | 7f17828ade9d75a00d82e9aa7aa831688cb095ec /crypto/hmac-nettle.c | |
parent | 0c61ebb0cdf66343c45f1337d8cd985b6c4ab25e (diff) | |
download | qemu-dbb38caac54af7cd2432bec715da6ad33b3bdc22.zip qemu-dbb38caac54af7cd2432bec715da6ad33b3bdc22.tar.gz qemu-dbb38caac54af7cd2432bec715da6ad33b3bdc22.tar.bz2 |
nbd: Improve per-export flag handling in server
When creating a read-only image, we are still advertising support for
TRIM and WRITE_ZEROES to the client, even though the client should not
be issuing those commands. But seeing this requires looking across
multiple functions:
All callers to nbd_export_new() passed a single flag based solely on
whether the export allows writes. Later, we then pass a constant set
of flags to nbd_negotiate_options() (namely, the set of flags which we
always support, at least for writable images), which is then further
dynamically modified with NBD_FLAG_SEND_DF based on client requests
for structured options. Finally, when processing NBD_OPT_EXPORT_NAME
or NBD_OPT_EXPORT_GO we bitwise-or the original caller's flag with the
runtime set of flags we've built up over several functions.
Let's refactor things to instead compute a baseline of flags as soon
as possible which gets shared between multiple clients, in
nbd_export_new(), and changing the signature for the callers to pass
in a simpler bool rather than having to figure out flags. We can then
get rid of the 'myflags' parameter to various functions, and instead
refer to client for everything we need (we still have to perform a
bitwise-OR for NBD_FLAG_SEND_DF during NBD_OPT_EXPORT_NAME and
NBD_OPT_EXPORT_GO, but it's easier to see what is being computed).
This lets us quit advertising senseless flags for read-only images, as
well as making the next patch for exposing FAST_ZERO support easier to
write.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190823143726.27062-2-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
[eblake: improve commit message, update iotest 223]
Diffstat (limited to 'crypto/hmac-nettle.c')
0 files changed, 0 insertions, 0 deletions