aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2-refcount.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2013-10-09 10:44:28 +0200
committerKevin Wolf <kwolf@redhat.com>2013-10-11 16:49:59 +0200
commit8f730dd24edd2576ecbd596de7ea4361296b129c (patch)
treea82884d03377a86f789449b757377a64fc6bbeb5 /block/qcow2-refcount.c
parent998b959c1e59044f5d5f64c482f4ce8facc8e0bc (diff)
downloadqemu-8f730dd24edd2576ecbd596de7ea4361296b129c.zip
qemu-8f730dd24edd2576ecbd596de7ea4361296b129c.tar.gz
qemu-8f730dd24edd2576ecbd596de7ea4361296b129c.tar.bz2
qcow2: Free preallocated zero clusters
In qcow2_free_any_clusters, preallocated zero clusters should be freed just as normal clusters are. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2-refcount.c')
-rw-r--r--block/qcow2-refcount.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 4cb9c23..4ef6899 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -796,11 +796,13 @@ void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry,
}
break;
case QCOW2_CLUSTER_NORMAL:
- qcow2_free_clusters(bs, l2_entry & L2E_OFFSET_MASK,
- nb_clusters << s->cluster_bits, type);
+ case QCOW2_CLUSTER_ZERO:
+ if (l2_entry & L2E_OFFSET_MASK) {
+ qcow2_free_clusters(bs, l2_entry & L2E_OFFSET_MASK,
+ nb_clusters << s->cluster_bits, type);
+ }
break;
case QCOW2_CLUSTER_UNALLOCATED:
- case QCOW2_CLUSTER_ZERO:
break;
default:
abort();