On 11.09.20 16:09, Alberto Garcia wrote: > This function preallocates metadata structures and then extends the > image to its new size, but that new size calculation is wrong because > it doesn't take into account that the host_offset variable is always > cluster-aligned. > > This problem can be reproduced with preallocation=metadata when the > original size is not cluster-aligned but the new size is. In this case > the final image size will be shorter than expected. > > qemu-img create -f qcow2 img.qcow2 31k > qemu-img resize --preallocation=metadata img.qcow2 128k > > Signed-off-by: Alberto Garcia > --- > block/qcow2.c | 1 + > tests/qemu-iotests/125 | 40 +++++++++++++++++++++----------------- > tests/qemu-iotests/125.out | 28 ++++++++++++++++++++++++-- > 3 files changed, 49 insertions(+), 20 deletions(-) Reviewed-by: Max Reitz