[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 22/31] qemu-img: convert: don't use unallocated_blocks_are_zero
From: |
Max Reitz |
Subject: |
[PULL 22/31] qemu-img: convert: don't use unallocated_blocks_are_zero |
Date: |
Mon, 6 Jul 2020 12:04:23 +0200 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
qemu-img convert wants to distinguish ZERO which comes from short
backing files. unallocated_blocks_are_zero field of bdi is unrelated:
space after EOF is always considered to be zero anyway. So, just make
post_backing_zero true in case of short backing file.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-2-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
qemu-img.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 7f4938a5ef..53bd32bf8f 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1681,7 +1681,6 @@ typedef struct ImgConvertState {
BlockBackend *target;
bool has_zero_init;
bool compressed;
- bool unallocated_blocks_are_zero;
bool target_is_new;
bool target_has_backing;
int64_t target_backing_sectors; /* negative if unknown */
@@ -1726,7 +1725,7 @@ static int convert_iteration_sectors(ImgConvertState *s,
int64_t sector_num)
if (s->target_backing_sectors >= 0) {
if (sector_num >= s->target_backing_sectors) {
- post_backing_zero = s->unallocated_blocks_are_zero;
+ post_backing_zero = true;
} else if (sector_num + n > s->target_backing_sectors) {
/* Split requests around target_backing_sectors (because
* starting from there, zeros are handled differently) */
@@ -2678,7 +2677,6 @@ static int img_convert(int argc, char **argv)
} else {
s.compressed = s.compressed || bdi.needs_compressed_writes;
s.cluster_sectors = bdi.cluster_size / BDRV_SECTOR_SIZE;
- s.unallocated_blocks_are_zero = bdi.unallocated_blocks_are_zero;
}
ret = convert_do_copy(&s);
--
2.26.2
- [PULL 14/31] block/crypto: rename two functions, (continued)
- [PULL 14/31] block/crypto: rename two functions, Max Reitz, 2020/07/06
- [PULL 13/31] block/amend: refactor qcow2 amend options, Max Reitz, 2020/07/06
- [PULL 15/31] block/crypto: implement the encryption key management, Max Reitz, 2020/07/06
- [PULL 16/31] block/qcow2: extend qemu-img amend interface with crypto options, Max Reitz, 2020/07/06
- [PULL 18/31] block/core: add generic infrastructure for x-blockdev-amend qmp command, Max Reitz, 2020/07/06
- [PULL 20/31] block/qcow2: implement blockdev-amend, Max Reitz, 2020/07/06
- [PULL 17/31] iotests: qemu-img tests for luks key management, Max Reitz, 2020/07/06
- [PULL 19/31] block/crypto: implement blockdev-amend, Max Reitz, 2020/07/06
- [PULL 22/31] qemu-img: convert: don't use unallocated_blocks_are_zero,
Max Reitz <=
- [PULL 21/31] iotests: add tests for blockdev-amend, Max Reitz, 2020/07/06
- [PULL 23/31] block: inline bdrv_unallocated_blocks_are_zero(), Max Reitz, 2020/07/06
- [PULL 24/31] block/vdi: return ZERO block-status when appropriate, Max Reitz, 2020/07/06
- [PULL 26/31] block/crypto: drop unallocated_blocks_are_zero, Max Reitz, 2020/07/06
- [PULL 27/31] block/iscsi: drop unallocated_blocks_are_zero, Max Reitz, 2020/07/06
- [PULL 28/31] block/file-posix: drop unallocated_blocks_are_zero, Max Reitz, 2020/07/06
- [PULL 29/31] block/vhdx: drop unallocated_blocks_are_zero, Max Reitz, 2020/07/06
- [PULL 30/31] block: drop unallocated_blocks_are_zero, Max Reitz, 2020/07/06
- [PULL 31/31] qed: Simplify backing reads, Max Reitz, 2020/07/06
- [PULL 25/31] block/vpc: return ZERO block-status when appropriate, Max Reitz, 2020/07/06