qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH v9 20/34] qcow2: Add subcluster support to calculate_l2_meta(


From: Max Reitz
Subject: Re: [PATCH v9 20/34] qcow2: Add subcluster support to calculate_l2_meta()
Date: Thu, 2 Jul 2020 13:30:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 28.06.20 13:02, Alberto Garcia wrote:
> If an image has subclusters then there are more copy-on-write
> scenarios that we need to consider. Let's say we have a write request
> from the middle of subcluster #3 until the end of the cluster:
> 
> 1) If we are writing to a newly allocated cluster then we need
>    copy-on-write. The previous contents of subclusters #0 to #3 must
>    be copied to the new cluster. We can optimize this process by
>    skipping all leading unallocated or zero subclusters (the status of
>    those skipped subclusters will be reflected in the new L2 bitmap).
> 
> 2) If we are overwriting an existing cluster:
> 
>    2.1) If subcluster #3 is unallocated or has the all-zeroes bit set
>         then we need copy-on-write (on subcluster #3 only).
> 
>    2.2) If subcluster #3 was already allocated then there is no need
>         for any copy-on-write. However we still need to update the L2
>         bitmap to reflect possible changes in the allocation status of
>         subclusters #4 to #31. Because of this, this function checks
>         if all the overwritten subclusters are already allocated and
>         in this case it returns without creating a new QCowL2Meta
>         structure.
> 
> After all these changes l2meta_cow_start() and l2meta_cow_end()
> are not necessarily cluster-aligned anymore. We need to update the
> calculation of old_start and old_end in handle_dependencies() to
> guarantee that no two requests try to write on the same cluster.
> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---
>  block/qcow2-cluster.c | 163 +++++++++++++++++++++++++++++++++---------
>  1 file changed, 131 insertions(+), 32 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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