diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-04-02 12:48:47 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-04-02 12:48:47 +0000 |
commit | 23be50f1afbb8c3db746ecd7735f74eacc89db24 (patch) | |
tree | 6606f81daf9991f5d61573dddc41a259bbcca096 | |
parent | cce1075c767d5804e44e65513625a419296939ee (diff) |
Qcow2: Release refcount table clusters after growing the refcount table,
by Juergen Keil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2586 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | block-qcow2.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block-qcow2.c b/block-qcow2.c index 0f7a06961e..273359c28e 100644 --- a/block-qcow2.c +++ b/block-qcow2.c @@ -1886,6 +1886,8 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size) int64_t table_offset; uint64_t data64; uint32_t data32; + int old_table_size; + int64_t old_table_offset; if (min_size <= s->refcount_table_size) return 0; @@ -1931,11 +1933,14 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size) &data32, sizeof(data32)) != sizeof(data32)) goto fail; qemu_free(s->refcount_table); + old_table_offset = s->refcount_table_offset; + old_table_size = s->refcount_table_size; s->refcount_table = new_table; s->refcount_table_size = new_table_size; s->refcount_table_offset = table_offset; update_refcount(bs, table_offset, new_table_size2, 1); + free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t)); return 0; fail: free_clusters(bs, table_offset, new_table_size2); |