qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, Jason Dillaman <dillaman@redhat.com>,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [PATCH 4/9] rbd: Support BDRV_REQ_ZERO_WRITE for truncate
Date: Tue, 28 Apr 2020 15:29:00 -0500	[thread overview]
Message-ID: <20200428202905.770727-5-eblake@redhat.com> (raw)
In-Reply-To: <20200428202905.770727-1-eblake@redhat.com>

Our .bdrv_has_zero_init_truncate always returns 1 because rbd always
0-fills; we can use that same knowledge to implement
BDRV_REQ_ZERO_WRITE by ignoring it.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 block/rbd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/rbd.c b/block/rbd.c
index f2d52091c702..331c45adb2b2 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -817,6 +817,9 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
         }
     }

+    /* When extending regular files, we get zeros from the OS */
+    bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE;
+
     r = 0;
     goto out;

-- 
2.26.2



  parent reply	other threads:[~2020-04-28 20:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 20:28 [PATCH 0/9] More truncate improvements Eric Blake
2020-04-28 20:28 ` [PATCH 1/9] gluster: Drop useless has_zero_init callback Eric Blake
2020-04-28 20:28 ` [PATCH 2/9] file-win32: Support BDRV_REQ_ZERO_WRITE for truncate Eric Blake
2020-04-28 20:28 ` [PATCH 3/9] nfs: " Eric Blake
2020-04-28 20:29 ` Eric Blake [this message]
2020-04-28 20:29 ` [PATCH 5/9] sheepdog: " Eric Blake
2020-04-28 20:29 ` [PATCH 6/9] ssh: " Eric Blake
2020-04-29  9:01   ` Richard W.M. Jones
2020-04-28 20:29 ` [PATCH 7/9] parallels: Rework truncation logic Eric Blake
2020-05-07 11:14   ` Denis V. Lunev
2020-04-28 20:29 ` [PATCH 8/9] vhdx: " Eric Blake
2020-04-28 20:29 ` [PATCH 9/9] block: Drop unused .bdrv_has_zero_init_truncate Eric Blake
2020-04-29  9:02   ` Richard W.M. Jones
2020-04-29  2:24 ` [PATCH 0/9] More truncate improvements no-reply
2020-04-29 13:14   ` Eric Blake
2020-04-29  2:24 ` no-reply
2020-05-06 13:03 ` Eric Blake
2020-05-07 10:15 ` Kevin Wolf
2020-05-07 14:29   ` Eric Blake
2020-05-07 14:32     ` Kevin Wolf

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=20200428202905.770727-5-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=dillaman@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@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).