[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 25/31] qcow2: fix condition in is_zero_cluster
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 25/31] qcow2: fix condition in is_zero_cluster |
Date: |
Thu, 19 May 2016 17:22:03 +0200 |
From: "Denis V. Lunev" <address@hidden>
We should check for (res & BDRV_BLOCK_ZERO) only. The situation when we
will have !(res & BDRV_BLOCK_DATA) and will not have BDRV_BLOCK_ZERO is
not possible for images with bdi.unallocated_blocks_are_zero == true.
For those images where it's false, however, it can happen and we must
not consider the data zeroed then or we would corrupt the image.
Signed-off-by: Denis V. Lunev <address@hidden>
CC: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 62febfc..a6012dc 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2412,7 +2412,7 @@ static bool is_zero_cluster(BlockDriverState *bs, int64_t
start)
BlockDriverState *file;
int64_t res = bdrv_get_block_status_above(bs, NULL, start,
s->cluster_sectors, &nr, &file);
- return res >= 0 && ((res & BDRV_BLOCK_ZERO) || !(res & BDRV_BLOCK_DATA));
+ return res >= 0 && (res & BDRV_BLOCK_ZERO);
}
static bool is_zero_cluster_top_locked(BlockDriverState *bs, int64_t start)
--
1.8.3.1
- [Qemu-block] [PULL 13/31] Revert "block: Forbid I/O throttling on nodes with multiple parents for 2.6", (continued)
- [Qemu-block] [PULL 13/31] Revert "block: Forbid I/O throttling on nodes with multiple parents for 2.6", Kevin Wolf, 2016/05/19
- [Qemu-block] [PULL 26/31] qcow2: Fix write_zeroes with partially allocated backing file cluster, Kevin Wolf, 2016/05/19
- [Qemu-block] [PULL 20/31] block: Add bdrv_has_blk(), Kevin Wolf, 2016/05/19
- [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Kevin Wolf, 2016/05/19
- Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Paolo Bonzini, 2016/05/20
- Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Kevin Wolf, 2016/05/20
- Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Kevin Wolf, 2016/05/20
- Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Paolo Bonzini, 2016/05/20
- Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Kevin Wolf, 2016/05/20
- Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Paolo Bonzini, 2016/05/20
[Qemu-block] [PULL 25/31] qcow2: fix condition in is_zero_cluster,
Kevin Wolf <=
[Qemu-block] [PULL 28/31] block: clarify error message for qmp-eject, Kevin Wolf, 2016/05/19
[Qemu-block] [PULL 22/31] block: Don't return throttling info in query-named-block-nodes, Kevin Wolf, 2016/05/19
[Qemu-block] [PULL 29/31] qemu-io: Fix recent UI updates, Kevin Wolf, 2016/05/19
[Qemu-block] [PULL 23/31] block: Remove BlockDriverState.blk, Kevin Wolf, 2016/05/19
[Qemu-block] [PULL 24/31] block: Propagate AioContext change to all children, Kevin Wolf, 2016/05/19
[Qemu-block] [PULL 27/31] qemu-iotests: Some more write_zeroes tests, Kevin Wolf, 2016/05/19
[Qemu-block] [PULL 30/31] qemu-iotests: Simplify 109 with unaligned qemu-img compare, Kevin Wolf, 2016/05/19
[Qemu-block] [PULL 31/31] qemu-iotests: Fix regression in 136 on aio_read invalid, Kevin Wolf, 2016/05/19
Re: [Qemu-block] [Qemu-devel] [PULL 00/31] Block layer patches, Peter Maydell, 2016/05/19
[Qemu-block] [PULL 00/31] Block layer patches, Kevin Wolf, 2016/05/25