From patchwork Mon Feb 29 15:11:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 8455031 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 27DD09F52D for ; Mon, 29 Feb 2016 15:12:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 852A62024C for ; Mon, 29 Feb 2016 15:12:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA25E2021A for ; Mon, 29 Feb 2016 15:12:15 +0000 (UTC) Received: from localhost ([::1]:37166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaPUc-0006Xg-T6 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Feb 2016 10:12:14 -0500 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 Received: from resomta-po-05v.sys.comcast.net ([96.114.154.229]) by resqmta-po-12v.sys.comcast.net with comcast id QFBW1s0054xDoy801FBzWK; Mon, 29 Feb 2016 15:11:59 +0000 Received: from red.redhat.com ([24.10.254.122]) by resomta-po-05v.sys.comcast.net with comcast id QFBw1s00L2fD5rL01FBzDt; Mon, 29 Feb 2016 15:11:59 +0000 From: Eric Blake To: qemu-devel@nongnu.org Date: Mon, 29 Feb 2016 08:11:54 -0700 Message-Id: <1456758714-12609-1-git-send-email-eblake@redhat.com> X-Mailer: git-send-email 2.5.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1456758719; bh=5Za9GKSUjFhFayHPDJcOTgx5gDQX0ffpSvF7I5o77/w=; h=Received:Received:From:To:Subject:Date:Message-Id; b=HeHfx0v88CQ0V2/etuqOiL4kVp1cwCQ3AoUC8ojjHAbBYj74pOcAntYFADPCZTYiG /TWqT0qm20qz4FFXblK1ifIPu2M0SPHW8+TUWF990Kswxise7Q4Qx0JSntWwNrma7U xtOGOWDeOp14htpt6Sv5vIQq3lFzdMlps576Mu636f2+l5YO5ZJJD+zmoTh5EF7tmG X56QrNrfRCsiadaoB5EDriabpomdh3eOVlC3CfOo5mOY2Aly8y/C8dYokgqiLv1X1j 7Tf/iDnY1+eH5eX7RHyZczLaLvFQt1hP3y7CHRtfH/xKLFTfY1TrElJzjeco+xBTlI OOH4s12P3tRSQ== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 96.114.154.171 Cc: mgreger@cinci.rr.com, qemu-block@nongnu.org Subject: [Qemu-devel] [PATCH] qcow2: Clarify that compressed cluster offset requires shift X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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