qemu-devel
[Top][All Lists]
Advanced

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

Re: qcow2 merge_cow() question


From: Alberto Garcia
Subject: Re: qcow2 merge_cow() question
Date: Fri, 21 Aug 2020 14:52:36 +0200
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Fri 21 Aug 2020 02:32:00 PM CEST, Vladimir Sementsov-Ogievskiy wrote:
> Hi!
>
> I'm sorry, I feel I already asked about it, but can't now find the answer.
>
> What are these ifs for?
>
>            /* The data (middle) region must be immediately after the
>             * start region */
>            if (l2meta_cow_start(m) + m->cow_start.nb_bytes != offset) {
>                continue;
>            }
>                                                                               
>                              
>            /* The end region must be immediately after the data (middle)
>             * region */
>            if (m->offset + m->cow_end.offset != offset + bytes) {
>                continue;
>            }
>
> How is it possible that data doesn't immediately follow start cow region or
> end cow region doesn't immediately follow data region?

They are sanity checks. They maybe cannot happen in practice and in that
case I suppose they should be replaced with assertions but this should
be checked carefully. If I remember correctly I was wary of overlooking
a case where this could happen.

In particular, that function receives only one data region but a list of
QCowL2Meta objects. I think you can get more than one QCowL2Meta if the
same request involves a mix of copied and newly allocated clusters, but
that shouldn't be a problem either.

Berto



reply via email to

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