qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
	"open list:Network Block Dev..." <qemu-block@nongnu.org>
Subject: [Qemu-devel] [PULL 8/8] nbd: implement bdrv_get_info callback
Date: Fri, 26 Jan 2018 10:04:11 -0600	[thread overview]
Message-ID: <20180126160411.4033-9-eblake@redhat.com> (raw)
In-Reply-To: <20180126160411.4033-1-eblake@redhat.com>

From: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>

Since mirror job supports efficient zero out target mechanism (see
in mirror_dirty_init()), implement bdrv_get_info to make it work
over NBD. Such improvement will allow using the largest chunk possible
and will decrease the number of NBD_CMD_WRITE_ZEROES requests on the wire.

Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
Message-Id: <20180118115158.17219-1-edgar.kaziakhmedov@virtuozzo.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 block/nbd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/block/nbd.c b/block/nbd.c
index 8b8ba56cdd0..94220f6d143 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -566,6 +566,14 @@ static void nbd_refresh_filename(BlockDriverState *bs, QDict *options)
     bs->full_open_options = opts;
 }

+static int nbd_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
+{
+    if (bs->supported_zero_flags & BDRV_REQ_MAY_UNMAP) {
+        bdi->can_write_zeroes_with_unmap = true;
+    }
+    return 0;
+}
+
 static BlockDriver bdrv_nbd = {
     .format_name                = "nbd",
     .protocol_name              = "nbd",
@@ -583,6 +591,7 @@ static BlockDriver bdrv_nbd = {
     .bdrv_detach_aio_context    = nbd_detach_aio_context,
     .bdrv_attach_aio_context    = nbd_attach_aio_context,
     .bdrv_refresh_filename      = nbd_refresh_filename,
+    .bdrv_get_info              = nbd_get_info,
 };

 static BlockDriver bdrv_nbd_tcp = {
@@ -602,6 +611,7 @@ static BlockDriver bdrv_nbd_tcp = {
     .bdrv_detach_aio_context    = nbd_detach_aio_context,
     .bdrv_attach_aio_context    = nbd_attach_aio_context,
     .bdrv_refresh_filename      = nbd_refresh_filename,
+    .bdrv_get_info              = nbd_get_info,
 };

 static BlockDriver bdrv_nbd_unix = {
@@ -621,6 +631,7 @@ static BlockDriver bdrv_nbd_unix = {
     .bdrv_detach_aio_context    = nbd_detach_aio_context,
     .bdrv_attach_aio_context    = nbd_attach_aio_context,
     .bdrv_refresh_filename      = nbd_refresh_filename,
+    .bdrv_get_info              = nbd_get_info,
 };

 static void bdrv_nbd_init(void)
-- 
2.14.3

  parent reply	other threads:[~2018-01-26 17:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26 16:04 [Qemu-devel] [PULL 0/8] NBD patches through 26 Jan Eric Blake
2018-01-26 16:04 ` [Qemu-devel] [PULL 1/8] qapi: add name parameter to nbd-server-add Eric Blake
2018-01-26 16:04 ` [Qemu-devel] [PULL 2/8] hmp: Add name parameter to nbd_server_add Eric Blake
2018-01-26 16:04 ` [Qemu-devel] [PULL 3/8] qapi: add nbd-server-remove Eric Blake
2018-01-26 16:04 ` [Qemu-devel] [PULL 4/8] iotest 147: add cases to test new @name parameter of nbd-server-add Eric Blake
2018-01-26 16:04 ` [Qemu-devel] [PULL 5/8] iotests: implement QemuIoInteractive class Eric Blake
2018-01-26 16:04 ` [Qemu-devel] [PULL 6/8] iotest 205: new test for qmp nbd-server-remove Eric Blake
2018-02-05  9:24   ` Kevin Wolf
2018-02-05 12:48     ` Vladimir Sementsov-Ogievskiy
2018-01-26 16:04 ` [Qemu-devel] [PULL 7/8] hmp: Add nbd_server_remove to mirror QMP command Eric Blake
2018-01-26 16:04 ` Eric Blake [this message]
2018-01-29  9:59 ` [Qemu-devel] [PULL 0/8] NBD patches through 26 Jan Peter Maydell

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=20180126160411.4033-9-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 \
    /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).