]> git.proxmox.com Git - mirror_qemu.git/commit
qcow2: Update expand_zero_clusters_in_l1() to support L2 slices
authorAlberto Garcia <berto@igalia.com>
Mon, 5 Feb 2018 14:33:30 +0000 (16:33 +0200)
committerMax Reitz <mreitz@redhat.com>
Tue, 13 Feb 2018 16:00:00 +0000 (17:00 +0100)
commit415184f52031cd16ff7ea3702e0ef9f2f7edec9a
tree7007fb47d54b3cc071315b0e01bef1246d0319cc
parent226494ff69d3d0563d00c8dbab30e740191d4e93
qcow2: Update expand_zero_clusters_in_l1() to support L2 slices

expand_zero_clusters_in_l1() expands zero clusters as a necessary step
to downgrade qcow2 images to a version that doesn't support metadata
zero clusters. This function takes an L1 table (which may or may not
be active) and iterates over all its L2 tables looking for zero
clusters.

Since we'll be loading L2 slices instead of full tables we need to add
an extra loop that iterates over all slices of each L2 table, and we
should also use the slice size when allocating the buffer used when
the L1 table is not active.

This function doesn't need any additional changes so apart from that
this patch simply updates the variable name from l2_table to l2_slice.

Finally, and since we have to touch the bdrv_read() / bdrv_write()
calls anyway, this patch takes the opportunity to replace them with
the byte-based bdrv_pread() / bdrv_pwrite().

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 43590976f730501688096cff103f2923b72b0f32.1517840877.git.berto@igalia.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2-cluster.c