From nobody Sun Sep 28 11:12:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547600810693971.7805710662672; Tue, 15 Jan 2019 17:06:50 -0800 (PST) Received: from localhost ([127.0.0.1]:37584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjZfN-0006bt-HD for importer@patchew.org; Tue, 15 Jan 2019 20:06:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjZaS-0002un-33 for qemu-devel@nongnu.org; Tue, 15 Jan 2019 20:01:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjZaJ-0004cC-2W for qemu-devel@nongnu.org; Tue, 15 Jan 2019 20:01:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56576) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjZa8-0004SR-RL for qemu-devel@nongnu.org; Tue, 15 Jan 2019 20:01:27 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C579C04B948; Wed, 16 Jan 2019 01:01:15 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-221.bos.redhat.com [10.18.17.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1E5419C7C; Wed, 16 Jan 2019 01:01:14 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Tue, 15 Jan 2019 20:01:06 -0500 Message-Id: <20190116010106.27626-9-jsnow@redhat.com> In-Reply-To: <20190116010106.27626-1-jsnow@redhat.com> References: <20190116010106.27626-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 16 Jan 2019 01:01:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 8/8] Revert "hbitmap: Add @advance param to hbitmap_iter_next()" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy This reverts commit a33fbb4f8b64226becf502a123733776ce319b24. The functionality is unused. Note: in addition to automatic revert, drop second parameter in hbitmap_iter_next() call from hbitmap_next_dirty_area() too. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Signed-off-by: John Snow --- block/backup.c | 2 +- block/dirty-bitmap.c | 2 +- include/qemu/hbitmap.h | 5 +---- tests/test-hbitmap.c | 26 +++++++++++++------------- util/hbitmap.c | 12 ++++-------- 5 files changed, 20 insertions(+), 27 deletions(-) diff --git a/block/backup.c b/block/backup.c index 9ffce5c183..435414e964 100644 --- a/block/backup.c +++ b/block/backup.c @@ -385,7 +385,7 @@ static int coroutine_fn backup_run_incremental(BackupBl= ockJob *job) HBitmapIter hbi; =20 hbitmap_iter_init(&hbi, job->copy_bitmap, 0); - while ((cluster =3D hbitmap_iter_next(&hbi, true)) !=3D -1) { + while ((cluster =3D hbitmap_iter_next(&hbi)) !=3D -1) { do { if (yield_and_check(job)) { return 0; diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 4d9a8af17d..00ea36f554 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -515,7 +515,7 @@ void bdrv_dirty_iter_free(BdrvDirtyBitmapIter *iter) =20 int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter *iter) { - return hbitmap_iter_next(&iter->hbi, true); + return hbitmap_iter_next(&iter->hbi); } =20 /* Called within bdrv_dirty_bitmap_lock..unlock */ diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h index 097dce31ee..4afbe6292e 100644 --- a/include/qemu/hbitmap.h +++ b/include/qemu/hbitmap.h @@ -351,14 +351,11 @@ void hbitmap_free_meta(HBitmap *hb); /** * hbitmap_iter_next: * @hbi: HBitmapIter to operate on. - * @advance: If true, advance the iterator. Otherwise, the next call - * of this function will return the same result (if that - * position is still dirty). * * Return the next bit that is set in @hbi's associated HBitmap, * or -1 if all remaining bits are zero. */ -int64_t hbitmap_iter_next(HBitmapIter *hbi, bool advance); +int64_t hbitmap_iter_next(HBitmapIter *hbi); =20 /** * hbitmap_iter_next_word: diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c index 6358f35359..592d8219db 100644 --- a/tests/test-hbitmap.c +++ b/tests/test-hbitmap.c @@ -46,7 +46,7 @@ static void hbitmap_test_check(TestHBitmapData *data, =20 i =3D first; for (;;) { - next =3D hbitmap_iter_next(&hbi, true); + next =3D hbitmap_iter_next(&hbi); if (next < 0) { next =3D data->size; } @@ -435,25 +435,25 @@ static void test_hbitmap_iter_granularity(TestHBitmap= Data *data, /* Note that hbitmap_test_check has to be invoked manually in this tes= t. */ hbitmap_test_init(data, 131072 << 7, 7); hbitmap_iter_init(&hbi, data->hb, 0); - g_assert_cmpint(hbitmap_iter_next(&hbi, true), <, 0); + g_assert_cmpint(hbitmap_iter_next(&hbi), <, 0); =20 hbitmap_test_set(data, ((L2 + L1 + 1) << 7) + 8, 8); hbitmap_iter_init(&hbi, data->hb, 0); - g_assert_cmpint(hbitmap_iter_next(&hbi, true), =3D=3D, (L2 + L1 + 1) <= < 7); - g_assert_cmpint(hbitmap_iter_next(&hbi, true), <, 0); + g_assert_cmpint(hbitmap_iter_next(&hbi), =3D=3D, (L2 + L1 + 1) << 7); + g_assert_cmpint(hbitmap_iter_next(&hbi), <, 0); =20 hbitmap_iter_init(&hbi, data->hb, (L2 + L1 + 2) << 7); - g_assert_cmpint(hbitmap_iter_next(&hbi, true), <, 0); + g_assert_cmpint(hbitmap_iter_next(&hbi), <, 0); =20 hbitmap_test_set(data, (131072 << 7) - 8, 8); hbitmap_iter_init(&hbi, data->hb, 0); - g_assert_cmpint(hbitmap_iter_next(&hbi, true), =3D=3D, (L2 + L1 + 1) <= < 7); - g_assert_cmpint(hbitmap_iter_next(&hbi, true), =3D=3D, 131071 << 7); - g_assert_cmpint(hbitmap_iter_next(&hbi, true), <, 0); + g_assert_cmpint(hbitmap_iter_next(&hbi), =3D=3D, (L2 + L1 + 1) << 7); + g_assert_cmpint(hbitmap_iter_next(&hbi), =3D=3D, 131071 << 7); + g_assert_cmpint(hbitmap_iter_next(&hbi), <, 0); =20 hbitmap_iter_init(&hbi, data->hb, (L2 + L1 + 2) << 7); - g_assert_cmpint(hbitmap_iter_next(&hbi, true), =3D=3D, 131071 << 7); - g_assert_cmpint(hbitmap_iter_next(&hbi, true), <, 0); + g_assert_cmpint(hbitmap_iter_next(&hbi), =3D=3D, 131071 << 7); + g_assert_cmpint(hbitmap_iter_next(&hbi), <, 0); } =20 static void hbitmap_test_set_boundary_bits(TestHBitmapData *data, ssize_t = diff) @@ -893,7 +893,7 @@ static void test_hbitmap_serialize_zeroes(TestHBitmapDa= ta *data, for (i =3D 0; i < num_positions; i++) { hbitmap_deserialize_zeroes(data->hb, positions[i], min_l1, true); hbitmap_iter_init(&iter, data->hb, 0); - next =3D hbitmap_iter_next(&iter, true); + next =3D hbitmap_iter_next(&iter); if (i =3D=3D num_positions - 1) { g_assert_cmpint(next, =3D=3D, -1); } else { @@ -919,10 +919,10 @@ static void test_hbitmap_iter_and_reset(TestHBitmapDa= ta *data, =20 hbitmap_iter_init(&hbi, data->hb, BITS_PER_LONG - 1); =20 - hbitmap_iter_next(&hbi, true); + hbitmap_iter_next(&hbi); =20 hbitmap_reset_all(data->hb); - hbitmap_iter_next(&hbi, true); + hbitmap_iter_next(&hbi); } =20 static void test_hbitmap_next_zero_check_range(TestHBitmapData *data, diff --git a/util/hbitmap.c b/util/hbitmap.c index fa356522c4..7905212a8b 100644 --- a/util/hbitmap.c +++ b/util/hbitmap.c @@ -144,7 +144,7 @@ unsigned long hbitmap_iter_skip_words(HBitmapIter *hbi) return cur; } =20 -int64_t hbitmap_iter_next(HBitmapIter *hbi, bool advance) +int64_t hbitmap_iter_next(HBitmapIter *hbi) { unsigned long cur =3D hbi->cur[HBITMAP_LEVELS - 1] & hbi->hb->levels[HBITMAP_LEVELS - 1][hbi->pos]; @@ -157,12 +157,8 @@ int64_t hbitmap_iter_next(HBitmapIter *hbi, bool advan= ce) } } =20 - if (advance) { - /* The next call will resume work from the next bit. */ - hbi->cur[HBITMAP_LEVELS - 1] =3D cur & (cur - 1); - } else { - hbi->cur[HBITMAP_LEVELS - 1] =3D cur; - } + /* The next call will resume work from the next bit. */ + hbi->cur[HBITMAP_LEVELS - 1] =3D cur & (cur - 1); item =3D ((uint64_t)hbi->pos << BITS_PER_LEVEL) + ctzl(cur); =20 return item << hbi->granularity; @@ -261,7 +257,7 @@ bool hbitmap_next_dirty_area(const HBitmap *hb, uint64_= t *start, end =3D *count > hb->orig_size - *start ? hb->orig_size : *start + *co= unt; =20 hbitmap_iter_init(&hbi, hb, *start); - firt_dirty_off =3D hbitmap_iter_next(&hbi, false); + firt_dirty_off =3D hbitmap_iter_next(&hbi); =20 if (firt_dirty_off < 0 || firt_dirty_off >=3D end) { return false; --=20 2.17.2