[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()) {
qemu_co_mutex_unlock(&s->lock);
}
--
2.24.1
- [PATCH 05/17] block: Don't advertise zero_init_truncate with encryption, (continued)
- [PATCH 05/17] block: Don't advertise zero_init_truncate with encryption, Eric Blake, 2020/01/31
- [PATCH 03/17] qcow2: Avoid feature name extension on small cluster size, Eric Blake, 2020/01/31
- [PATCH 08/17] sheepdog: Consistently set bdrv_has_zero_init_truncate, Eric Blake, 2020/01/31
- [PATCH 10/17] block: Add new BDRV_ZERO_OPEN flag, Eric Blake, 2020/01/31
- [PATCH 11/17] file-posix: Support BDRV_ZERO_OPEN, Eric Blake, 2020/01/31
- [PATCH 09/17] block: Refactor bdrv_has_zero_init{,_truncate}, Eric Blake, 2020/01/31
- [PATCH 12/17] gluster: Support BDRV_ZERO_OPEN, Eric Blake, 2020/01/31
- [PATCH 13/17] qcow2: Add new autoclear feature for all zero image, Eric Blake, 2020/01/31
- [PATCH 15/17] qcow2: Implement all-zero autoclear bit, Eric Blake, 2020/01/31
- [PATCH 14/17] qcow2: Expose all zero bit through .bdrv_known_zeroes,
Eric Blake <=
- [PATCH 16/17] iotests: Add new test for qcow2 all-zero bit, Eric Blake, 2020/01/31
- [PATCH 17/17] qcow2: Let qemu-img check cover all-zero bit, Eric Blake, 2020/01/31