qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: simplify code around releasing bitmaps
Date: Mon, 26 Mar 2018 12:30:33 +0200	[thread overview]
Message-ID: <e60b1a9e-e5e4-e6ad-ac3c-2b3276c54ffc@redhat.com> (raw)
In-Reply-To: <39eabba4-ce6d-8b5b-f3a8-78dde910ec2e@virtuozzo.com>

On 26/03/2018 12:24, Vladimir Sementsov-Ogievskiy wrote:
> 23.03.2018 19:42, Paolo Bonzini wrote:
>> QLIST_REMOVE does not require walking the list, and once the "bitmap"
>> argument is removed from bdrv_do_release_matching_dirty_bitmap_locked
>> the code simplifies a lot and it is worth inlining everything in the
>> callers of bdrv_do_release_matching_dirty_bitmap.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>   block/dirty-bitmap.c | 81
>> +++++++++++++++++++---------------------------------
>>   1 file changed, 30 insertions(+), 51 deletions(-)
>>
>> diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
>> index 13bb5066a4..c0fb49bf7b 100644
>> --- a/block/dirty-bitmap.c
>> +++ b/block/dirty-bitmap.c
>> @@ -250,48 +250,15 @@ void
>> bdrv_dirty_bitmap_enable_successor(BdrvDirtyBitmap *bitmap)
>>   }
>>     /* Called within bdrv_dirty_bitmap_lock..unlock */
> 
> Worth adding "Called with BQL taken" to the comment?

Yes, good idea.

>> +static void bdrv_release_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap)

> worth adding "Called with BQL taken." to the comment?
> bdrv_release_named_dirty_bitmaps functions has it.
> 
>>   void bdrv_release_persistent_dirty_bitmaps(BlockDriverState *bs)

This is pre-existing, but it's also a good idea.

Paolo

>> -    bdrv_do_release_matching_dirty_bitmap(bs, NULL,
>> -                                         
>> bdrv_dirty_bitmap_get_persistance);
>> +    BdrvDirtyBitmap *bm, *next;
>> +
>> +    bdrv_dirty_bitmaps_lock(bs);
>> +    QLIST_FOREACH_SAFE(bm, &bs->dirty_bitmaps, list, next) {
>> +        if (bdrv_dirty_bitmap_get_persistance(bm)) {
>> +            bdrv_release_dirty_bitmap_locked(bm);
>> +        }
>> +    }
>> +    bdrv_dirty_bitmaps_unlock(bs);
>>   }
>>     /**
> 
> anyway,
> 
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> 

      reply	other threads:[~2018-03-26 10:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 16:42 [Qemu-devel] [PATCH] block: simplify code around releasing bitmaps Paolo Bonzini
2018-03-26 10:24 ` Vladimir Sementsov-Ogievskiy
2018-03-26 10:30   ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e60b1a9e-e5e4-e6ad-ac3c-2b3276c54ffc@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).