qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 29/38] qcow2: Ignore reserved bits in refcount table


From: Kevin Wolf
Subject: [Qemu-devel] [PATCH 29/38] qcow2: Ignore reserved bits in refcount table entries
Date: Fri, 20 Apr 2012 19:01:35 +0200

Signed-off-by: Kevin Wolf <address@hidden>
---
 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 909d615..e0854dc 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 a22d7fa..291309a 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -175,6 +175,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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]