[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 26/31] qcow2: Fix write_zeroes with partially allocat
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 26/31] qcow2: Fix write_zeroes with partially allocated backing file cluster |
Date: |
Thu, 19 May 2016 17:22:04 +0200 |
In order to correctly check whether a given cluster is read as zero, we
don't only need to check whether bdrv_get_block_status_above() sets
BDRV_BLOCK_ZERO, but also if all sectors for the whole cluster have the
same status.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Denis V. Lunev <address@hidden>
---
block/qcow2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index a6012dc..c197ff3 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);
+ return res >= 0 && (res & BDRV_BLOCK_ZERO) && nr == s->cluster_sectors;
}
static bool is_zero_cluster_top_locked(BlockDriverState *bs, int64_t start)
@@ -2423,6 +2423,7 @@ static bool is_zero_cluster_top_locked(BlockDriverState
*bs, int64_t start)
int ret;
ret = qcow2_get_cluster_offset(bs, start << BDRV_SECTOR_BITS, &nr, &off);
+ assert(nr == s->cluster_sectors);
return ret == QCOW2_CLUSTER_UNALLOCATED || ret == QCOW2_CLUSTER_ZERO;
}
--
1.8.3.1
- [Qemu-devel] [PULL 05/31] block: Move throttling fields from BDS to BB, (continued)
- [Qemu-devel] [PULL 05/31] block: Move throttling fields from BDS to BB, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 10/31] block/io: Quiesce parents between drained_begin/end, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 11/31] block: Decouple throttling from BlockDriverState, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 18/31] blockjob: Don't touch BDS iostatus, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 15/31] block: Use BdrvChild callbacks for change_media/resize, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 28/31] block: clarify error message for qmp-eject, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 25/31] qcow2: fix condition in is_zero_cluster, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 13/31] Revert "block: Forbid I/O throttling on nodes with multiple parents for 2.6", Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 17/31] blockjob: Don't set iostatus of target, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 19/31] block: Remove bdrv_aio_multiwrite(), Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 26/31] qcow2: Fix write_zeroes with partially allocated backing file cluster,
Kevin Wolf <=
- [Qemu-devel] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Kevin Wolf, 2016/05/19
- Re: [Qemu-devel] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Paolo Bonzini, 2016/05/20
- Re: [Qemu-devel] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Kevin Wolf, 2016/05/20
- Re: [Qemu-devel] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Kevin Wolf, 2016/05/20
- Re: [Qemu-devel] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Paolo Bonzini, 2016/05/20
- Re: [Qemu-devel] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Kevin Wolf, 2016/05/20
- Re: [Qemu-devel] [PULL 21/31] block: Avoid bs->blk in bdrv_next(), Paolo Bonzini, 2016/05/20
- [Qemu-devel] [PULL 20/31] block: Add bdrv_has_blk(), Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 22/31] block: Don't return throttling info in query-named-block-nodes, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 24/31] block: Propagate AioContext change to all children, Kevin Wolf, 2016/05/19