From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCXsc-0001Ec-GL for qemu-devel@nongnu.org; Tue, 27 Mar 2012 11:00:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCXsa-0007HH-P1 for qemu-devel@nongnu.org; Tue, 27 Mar 2012 11:00:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCXsa-0007H1-Gz for qemu-devel@nongnu.org; Tue, 27 Mar 2012 11:00:12 -0400 From: Kevin Wolf Date: Tue, 27 Mar 2012 17:03:27 +0200 Message-Id: <1332860615-3047-9-git-send-email-kwolf@redhat.com> In-Reply-To: <1332860615-3047-1-git-send-email-kwolf@redhat.com> References: <1332860615-3047-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [RFC PATCH 08/16] qcow2: Ignore reserved bits in refcount table entries List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com Signed-off-by: Kevin Wolf --- block/qcow2-refcount.c | 2 +- block/qcow2.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 2ec3aa7..50bf44e 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -167,7 +167,7 @@ static int alloc_refcount_block(BlockDriverState *bs, if (refcount_table_index < s->refcount_table_size) { uint64_t refcount_block_offset = - s->refcount_table[refcount_table_index]; + s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; /* If it's already there, we're done */ if (refcount_block_offset) { diff --git a/block/qcow2.h b/block/qcow2.h index bad5448..102578e 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -174,6 +174,8 @@ enum { #define L2E_OFFSET_MASK 0x00ffffffffffff00ULL #define L2E_COMPRESSED_OFFSET_SIZE_MASK 0x3fffffffffffffffULL +#define REFT_OFFSET_MASK 0xffffffffffffff00ULL + static inline int size_to_clusters(BDRVQcowState *s, int64_t size) { return (size + (s->cluster_size - 1)) >> s->cluster_bits; -- 1.7.6.5