From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhPEB-0006Qj-8R for qemu-devel@nongnu.org; Thu, 23 Oct 2014 16:43:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XhPE5-0002Zp-3r for qemu-devel@nongnu.org; Thu, 23 Oct 2014 16:43:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhPE4-0002ZS-Pu for qemu-devel@nongnu.org; Thu, 23 Oct 2014 16:43:16 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9NKhFgv009681 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 23 Oct 2014 16:43:16 -0400 From: Kevin Wolf Date: Thu, 23 Oct 2014 22:42:31 +0200 Message-Id: <1414096959-14682-25-git-send-email-kwolf@redhat.com> In-Reply-To: <1414096959-14682-1-git-send-email-kwolf@redhat.com> References: <1414096959-14682-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 24/32] docs/qcow2: Correct refcount_block_entries List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Max Reitz A refblock entry may have a different size than 16 bits, it may even be smaller than a byte. Correct the refcount_block_entries calculation accordingly. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- docs/specs/qcow2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/specs/qcow2.txt b/docs/specs/qcow2.txt index cfbc8b0..0a878aa 100644 --- a/docs/specs/qcow2.txt +++ b/docs/specs/qcow2.txt @@ -183,7 +183,7 @@ blocks and are exactly one cluster in size. Given a offset into the image file, the refcount of its cluster can be obtained as follows: - refcount_block_entries = (cluster_size / sizeof(uint16_t)) + refcount_block_entries = (cluster_size * 8 / refcount_bits) refcount_block_index = (offset / cluster_size) % refcount_block_entries refcount_table_index = (offset / cluster_size) / refcount_block_entries -- 1.8.3.1