qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] qcow2: Fix preallocation on images with unaligned sizes


From: Max Reitz
Subject: Re: [PATCH v2] qcow2: Fix preallocation on images with unaligned sizes
Date: Tue, 30 Jun 2020 11:37:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 17.06.20 16:00, Alberto Garcia wrote:
> When resizing an image with qcow2_co_truncate() using the falloc or
> full preallocation modes the code assumes that both the old and new
> sizes are cluster-aligned.
> 
> There are two problems with this:
> 
>   1) The calculation of how many clusters are involved does not always
>      get the right result.
> 
>      Example: creating a 60KB image and resizing it (with
>      preallocation=full) to 80KB won't allocate the second cluster.
> 
>   2) No copy-on-write is performed, so in the previous example if
>      there is a backing file then the first 60KB of the first cluster
>      won't be filled with data from the backing file.
> 
> This patch fixes both issues.
> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> v2: iotests: don't check the image size if data_file is set [Max]
> 
>  block/qcow2.c              | 17 ++++++++++++++---
>  tests/qemu-iotests/125     | 24 ++++++++++++++++++++++++
>  tests/qemu-iotests/125.out |  9 +++++++++
>  3 files changed, 47 insertions(+), 3 deletions(-)

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]