qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH v2 01/26] qcow2: Add calculate_l2_meta()


From: Alberto Garcia
Subject: Re: [RFC PATCH v2 01/26] qcow2: Add calculate_l2_meta()
Date: Wed, 30 Oct 2019 16:56:24 +0100
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Mon 28 Oct 2019 01:50:54 PM CET, Vladimir Sementsov-Ogievskiy wrote:
>> -        .cow_end = {
>> -            .offset     = nb_bytes,
>
> hmm this logic is changed.. after the patch, it would be not nb_bytes, but
>
> offset_into_cluster(s, guest_offset) + MIN(*bytes, nb_bytes - 
> offset_into_cluster(s, guest_offset))

It hasn't changed. The value of .cow_end.offset before the patch is
nb_bytes (these two lines are equivalent):

  nb_bytes = MIN(requested_bytes, avail_bytes);
  nb_bytes = MIN(*bytes + offset_into_cluster, avail_bytes);

After the patch we update *bytes to pass it to calculate_l2_meta(). Here
is the value (again, these are all equivalent):

  *bytes = MIN(*bytes, nb_bytes - offset_into_cluster)
  *bytes = MIN(*bytes, MIN(*bytes + offset_into_cluster, avail_bytes) -
           offset_into_cluster)
  *bytes = MIN(*bytes, MIN(*bytes, avail_bytes - offset_into_cluster))
  *bytes = MIN(*bytes, avail_bytes - offset_into_cluster)

And here's the value of .cow_end.offset set in calculate_l2_meta():

  cow_end_from = *bytes + offset_into_cluster
  cow_end_from = MIN(*bytes, avail_bytes - offset_into_cluster) + 
                 offset_into_cluster
  cow_end_from = MIN(*bytes + offset_into_cluster, avail_bytes)

This last definition of cow_end_from is the same as nb_bytes as used
before the patch.

Berto



reply via email to

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