[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 14/17] qcow2: Expose all zero bit through .bdrv_known_zeroes

From: Eric Blake
Subject: [PATCH 14/17] qcow2: Expose all zero bit through .bdrv_known_zeroes
Date: Fri, 31 Jan 2020 11:44:33 -0600

Now that qcow2 images have a way to track when the contents are known
to be all zero, it is worth exposing this to clients such as qemu-img
convert.  (Of course, until the next patch wires up qcow2 to actually
set the bit, this patch has no immediate effect; however, keeping it
as a separate patch allows for an easier revert when testing if the
bit makes a difference in qemu-img behavior).

Signed-off-by: Eric Blake <address@hidden>
 block/qcow2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/qcow2.c b/block/qcow2.c
index 20cce9410c84..3f61d806a14b 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -4938,6 +4938,9 @@ static int qcow2_known_zeroes(BlockDriverState *bs)
      * therefore enough to check the first one.
     preallocated = s->l1_size > 0 && s->l1_table[0] != 0;
+    if (s->autoclear_features & QCOW2_AUTOCLEAR_ALL_ZERO) {
+        r |= BDRV_ZERO_OPEN;
+    }
     if (qemu_in_coroutine()) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]