From nobody Fri May 3 22:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) 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; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1523376868212125.15645805736358; Tue, 10 Apr 2018 09:14:28 -0700 (PDT) Received: from localhost ([::1]:54522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5vuZ-0002zv-Gr for importer@patchew.org; Tue, 10 Apr 2018 12:14:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5vmZ-0002Tn-4V for qemu-devel@nongnu.org; Tue, 10 Apr 2018 12:06:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5vmV-0003vT-01 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 12:06:07 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:45122) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5vmU-0003aN-Ji; Tue, 10 Apr 2018 12:06:02 -0400 Received: from 248.red-83-39-130.dynamicip.rima-tde.net ([83.39.130.248] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1f5vlx-00063Y-Na; Tue, 10 Apr 2018 18:05:29 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1f5vlf-0003Oy-U5; Tue, 10 Apr 2018 19:05:11 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=4COWwzT4E/T9msrvJ/X/95Io38YZFGrKCUgrWW7d9+Y=; b=rrp3AhwsI7QRM0xJxbe3evU/A2pBRgeyrUJjMKOJs71QGJCjHey9eSTt/hRSazGVRiwKhftlwzQ+yfS7r/6mFEdQietdy85B0OrFG+jUTv17KSx5xEBgObNDf5zq+G6sSNVa4iG0qCK8lvkbOiLXavXexTVfR7JWclxJTat8fOGI+f/uGnbBNR5UxLtQ/jFkePQYpQYi5CZiFFGxTMrzQQybkozvT6/mpFpud5uldER4KoQLKOBdQbmbD7eGxAoAXup6xHWmtiDUBeHmUQD9XEqrYtVUPsA5DauwpDd63XZOOfIbsGuSkm58Cxs/wY4aE5Lw0tv5qJ3ivNSNfnkaww==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 18:05:03 +0200 Message-Id: <0f687957feb72e80c740403191a47e607c2463fe.1523376013.git.berto@igalia.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 1/2] Fix error message about compressed clusters with 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: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Compressed clusters are not supposed to have the COPIED bit set. "qemu-img check" detects that and prints an error message reporting the number of the affected host cluster. This doesn't make much sense because compressed clusters are not aligned to host clusters, so it would be better to report the offset instead. Plus, the calculation is wrong and it uses the raw L2 entry as if it was simply an offset. This patch fixes the error message and reports the offset of the compressed cluster. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake --- block/qcow2-refcount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 6b8b63514a..2dc23005b7 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -1577,9 +1577,9 @@ static int check_refcounts_l2(BlockDriverState *bs, B= drvCheckResult *res, case QCOW2_CLUSTER_COMPRESSED: /* Compressed clusters don't have QCOW_OFLAG_COPIED */ if (l2_entry & QCOW_OFLAG_COPIED) { - fprintf(stderr, "ERROR: cluster %" PRId64 ": " + fprintf(stderr, "ERROR: coffset=3D0x%" PRIx64 ": " "copied flag must never be set for compressed " - "clusters\n", l2_entry >> s->cluster_bits); + "clusters\n", l2_entry & s->cluster_offset_mask); l2_entry &=3D ~QCOW_OFLAG_COPIED; res->corruptions++; } --=20 2.11.0 From nobody Fri May 3 22:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) 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; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1523376979846273.19850080604454; Tue, 10 Apr 2018 09:16:19 -0700 (PDT) Received: from localhost ([::1]:54744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5vwR-00050n-3e for importer@patchew.org; Tue, 10 Apr 2018 12:16:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5vmZ-0002Tm-49 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 12:06:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5vmU-0003vM-Vg for qemu-devel@nongnu.org; Tue, 10 Apr 2018 12:06:07 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:45114) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5vmU-0003Ya-Jw; Tue, 10 Apr 2018 12:06:02 -0400 Received: from 248.red-83-39-130.dynamicip.rima-tde.net ([83.39.130.248] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1f5vls-00062I-VM; Tue, 10 Apr 2018 18:05:25 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1f5vlf-0003P0-VA; Tue, 10 Apr 2018 19:05:11 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=4z/o3AtHl6erk4Ovf5IAXltx/j9UWAjteYylWZRrEcc=; b=PKM+VDH+ab6aShobKyJ3c3FuOqzeCNk78cu2u08++n9pJBAZENeFNZfX8eGgjM3PPq0f1NP8ho2yKA7Q4lbIRff5lVCBegY7Xv8yiy4p0qnNsQ0L5h9zvGfa4tbQb2lJpwUcMkhzyIK6/l1dBIWH5kFYAE2Re46yBfH7NDFj29Y5EBag+SA0NNs1u2Fl1YuQlsHIba4gt+INC1A5rZSJhGZyWT1s8dPdcgRhCa5hbNstcbRnWNa742F+cpxsc0hyfe9qb351ISl03euZPCgCHo/ouO/5vU/Ff5Ks/e3LfsnrvWOKNnFUpXvj3+APBV/HHy4JZl+5M3itxMiVV5Qq/A==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 18:05:04 +0200 Message-Id: <74552e1d6e858d3159cb0c0e188e80bc9248e337.1523376013.git.berto@igalia.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 2/2] specs/qcow2: Clarify that compressed clusters have the COPIED bit reset 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 , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Compressed clusters are not supposed to have the COPIED bit set, but this is not made explicit in the specs, so let's document it. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake --- docs/interop/qcow2.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt index feb711fb6a..8e1547ded2 100644 --- a/docs/interop/qcow2.txt +++ b/docs/interop/qcow2.txt @@ -400,10 +400,10 @@ L2 table entry: 62: 0 for standard clusters 1 for compressed clusters =20 - 63: 0 for a cluster that is unused or requires COW, 1 if i= ts - refcount is exactly one. This information is only accu= rate - in L2 tables that are reachable from the active L1 - table. + 63: 0 for clusters that are unused, compressed or require = COW. + 1 for standard clusters whose refcount is exactly one. + This information is only accurate in L2 tables + that are reachable from the active L1 table. =20 Standard Cluster Descriptor: =20 --=20 2.11.0