From nobody Thu Dec 18 13:17:57 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557242446; cv=none; d=zoho.com; s=zohoarc; b=mm89okiEjQVckeLjIOffprfGBXU9btuFWyxEq/YKdvFZlJ3Nd7SIlirUS1ypa9da/4Y1+DZsiN9AMalpRXFy0dkJfI8JqDI/StRyi785sY1uutQAUFVUbexsE2ciCU4J1jwgfdmbnR9HPEFSaS616IJZbVxpCV3zkO1vFfvIbdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557242446; 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=4QJm8x2h7GutGW7RS3eefGfefmXMs/TGuQYA5Ia4gMI=; b=aJ2HaaA4Z0I9FrZWfVsPT2PvJHUqRzn5rP8PaWAoB5lKzBp1E7l/RkZPMgbB2RKDn7OJbTsjR1f5Aa3EL3ZbEc+NxOJo9m0hMq8bKaVC9sh+AKg+D0CQ0gCGFmR7AYptvgPn8E9HqhC5LzRFHiYfWJDCai7UyuCmSrtY14AAvf8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 1557242446314284.9996094852668; Tue, 7 May 2019 08:20:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:48475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hO1tX-0000YO-78 for importer@patchew.org; Tue, 07 May 2019 11:20:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hO1rZ-0007vC-M4 for qemu-devel@nongnu.org; Tue, 07 May 2019 11:18:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hO1rY-0003xg-Ov for qemu-devel@nongnu.org; Tue, 07 May 2019 11:18:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55184) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hO1rU-0003rz-TT; Tue, 07 May 2019 11:18:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A9943091761; Tue, 7 May 2019 15:18:31 +0000 (UTC) Received: from localhost (unknown [10.40.205.217]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 20E4C10027BD; Tue, 7 May 2019 15:18:30 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 7 May 2019 17:18:12 +0200 Message-Id: <20190507151819.17401-5-mreitz@redhat.com> In-Reply-To: <20190507151819.17401-1-mreitz@redhat.com> References: <20190507151819.17401-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 07 May 2019 15:18:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 04/11] 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Do not count a cluster which is fixed to be ZERO as allocated. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz Message-id: 20190227131433.197063-5-vsementsov@virtuozzo.com Signed-off-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 1ac2b0490d..6851807ffc 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -1660,15 +1660,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(bs, l2_entry) =3D=3D @@ -1721,6 +1712,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 */ if (!has_data_file(bs)) { ret =3D qcow2_inc_refcounts_imrt(bs, res, refcount_table, --=20 2.20.1