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