On 04.05.2017 05:07, Eric Blake wrote:
> We were throwing away the preallocation information associated with
> zero clusters.  But we should be matching the well-defined semantics
> in bdrv_get_block_status(), where (BDRV_BLOCK_ZERO |
> BDRV_BLOCK_OFFSET_VALID) informs the user which offset is reserved,
> while still reminding the user that reading from that offset is
> likely to read garbage.
> 
> count_contiguous_clusters_by_type() is now used only for unallocated
> cluster runs, hence it gets renamed and tightened.
> 
> Making this change lets us see which portions of an image are zero
> but preallocated, when using qemu-img map --output=json.  The
> --output=human side intentionally ignores all zero clusters, whether
> or not they are preallocated.
> 
> The fact that there is no change to qemu-iotests './check -qcow2'
> merely means that we aren't yet testing this aspect of qemu-img;
> a later patch will add a test.
> 
> Signed-off-by: Eric Blake <ebl...@redhat.com>
> 
> ---
> v12: rename helper function
> v11: reserved for blkdebug half of v10
> v10: new patch
> ---
>  block/qcow2-cluster.c | 45 +++++++++++++++++++++++++++++++++++----------
>  1 file changed, 35 insertions(+), 10 deletions(-)

Reviewed-by: Max Reitz <mre...@redhat.com>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to