[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] qcow2: Make preallocate_co() resize the image to the cor
From: |
Max Reitz |
Subject: |
Re: [PATCH 1/2] qcow2: Make preallocate_co() resize the image to the correct size |
Date: |
Tue, 15 Sep 2020 11:29:22 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
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 <berto@igalia.com>
> ---
> block/qcow2.c | 1 +
> tests/qemu-iotests/125 | 40 +++++++++++++++++++++-----------------
> tests/qemu-iotests/125.out | 28 ++++++++++++++++++++++++--
> 3 files changed, 49 insertions(+), 20 deletions(-)
The test additions make this test fail with compat=0.10. Are you OK
with disabling compat=0.10 by squashing this in?
diff --git a/tests/qemu-iotests/125 b/tests/qemu-iotests/125
index 1f35598b2b..894d53f2bd 100755
--- a/tests/qemu-iotests/125
+++ b/tests/qemu-iotests/125
@@ -43,6 +43,10 @@ get_image_size_on_host()
_supported_fmt qcow2
_supported_proto file
+# Growing a file with a backing file (without preallocation=full or
+# =falloc) requires zeroing the newly added area, which is impossible
+# to do quickly for v2 images, and hence is unsupported.
+_unsupported_imgopts 'compat=0.10'
if [ -z "$TEST_IMG_FILE" ]; then
TEST_IMG_FILE=$TEST_IMG
signature.asc
Description: OpenPGP digital signature