qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 1/4] nbd: Prepare for additional block sizing in


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-block] [PATCH 1/4] nbd: Prepare for additional block sizing info
Date: Thu, 3 May 2018 11:20:11 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

02.05.2018 00:13, Eric Blake wrote:
The NBD spec is clarifying [1] that a server may want to advertise
different limits for READ/WRITE (in our case, 32M) than for
TRIM/ZERO (in our case, nearly 4G).  Add the constants and name
lookups for new NBD_INFO_ fields used during handshake to convey
this additional information.  Note that the NBD spec already
requires servers to ignore unknown requests from the client, and
for clients to ignore unknown gratuitous responses sent from
the server.

[1] https://lists.debian.org/nbd/2018/03/msg00048.html

Signed-off-by: Eric Blake <address@hidden>


Reviewed-by:  Vladimir Sementsov-Ogievskiy <address@hidden>


---

The given URL for the NBD spec was v3; it will change to be a v4
version of that patch in part to point back to this qemu commit
as a proof of implementation.
---
  include/block/nbd.h | 4 +++-
  nbd/common.c        | 4 ++++
  2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/block/nbd.h b/include/block/nbd.h
index fcdcd545023..cbf51628f78 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -1,5 +1,5 @@
  /*
- *  Copyright (C) 2016-2017 Red Hat, Inc.
+ *  Copyright (C) 2016-2018 Red Hat, Inc.
   *  Copyright (C) 2005  Anthony Liguori <address@hidden>
   *
   *  Network Block Device
@@ -180,6 +180,8 @@ typedef struct NBDExtent {
  #define NBD_INFO_NAME           1
  #define NBD_INFO_DESCRIPTION    2
  #define NBD_INFO_BLOCK_SIZE     3
+#define NBD_INFO_TRIM_SIZE      4
+#define NBD_INFO_ZERO_SIZE      5

  /* Request flags, sent from client to server during transmission phase */
  #define NBD_CMD_FLAG_FUA        (1 << 0) /* 'force unit access' during write 
*/
diff --git a/nbd/common.c b/nbd/common.c
index 8c95c1d606e..840c91d5ca4 100644
--- a/nbd/common.c
+++ b/nbd/common.c
@@ -129,6 +129,10 @@ const char *nbd_info_lookup(uint16_t info)
          return "description";
      case NBD_INFO_BLOCK_SIZE:
          return "block size";
+    case NBD_INFO_TRIM_SIZE:
+        return "trim size";
+    case NBD_INFO_ZERO_SIZE:
+        return "zero size";
      default:
          return "<unknown>";
      }


--
Best regards,
Vladimir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]