From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNTzL-0005dW-Ai for qemu-devel@nongnu.org; Fri, 29 Aug 2014 17:45:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNTzF-0001Uw-5i for qemu-devel@nongnu.org; Fri, 29 Aug 2014 17:45:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNTzE-0001Un-VD for qemu-devel@nongnu.org; Fri, 29 Aug 2014 17:45:37 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7TLjadW006622 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 29 Aug 2014 17:45:36 -0400 From: Max Reitz Date: Fri, 29 Aug 2014 23:45:27 +0200 Message-Id: <1409348727-17183-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1409348727-17183-1-git-send-email-mreitz@redhat.com> References: <1409348727-17183-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] docs/qcow2: Correct refcount_block_entries List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , 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 --- 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..531c478 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 / (refcount_bits / 8)) refcount_block_index = (offset / cluster_size) % refcount_block_entries refcount_table_index = (offset / cluster_size) / refcount_block_entries -- 2.1.0