On 04/13/2018 09:31 AM, Vladimir Sementsov-Ogievskiy wrote:
Handle nbd CACHE command. Just do read, without sending read data back.
Cache mechanism should be done by exported node driver chain.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com>
---
include/block/nbd.h | 3 ++-
nbd/server.c | 10 ++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
Missing a change to nbd/common.c nbd_cmd_lookup().
@@ -1911,7 +1913,7 @@ static coroutine_fn int nbd_do_cmd_read(NBDClient
*client, NBDRequest *request,
int ret;
NBDExport *exp = client->exp;
- assert(request->type == NBD_CMD_READ);
+ assert(request->type == NBD_CMD_READ || request->type == NBD_CMD_CACHE);
Also, missing a call into this function for NBD_CMD_CACHE.
Squashing the following, then adding to my NBD queue, with:
Reviewed-by: Eric Blake <ebl...@redhat.com>
diff --git i/nbd/common.c w/nbd/common.c
index 8c95c1d606e..41f5ed8d9fa 100644
--- i/nbd/common.c
+++ w/nbd/common.c
@@ -148,6 +148,8 @@ const char *nbd_cmd_lookup(uint16_t cmd)
return "flush";
case NBD_CMD_TRIM:
return "trim";
+ case NBD_CMD_CACHE:
+ return "cache";
case NBD_CMD_WRITE_ZEROES:
return "write zeroes";
case NBD_CMD_BLOCK_STATUS:
diff --git i/nbd/server.c w/nbd/server.c
index 323c6d84004..274604609f4 100644
--- i/nbd/server.c
+++ w/nbd/server.c
@@ -2173,6 +2173,7 @@ static coroutine_fn int
nbd_handle_request(NBDClient *client,
switch (request->type) {
case NBD_CMD_READ:
+ case NBD_CMD_CACHE:
return nbd_do_cmd_read(client, request, data, errp);
case NBD_CMD_WRITE:
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org