diff options
author | Eric Blake <eblake@redhat.com> | 2023-08-29 12:58:29 -0500 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2023-09-22 17:20:41 -0500 |
commit | 297365b40ff24c7e07d6f40ec8f9ac83229ace94 (patch) | |
tree | d899b893663c89ea507361c762e7d1095c3762bb /block/nbd.c | |
parent | ac132d0520c39f48a22e8666810792c5c9dd44b1 (diff) | |
download | qemu-297365b40ff24c7e07d6f40ec8f9ac83229ace94.zip qemu-297365b40ff24c7e07d6f40ec8f9ac83229ace94.tar.gz qemu-297365b40ff24c7e07d6f40ec8f9ac83229ace94.tar.bz2 |
nbd/client: Pass mode through to nbd_send_request
Once the 64-bit headers extension is enabled, the data layout we send
over the wire for a client request depends on the mode negotiated with
the server. Rather than adding a parameter to nbd_send_request, we
can add a member to struct NBDRequest, since it already does not
reflect on-wire format. Some callers initialize it directly; many
others rely on a common initialization point during
nbd_co_send_request(). At this point, there is no semantic change.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-ID: <20230829175826.377251-21-eblake@redhat.com>
Diffstat (limited to 'block/nbd.c')
-rw-r--r-- | block/nbd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/block/nbd.c b/block/nbd.c index 676b755..24f50b7 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -339,7 +339,7 @@ int coroutine_fn nbd_co_do_establish_connection(BlockDriverState *bs, * We have connected, but must fail for other reasons. * Send NBD_CMD_DISC as a courtesy to the server. */ - NBDRequest request = { .type = NBD_CMD_DISC }; + NBDRequest request = { .type = NBD_CMD_DISC, .mode = s->info.mode }; nbd_send_request(s->ioc, &request); @@ -520,6 +520,7 @@ nbd_co_send_request(BlockDriverState *bs, NBDRequest *request, qemu_co_mutex_lock(&s->send_mutex); request->cookie = INDEX_TO_COOKIE(i); + request->mode = s->info.mode; assert(s->ioc); @@ -1465,7 +1466,7 @@ static void nbd_yank(void *opaque) static void nbd_client_close(BlockDriverState *bs) { BDRVNBDState *s = (BDRVNBDState *)bs->opaque; - NBDRequest request = { .type = NBD_CMD_DISC }; + NBDRequest request = { .type = NBD_CMD_DISC, .mode = s->info.mode }; if (s->ioc) { nbd_send_request(s->ioc, &request); |