qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, edgar.kaziakhmedov@virtuozzo.com,
	vsementsov@virtuozzo.com, Paolo Bonzini <pbonzini@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 1/4] nbd: Prepare for additional block sizing info
Date: Tue,  1 May 2018 16:13:33 -0500	[thread overview]
Message-ID: <20180501211336.986372-2-eblake@redhat.com> (raw)
In-Reply-To: <20180501211336.986372-1-eblake@redhat.com>

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 <eblake@redhat.com>

---

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 <anthony@codemonkey.ws>
  *
  *  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>";
     }
-- 
2.14.3

  reply	other threads:[~2018-05-01 21:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01 21:13 [Qemu-devel] [PATCH 0/4] Support larger NBD_CMD_WRITE_ZEROES Eric Blake
2018-05-01 21:13 ` Eric Blake [this message]
2018-05-03  8:20   ` [Qemu-devel] [PATCH 1/4] nbd: Prepare for additional block sizing info Vladimir Sementsov-Ogievskiy
2018-05-01 21:13 ` [Qemu-devel] [PATCH 2/4] nbd/client: Refactor in preparation for more limits Eric Blake
2018-05-03  8:29   ` Vladimir Sementsov-Ogievskiy
2018-05-01 21:13 ` [Qemu-devel] [PATCH 3/4] nbd/client: Support requests of additional block sizing info Eric Blake
2018-05-03  9:17   ` Vladimir Sementsov-Ogievskiy
2018-05-03 14:49     ` Eric Blake
2018-05-03 15:51       ` Vladimir Sementsov-Ogievskiy
2018-05-22 15:33   ` Vladimir Sementsov-Ogievskiy
2018-05-23 15:40     ` Eric Blake
2018-05-01 21:13 ` [Qemu-devel] [PATCH 4/4] nbd/server: " Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180501211336.986372-2-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=edgar.kaziakhmedov@virtuozzo.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).