From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Max Reitz <mreitz@redhat.com>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>
Cc: "kwolf@redhat.com" <kwolf@redhat.com>,
"jsnow@redhat.com" <jsnow@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Denis Lunev <den@virtuozzo.com>
Subject: Re: [PATCH v3 06/10] block/dirty-bitmap: add _next_dirty API
Date: Mon, 20 Jan 2020 16:30:49 +0000 [thread overview]
Message-ID: <2641fe67-1035-e00b-131d-513aec6752a8@virtuozzo.com> (raw)
In-Reply-To: <0350481a-12ad-1608-79f1-b9f433963565@redhat.com>
20.01.2020 16:14, Max Reitz wrote:
> On 19.12.19 11:03, Vladimir Sementsov-Ogievskiy wrote:
>> We have bdrv_dirty_bitmap_next_zero, let's add corresponding
>> bdrv_dirty_bitmap_next_dirty, which is more comfortable to use than
>> bitmap iterators in some cases.
>>
>> For test modify test_hbitmap_next_zero_check_range to check both
>> next_zero and next_dirty and add some new checks.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>> include/block/dirty-bitmap.h | 2 +
>> include/qemu/hbitmap.h | 13 ++++
>> block/dirty-bitmap.c | 6 ++
>> tests/test-hbitmap.c | 130 ++++++++++++++++++++---------------
>> util/hbitmap.c | 60 ++++++++--------
>> 5 files changed, 126 insertions(+), 85 deletions(-)
>
> [...]
>
>> diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h
>> index b6e85f3d5d..a4b032b270 100644
>> --- a/include/qemu/hbitmap.h
>> +++ b/include/qemu/hbitmap.h
>> @@ -297,6 +297,19 @@ void hbitmap_free(HBitmap *hb);
>> */
>> void hbitmap_iter_init(HBitmapIter *hbi, const HBitmap *hb, uint64_t first);
>>
>> +/*
>> + * hbitmap_next_dirty:
>> + *
>> + * Find next dirty bit within selected range. If not found, return -1.
>> + *
>> + * @hb: The HBitmap to operate on
>> + * @start: The bit to start from.
>> + * @count: Number of bits to proceed. If @start+@count > bitmap size, the whole
>> + * bitmap is looked through. You can use UINT64_MAX as @count to search up to
>
> I would’ve said s/looked through/scanned/, but it matches
> hbitmap_next_zero()’s documentation, so it’s fine.
>
> But definitely s/UINT64_MAX/INT64_MAX/.
>
>> + * the bitmap end.
>> + */
>> +int64_t hbitmap_next_dirty(const HBitmap *hb, int64_t start, int64_t count);
>> +
>> /* hbitmap_next_zero:
>> *
>> * Find next not dirty bit within selected range. If not found, return -1.
>
> [...]
>
>> diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c
>> index 0e1e5c64dd..e3f1b3f361 100644
>> --- a/tests/test-hbitmap.c
>> +++ b/tests/test-hbitmap.c
>> @@ -816,92 +816,108 @@ static void test_hbitmap_iter_and_reset(TestHBitmapData *data,
>> hbitmap_iter_next(&hbi);
>> }
>>
>> -static void test_hbitmap_next_zero_check_range(TestHBitmapData *data,
>> - uint64_t start,
>> - uint64_t count)
>> +static void test_hbitmap_next_x_check_range(TestHBitmapData *data,
>> + uint64_t start,
>> + uint64_t count)
>
> Why not change the parameters to be signed while we’re already here?
>
> [...]
>
>> diff --git a/util/hbitmap.c b/util/hbitmap.c
>> index df22f06be6..d23f4b9678 100644
>> --- a/util/hbitmap.c
>> +++ b/util/hbitmap.c
>> @@ -193,6 +193,30 @@ void hbitmap_iter_init(HBitmapIter *hbi, const HBitmap *hb, uint64_t first)
>> }
>> }
>>
>> +int64_t hbitmap_next_dirty(const HBitmap *hb, int64_t start, int64_t count)
>> +{
>> + HBitmapIter hbi;
>> + int64_t firt_dirty_off;
>
> Pre-existing, but isn’t this just a typo that you could fix here? (i.e.
> s/firt/first/)
>
> Apart from this minor things:
Agree with them.
>
> Reviewed-by: Max Reitz <mreitz@redhat.com>
>
>> + uint64_t end;
>> +
>> + assert(start >= 0 && count >= 0);
>> +
>> + if (start >= hb->orig_size || count == 0) {
>> + return -1;
>> + }
>> +
>> + end = count > hb->orig_size - start ?
>
--
Best regards,
Vladimir
next prev parent reply other threads:[~2020-01-20 16:32 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-19 10:03 [PATCH v3 00/10] Further bitmaps improvements Vladimir Sementsov-Ogievskiy
2019-12-19 10:03 ` [PATCH v3 01/10] hbitmap: assert that we don't create bitmap larger than INT64_MAX Vladimir Sementsov-Ogievskiy
2020-01-20 10:51 ` Max Reitz
2019-12-19 10:03 ` [PATCH v3 02/10] hbitmap: move hbitmap_iter_next_word to hbitmap.c Vladimir Sementsov-Ogievskiy
2020-01-20 10:55 ` Max Reitz
2020-01-20 16:14 ` Vladimir Sementsov-Ogievskiy
2019-12-19 10:03 ` [PATCH v3 03/10] hbitmap: unpublish hbitmap_iter_skip_words Vladimir Sementsov-Ogievskiy
2020-01-20 10:59 ` Max Reitz
2019-12-19 10:03 ` [PATCH v3 04/10] hbitmap: drop meta bitmaps as they are unused Vladimir Sementsov-Ogievskiy
2020-01-20 11:13 ` Max Reitz
2020-01-20 16:20 ` Vladimir Sementsov-Ogievskiy
2020-01-20 17:05 ` Max Reitz
2020-01-20 17:28 ` Vladimir Sementsov-Ogievskiy
2020-01-20 19:53 ` Eric Blake
2020-01-21 9:15 ` Vladimir Sementsov-Ogievskiy
2019-12-19 10:03 ` [PATCH v3 05/10] block/dirty-bitmap: switch _next_dirty_area and _next_zero to int64_t Vladimir Sementsov-Ogievskiy
2020-01-20 11:59 ` Max Reitz
2020-01-20 12:28 ` Vladimir Sementsov-Ogievskiy
2020-01-20 12:53 ` Max Reitz
2020-01-20 19:56 ` Eric Blake
2019-12-19 10:03 ` [PATCH v3 06/10] block/dirty-bitmap: add _next_dirty API Vladimir Sementsov-Ogievskiy
2020-01-20 13:14 ` Max Reitz
2020-01-20 16:30 ` Vladimir Sementsov-Ogievskiy [this message]
2020-01-21 9:35 ` Vladimir Sementsov-Ogievskiy
2019-12-19 10:03 ` [PATCH v3 07/10] block/dirty-bitmap: improve _next_dirty_area API Vladimir Sementsov-Ogievskiy
2020-01-20 13:58 ` Max Reitz
2020-01-20 16:26 ` Vladimir Sementsov-Ogievskiy
2019-12-19 10:03 ` [PATCH v3 08/10] nbd/server: introduce NBDExtentArray Vladimir Sementsov-Ogievskiy
2020-01-20 20:20 ` Eric Blake
2020-01-21 10:25 ` Vladimir Sementsov-Ogievskiy
2019-12-19 10:03 ` [PATCH v3 09/10] nbd/server: use bdrv_dirty_bitmap_next_dirty_area Vladimir Sementsov-Ogievskiy
2020-01-20 20:23 ` Eric Blake
2019-12-19 10:03 ` [PATCH v3 10/10] block/qcow2-bitmap: use bdrv_dirty_bitmap_next_dirty Vladimir Sementsov-Ogievskiy
2020-01-20 14:18 ` Max Reitz
2020-01-20 16:05 ` Vladimir Sementsov-Ogievskiy
2020-01-20 9:08 ` [PATCH v3 00/10] Further bitmaps improvements Vladimir Sementsov-Ogievskiy
2020-01-20 14:20 ` Max Reitz
2020-01-20 16:33 ` Vladimir Sementsov-Ogievskiy
2020-01-20 20:25 ` Eric Blake
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=2641fe67-1035-e00b-131d-513aec6752a8@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=den@virtuozzo.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).