From nobody Fri Nov 7 02:09:51 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544795112215326.3509388397806; Fri, 14 Dec 2018 05:45:12 -0800 (PST) Received: from localhost ([::1]:33599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnmA-0003QU-Qo for importer@patchew.org; Fri, 14 Dec 2018 08:45:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnk0-00014I-C6 for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:42:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnju-0005jV-RN for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:42:56 -0500 Received: from relay.sw.ru ([185.231.240.75]:36724) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gXnjq-0005eO-GC; Fri, 14 Dec 2018 08:42:46 -0500 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gXnjm-000251-5u; Fri, 14 Dec 2018 16:42:42 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Fri, 14 Dec 2018 16:42:39 +0300 Message-Id: <20181214134240.217870-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181214134240.217870-1-vsementsov@virtuozzo.com> References: <20181214134240.217870-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH v4 4/5] qcow2-refcount: check_refcounts_l2: don't count fixed cluster as allocated 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: kwolf@redhat.com, den@openvz.org, vsementsov@virtuozzo.com, mreitz@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" Do not count a cluster which is fixed to be ZERO as allocated. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/qcow2-refcount.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index e76085d9aa..8da0e91dd3 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -1637,15 +1637,6 @@ static int check_refcounts_l2(BlockDriverState *bs, = BdrvCheckResult *res, { uint64_t offset =3D l2_entry & L2E_OFFSET_MASK; =20 - if (flags & CHECK_FRAG_INFO) { - res->bfi.allocated_clusters++; - if (next_contiguous_offset && - offset !=3D next_contiguous_offset) { - res->bfi.fragmented_clusters++; - } - next_contiguous_offset =3D offset + s->cluster_size; - } - /* Correct offsets are cluster aligned */ if (offset_into_cluster(s, offset)) { if (qcow2_get_cluster_type(l2_entry) =3D=3D @@ -1698,6 +1689,15 @@ static int check_refcounts_l2(BlockDriverState *bs, = BdrvCheckResult *res, } } =20 + if (flags & CHECK_FRAG_INFO) { + res->bfi.allocated_clusters++; + if (next_contiguous_offset && + offset !=3D next_contiguous_offset) { + res->bfi.fragmented_clusters++; + } + next_contiguous_offset =3D offset + s->cluster_size; + } + /* Mark cluster as used */ ret =3D qcow2_inc_refcounts_imrt(bs, res, refcount_table, refcount_table_= size, --=20 2.18.0