aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2-refcount.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2012-03-16 15:02:38 +0100
committerKevin Wolf <kwolf@redhat.com>2012-04-20 15:57:29 +0200
commit6377af48b0445e7ee50db6e0bd73a3a70098f5f4 (patch)
treee3b5171b5645490af6a392662790d7de88247a69 /block/qcow2-refcount.c
parent6744cbab8cd63b7ce72b3eee4f0055007acf0798 (diff)
qcow2: Support reading zero clusters
This adds support for reading zero clusters in version 3 images. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2-refcount.c')
-rw-r--r--block/qcow2-refcount.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 0112cc37b0..812c93c5c7 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -703,6 +703,7 @@ void qcow2_free_any_clusters(BlockDriverState *bs,
nb_clusters << s->cluster_bits);
break;
case QCOW2_CLUSTER_UNALLOCATED:
+ case QCOW2_CLUSTER_ZERO:
break;
default:
abort();
@@ -973,6 +974,12 @@ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res,
l2_entry & ~511, nb_csectors * 512);
break;
+ case QCOW2_CLUSTER_ZERO:
+ if ((l2_entry & L2E_OFFSET_MASK) == 0) {
+ break;
+ }
+ /* fall through */
+
case QCOW2_CLUSTER_NORMAL:
{
/* QCOW_OFLAG_COPIED must be set iff refcount == 1 */