On 28.06.20 13:02, Alberto Garcia wrote:
> The offset field of an uncompressed cluster's L2 entry must be aligned
> to the cluster size, otherwise it is invalid. If the cluster has no
> data then it means that the offset points to a preallocation, so we
> can clear the offset field without affecting the guest-visible data.
> This is what 'qemu-img check' does when run in repair mode.
> 
> On traditional qcow2 images this can only happen when QCOW_OFLAG_ZERO
> is set, and repairing such entries turns the clusters from ZERO_ALLOC
> into ZERO_PLAIN.
> 
> Extended L2 entries have no ZERO_ALLOC clusters and no QCOW_OFLAG_ZERO
> but the idea is the same: if none of the subclusters are allocated
> then we can clear the offset field and leave the bitmap untouched.
> 
> Signed-off-by: Alberto Garcia <[email protected]>
> ---
>  block/qcow2-refcount.c     | 16 +++++++++++-----
>  tests/qemu-iotests/060.out |  2 +-
>  2 files changed, 12 insertions(+), 6 deletions(-)

Reviewed-by: Max Reitz <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to