qemu-devel
[Top][All Lists]
Advanced

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

Re: qcow2 merge_cow() question


From: Vladimir Sementsov-Ogievskiy
Subject: Re: qcow2 merge_cow() question
Date: Fri, 21 Aug 2020 16:42:29 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

21.08.2020 15:52, Alberto Garcia wrote:
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


OK, thanks. So, intuitively it shouldn't happen, but there should be
some careful investigation to change them to assertions.

I think that the list actually may contain not more than 2 entries.
So the whole diversity is that we may have both cow regions in one
meta, or in two separate metas.

--
Best regards,
Vladimir



reply via email to

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