qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/5] block/qcow2-bitmap: Count queued bitmaps to


From: John Snow
Subject: Re: [Qemu-devel] [PATCH 4/5] block/qcow2-bitmap: Count queued bitmaps towards nb_bitmaps
Date: Fri, 7 Jun 2019 14:24:26 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1


On 6/7/19 10:58 AM, Vladimir Sementsov-Ogievskiy wrote:
> 06.06.2019 21:41, John Snow wrote:
>> When we check to see if we can store a bitmap, we don't check how many
>> we've queued up. This can cause a problem saving bitmaps on close
>> instead of when we request them to be added. With the stricter add
>> interface, prohibit these bitmaps specifically.
>>
>> To match, make the remove interface more strict as well; now rejecting
>> any requests to remove bitmaps that were never queued for storage.
>>
>> We don't need to "find" the bitmap when the interface has been given the
>> bitmap explicitly, but this is done to make sure that the bitmap given
>> actually does belong to the bs we were passed as a paranoia check to
>> enforce consistency.
> 
> If you want to check it, I'd really prefer to do it explictly,
> by adding "bool bdrv_has_dirty_bitmap(bs, bitmap) handler, or bitmap.bs 
> field",
> instead of hiding it under inconvenient interface of helper, so we actually do
> 
> name = bdrv_dirty_bitmap_name(bitmap);
> bitmap = bdrv_find_dirty_bitmap(bs, name);
> 
> it really looks strange.
> 

You're right, it does look weird. It's not obvious when you read it what
the real purpose is. I'll try to rectify it with an explicit helper like
you suggest.

> Hmmm, when I read series cover letter and this commit message, I thought
> that you'll just calculate current number of persistent bitmaps on bs..
> Do we really need to introduce additional counters on qcow2 state?
> 

I suppose I could do that, too -- that seems a bit heavier than just
incrementing a counter, but it has less risk of getting out of sync.

> So, you want to check nb_queued + s->nb_bitmaps instead of just s->nb_bitmaps.
> 
> I think we can just count persistent dirty bitmaps and take that number
> (as, there should not be in-image bitmaps, for which we don't have in-ram
> version, but we can check it too and return an error on mismatch (or count
> in-image-not-in-ram bitmaps and this count to number of in-ram persistent
> bitmaps it seems an extra thing)..
> 

If I cache the bm_list as discussed in patch 2, we can actually avoid
re-enumerating all of the bitmaps and just go off of that data without
having to add any new counters.

--js



reply via email to

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