From nobody Fri Oct 24 09:58:53 2025 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519136242039484.3717214031917; Tue, 20 Feb 2018 06:17:22 -0800 (PST) Received: from localhost ([::1]:55801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eo8jI-0002WR-PV for importer@patchew.org; Tue, 20 Feb 2018 09:17:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eo8iB-0002Ap-On for qemu-devel@nongnu.org; Tue, 20 Feb 2018 09:16:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eo8i6-0005Cr-57 for qemu-devel@nongnu.org; Tue, 20 Feb 2018 09:16:03 -0500 Received: from fanzine.igalia.com ([91.117.99.155]:52005) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eo8i5-00059k-Oz; Tue, 20 Feb 2018 09:15:58 -0500 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1eo8i3-0003YF-4T; Tue, 20 Feb 2018 15:15:55 +0100 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1eo8hn-00034b-B6; Tue, 20 Feb 2018 16:15:39 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Message-Id:Date:Subject:Cc:To:From; bh=Ee6XUtVLr8J04uAstFgVjLaENuEJ/23arMpzw1OPRIk=; b=kA//RXOVXXS1sp0kNU0Yb1rcDdyllabSac0JDUNenbcKb9yH/WUrPhgTJNFcmHXbn8ZE/FYxby9d8M3+Hm4QDWlza03VfwhsaFowyPvJr6F9jR9BZKQqqlzg7urRJ1wcrVjHUk7yTVfJ5DYfMr8/R0AKrGN5eEca/YIAwHMd2QTgIm68h1oLLBlieJclhmQPxgjjeODSJZjCHd4rPVwX+cTGVbJwtRuP891Yhp6VFnwqJIe2iYvvTwinbAUEdr/tF+7oZGSiMhB5KL5/BIU8HzmppeL6R4yu/zi+oSFhfA+lnJY9aWG4NOsf8Fiqe91Wj+KFuwe8PA61cGmDORs0WA==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Tue, 20 Feb 2018 16:15:31 +0200 Message-Id: <20180220141531.11770-1-berto@igalia.com> X-Mailer: git-send-email 2.11.0 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] specs/qcow2: Fix documentation of the compressed cluster descriptor 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" The documentation claims that the cluster descriptor contains the number of sectors used to store the compressed data, but what it actually contains is the number of sectors *minus one*. That can be easily seen in qcow2_decompress_cluster(), that adds one to the value stored in that field: nb_csectors =3D ((cluster_offset >> s->csize_shift) & s->csize_mask) + 1; Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake --- docs/interop/qcow2.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt index d7fdb1fee3..b12972be82 100644 --- a/docs/interop/qcow2.txt +++ b/docs/interop/qcow2.txt @@ -429,7 +429,8 @@ Compressed Clusters Descriptor (x =3D 62 - (cluster_bit= s - 8)): Bit 0 - x: Host cluster offset. This is usually _not_ aligned to a cluster boundary! =20 - x+1 - 61: Compressed size of the images in sectors of 512 bytes + x+1 - 61: Size of the compressed data in sectors of 512 bytes, + minus one (that is, a value of n here means n+1 sector= s). =20 If a cluster is unallocated, read requests shall read the data from the ba= cking file (except if bit 0 in the Standard Cluster Descriptor is set). If there= is --=20 2.11.0