summary refs log tree commit diff stats
path: root/linux-user/main.c
diff options
context:
space:
mode:
authorHanna Reitz <hreitz@redhat.com>2022-04-05 15:46:51 +0200
committerHanna Reitz <hreitz@redhat.com>2022-04-20 12:09:17 +0200
commit9ffd6d646d1d5ee9087a8cbf0b7d2f96c5656162 (patch)
tree619948f3a7366fc81a137c2b502961979640d50e /linux-user/main.c
parenta8c07ec287554dcefd33733f0e5888a281ddc95e (diff)
downloadfocaccia-qemu-9ffd6d646d1d5ee9087a8cbf0b7d2f96c5656162.tar.gz
focaccia-qemu-9ffd6d646d1d5ee9087a8cbf0b7d2f96c5656162.zip
iotests/108: Test new refcount rebuild algorithm
One clear problem with how qcow2's refcount structure rebuild algorithm
used to be before "qcow2: Improve refcount structure rebuilding" was
that it is prone to failure for qcow2 images on block devices: There is
generally unused space after the actual image, and if that exceeds what
one refblock covers, the old algorithm would invariably write the
reftable past the block device's end, which cannot work.  The new
algorithm does not have this problem.

Test it with three tests:
(1) Create an image with more empty space at the end than what one
    refblock covers, see whether rebuilding the refcount structures
    results in a change in the image file length.  (It should not.)

(2) Leave precisely enough space somewhere at the beginning of the image
    for the new reftable (and the refblock for that place), see whether
    the new algorithm puts the reftable there.  (It should.)

(3) Test the original problem: Create (something like) a block device
    with a fixed size, then create a qcow2 image in there, write some
    data, and then have qemu-img check rebuild the refcount structures.
    Before HEAD^, the reftable would have been written past the image
    file end, i.e. outside of what the block device provides, which
    cannot work.  HEAD^ should have fixed that.
    ("Something like a block device" means a loop device if we can use
    one ("sudo -n losetup" works), or a FUSE block export with
    growable=false otherwise.)

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220405134652.19278-3-hreitz@redhat.com>
Diffstat (limited to 'linux-user/main.c')
0 files changed, 0 insertions, 0 deletions