From nobody Fri Nov 7 01:56:06 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551275212173611.1545238769527; Wed, 27 Feb 2019 05:46:52 -0800 (PST) Received: from localhost ([127.0.0.1]:44028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyzXs-0000JT-4V for importer@patchew.org; Wed, 27 Feb 2019 08:46:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyzUr-0005eA-DE for qemu-devel@nongnu.org; Wed, 27 Feb 2019 08:43:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyzIw-0003ws-QN for qemu-devel@nongnu.org; Wed, 27 Feb 2019 08:31:23 -0500 Received: from relay.sw.ru ([185.231.240.75]:33468) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyzIw-0003mR-Iq; Wed, 27 Feb 2019 08:31:22 -0500 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gyz2f-0004Qy-D5; Wed, 27 Feb 2019 16:14:33 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Wed, 27 Feb 2019 16:14:29 +0300 Message-Id: <20190227131433.197063-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190227131433.197063-1-vsementsov@virtuozzo.com> References: <20190227131433.197063-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH v5 1/5] qcow2-refcount: fix check_oflag_copied 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, vsementsov@virtuozzo.com, den@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" Increase corruptions_fixed only after successful fix. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/qcow2-refcount.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 6f13d470d3..16e8942343 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -1825,7 +1825,7 @@ static int check_oflag_copied(BlockDriverState *bs, B= drvCheckResult *res, for (i =3D 0; i < s->l1_size; i++) { uint64_t l1_entry =3D s->l1_table[i]; uint64_t l2_offset =3D l1_entry & L1E_OFFSET_MASK; - bool l2_dirty =3D false; + int l2_dirty =3D 0; =20 if (!l2_offset) { continue; @@ -1887,8 +1887,7 @@ static int check_oflag_copied(BlockDriverState *bs, B= drvCheckResult *res, l2_table[j] =3D cpu_to_be64(refcount =3D=3D 1 ? l2_entry | QCOW_OFLAG_COPIED : l2_entry & ~QCOW_OFLAG_COPIED); - l2_dirty =3D true; - res->corruptions_fixed++; + l2_dirty++; } else { res->corruptions++; } @@ -1896,7 +1895,7 @@ static int check_oflag_copied(BlockDriverState *bs, B= drvCheckResult *res, } } =20 - if (l2_dirty) { + if (l2_dirty > 0) { ret =3D qcow2_pre_write_overlap_check(bs, QCOW2_OL_ACTIVE_L2, l2_offset, s->cluster_size= ); if (ret < 0) { @@ -1914,6 +1913,7 @@ static int check_oflag_copied(BlockDriverState *bs, B= drvCheckResult *res, res->check_errors++; goto fail; } + res->corruptions_fixed +=3D l2_dirty; } } =20 --=20 2.18.0