From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
vsementsov@virtuozzo.com, rjones@redhat.com,
qemu-block@nongnu.org, mreitz@redhat.com
Subject: [PATCH 1/3] nbd: Preparation for NBD_INFO_INIT_STATE
Date: Mon, 10 Feb 2020 15:41:07 -0600 [thread overview]
Message-ID: <20200210214109.751734-2-eblake@redhat.com> (raw)
In-Reply-To: <20200210214109.751734-1-eblake@redhat.com>
Declare the constants being proposed for an NBD extension, which will
let qemu advertise/learn if an image began life with all zeroes.
Signed-off-by: Eric Blake <eblake@redhat.com>
---
docs/interop/nbd.txt | 1 +
include/block/nbd.h | 9 +++++++++
nbd/common.c | 2 ++
3 files changed, 12 insertions(+)
diff --git a/docs/interop/nbd.txt b/docs/interop/nbd.txt
index 45118809618e..35ba85367153 100644
--- a/docs/interop/nbd.txt
+++ b/docs/interop/nbd.txt
@@ -55,3 +55,4 @@ the operation of that feature.
NBD_CMD_BLOCK_STATUS for "qemu:dirty-bitmap:", NBD_CMD_CACHE
* 4.2: NBD_FLAG_CAN_MULTI_CONN for sharable read-only exports,
NBD_CMD_FLAG_FAST_ZERO
+* 5.0: NBD_INFO_INIT_STATE
diff --git a/include/block/nbd.h b/include/block/nbd.h
index 7f46932d80f1..0de020904a37 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -200,6 +200,15 @@ enum {
#define NBD_INFO_NAME 1
#define NBD_INFO_DESCRIPTION 2
#define NBD_INFO_BLOCK_SIZE 3
+#define NBD_INFO_INIT_STATE 4
+
+/* Initial state bits, when replying to NBD_INFO_INIT_STATE */
+enum {
+ NBD_INIT_SPARSE_BIT = 0,
+ NBD_INIT_ZERO_BIT = 1,
+};
+#define NBD_INIT_SPARSE (1 << NBD_INIT_SPARSE_BIT)
+#define NBD_INIT_ZERO (1 << NBD_INIT_ZERO_BIT)
/* 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 ddfe7d118371..3e24feb0d502 100644
--- a/nbd/common.c
+++ b/nbd/common.c
@@ -129,6 +129,8 @@ const char *nbd_info_lookup(uint16_t info)
return "description";
case NBD_INFO_BLOCK_SIZE:
return "block size";
+ case NBD_INFO_INIT_STATE:
+ return "init state";
default:
return "<unknown>";
}
--
2.24.1
next prev parent reply other threads:[~2020-02-10 21:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-10 21:37 Cross-project NBD extension proposal: NBD_INFO_INIT_STATE Eric Blake
2020-02-10 21:41 ` [qemu PATCH 0/3] NBD_INFO_INIT_STATE extension Eric Blake
2020-02-10 21:41 ` Eric Blake [this message]
2020-02-10 21:41 ` [PATCH 2/3] nbd: Add .bdrv_known_zeroes() client support Eric Blake
2020-02-10 21:41 ` [PATCH 3/3] nbd: Add .bdrv_known_zeroes() server support Eric Blake
2020-02-10 21:51 ` [qemu PATCH 0/3] NBD_INFO_INIT_STATE extension no-reply
2020-02-10 21:54 ` Eric Blake
2020-02-10 21:53 ` no-reply
2020-02-10 22:12 ` Cross-project NBD extension proposal: NBD_INFO_INIT_STATE Richard W.M. Jones
2020-02-10 22:29 ` Eric Blake
2020-02-10 22:52 ` Richard W.M. Jones
2020-02-11 14:33 ` Eric Blake
2020-02-12 7:27 ` Wouter Verhelst
2020-02-12 12:09 ` Eric Blake
2020-02-12 12:36 ` Richard W.M. Jones
2020-02-12 12:47 ` Eric Blake
2020-02-17 15:13 ` Max Reitz
2020-02-18 20:55 ` Eric Blake
2020-02-19 11:10 ` Max Reitz
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=20200210214109.751734-2-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--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).