From: Eric Blake Date: Tue, 28 Apr 2020 20:29:00 +0000 (-0500) Subject: rbd: Support BDRV_REQ_ZERO_WRITE for truncate X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=2f98910d5b89733b1a5df06c6d2a7056da32a7b7;p=qemu.git rbd: Support BDRV_REQ_ZERO_WRITE for truncate 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 Message-Id: <20200428202905.770727-5-eblake@redhat.com> Signed-off-by: Kevin Wolf --- diff --git a/block/rbd.c b/block/rbd.c index f2d52091c7..331c45adb2 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;