From nobody Wed Nov 12 10:09:28 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1569856931; cv=none; d=zoho.com; s=zohoarc; b=AbpBR/jc96MkmR6yHz2+4bMLg7wgwUOJpVc5DlUbggPCOHrnIlDh8jKUOnt2TI+MeW/IhvxHNs35MANqi+ViHhEcAeQJKgjsJNntPBg8wLYnUPaT+8iwbeTBibi7DX9BMY+TFUp+XgJK32LHYxhWrThvvFseQWkRt/Hx0Rrxtbg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569856931; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=FPkDEIq3RTEgrMgeiisuKzU51aRY2tmNj79wUOvNtIE=; b=hRds+99uMgAttQPTCPptL2VhsQPvy3fzrdjorlibECM38YVpq1wGaNFFmSBGIOjzUlVk1kNu6WPZFFJGyo8fX6YIvrwjKJqGn9axEF2z7ClNyCmrBIutSIunPhg9jqXpEVn4Y8kaqE4fxvsjzSEYsdrcUNAxKM2+CdjgsPMZhIY= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569856931867516.193779918477; Mon, 30 Sep 2019 08:22:11 -0700 (PDT) Received: from localhost ([::1]:53698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iExV1-000889-Oz for importer@patchew.org; Mon, 30 Sep 2019 11:22:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60093) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iExOJ-0004Yf-VK for qemu-devel@nongnu.org; Mon, 30 Sep 2019 11:15:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iExOI-0005us-MU for qemu-devel@nongnu.org; Mon, 30 Sep 2019 11:15:11 -0400 Received: from relay.sw.ru ([185.231.240.75]:46664) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iExOF-0005ot-9Z; Mon, 30 Sep 2019 11:15:07 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iExOC-0005tD-IE; Mon, 30 Sep 2019 18:15:04 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH 10/10] block/qcow2-bitmap: use bdrv_dirty_bitmap_next_dirty Date: Mon, 30 Sep 2019 18:15:02 +0300 Message-Id: <20190930151502.7829-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190930151502.7829-1-vsementsov@virtuozzo.com> References: <20190930151502.7829-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" store_bitmap_data() loop does bdrv_set_dirty_iter() on each iteration, which means that we actually don't need iterator itself and we can use simpler bitmap API. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/qcow2-bitmap.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index 98294a7696..09d892638d 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -1260,7 +1260,6 @@ static uint64_t *store_bitmap_data(BlockDriverState *= bs, uint64_t bm_size =3D bdrv_dirty_bitmap_size(bitmap); const char *bm_name =3D bdrv_dirty_bitmap_name(bitmap); uint8_t *buf =3D NULL; - BdrvDirtyBitmapIter *dbi; uint64_t *tb; uint64_t tb_size =3D size_to_clusters(s, @@ -1279,12 +1278,14 @@ static uint64_t *store_bitmap_data(BlockDriverState= *bs, return NULL; } =20 - dbi =3D bdrv_dirty_iter_new(bitmap); buf =3D g_malloc(s->cluster_size); limit =3D bytes_covered_by_bitmap_cluster(s, bitmap); assert(DIV_ROUND_UP(bm_size, limit) =3D=3D tb_size); =20 - while ((offset =3D bdrv_dirty_iter_next(dbi)) >=3D 0) { + offset =3D 0; + while ((offset =3D bdrv_dirty_bitmap_next_dirty(bitmap, offset, INT64_= MAX)) + >=3D 0) + { uint64_t cluster =3D offset / limit; uint64_t end, write_size; int64_t off; @@ -1331,19 +1332,17 @@ static uint64_t *store_bitmap_data(BlockDriverState= *bs, break; } =20 - bdrv_set_dirty_iter(dbi, end); + offset =3D end; } =20 *bitmap_table_size =3D tb_size; g_free(buf); - bdrv_dirty_iter_free(dbi); =20 return tb; =20 fail: clear_bitmap_table(bs, tb, tb_size); g_free(buf); - bdrv_dirty_iter_free(dbi); g_free(tb); =20 return NULL; --=20 2.21.0