From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaPUW-0006XR-4Y for qemu-devel@nongnu.org; Mon, 29 Feb 2016 10:12:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaPUR-0006Yq-4n for qemu-devel@nongnu.org; Mon, 29 Feb 2016 10:12:08 -0500 Received: from resqmta-po-12v.sys.comcast.net ([96.114.154.171]:40017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaPUR-0006YO-09 for qemu-devel@nongnu.org; Mon, 29 Feb 2016 10:12:03 -0500 From: Eric Blake Date: Mon, 29 Feb 2016 08:11:54 -0700 Message-Id: <1456758714-12609-1-git-send-email-eblake@redhat.com> Subject: [Qemu-devel] [PATCH] qcow2: Clarify that compressed cluster offset requires shift List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mgreger@cinci.rr.com, qemu-block@nongnu.org The specs for the host cluster offset of a compressed cluster were not clear that the offset is in terms of sectors, and requires a shift by 9 to be a byte offset. Add some more text to make the interpretation obvious. CC: mgreger@cinci.rr.com Signed-off-by: Eric Blake --- docs/specs/qcow2.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/specs/qcow2.txt b/docs/specs/qcow2.txt index 80cdfd0..7049415 100644 --- a/docs/specs/qcow2.txt +++ b/docs/specs/qcow2.txt @@ -323,11 +323,16 @@ Standard Cluster Descriptor: Compressed Clusters Descriptor (x = 62 - (cluster_bits - 8)): - Bit 0 - x: Host cluster offset. This is usually _not_ aligned to a - cluster boundary! + Bit 0 - x: Bits 9-(x+9) of host cluster offset. This is + usually _not_ aligned to a cluster boundary! x+1 - 61: Compressed size of the images in sectors of 512 bytes +The bits of the host cluster offset not specified in the cluster descriptor +are 0 (bits 0-8 are obvious because a 512-byte sector is the smallest +addressable unit, while bits 56-63 implies that a qcow2 file cannot exceed +2^56 bytes in size). + If a cluster is unallocated, read requests shall read the data from the backing file (except if bit 0 in the Standard Cluster Descriptor is set). If there is no backing file or the backing file is smaller than the image, they shall read -- 2.5.0