diff options
author | Max Reitz <mreitz@redhat.com> | 2013-10-09 10:44:28 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-10-11 16:49:59 +0200 |
commit | 8f730dd24edd2576ecbd596de7ea4361296b129c (patch) | |
tree | a82884d03377a86f789449b757377a64fc6bbeb5 /block/qcow2-refcount.c | |
parent | 998b959c1e59044f5d5f64c482f4ce8facc8e0bc (diff) | |
download | qemu-8f730dd24edd2576ecbd596de7ea4361296b129c.zip |
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.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 4cb9c2332a..4ef689996f 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(); |