ia64/xen-unstable

changeset 17342:892a20f824a7

ioemu: Two qcow2 bug fixes from upstream qemu.

[Qemu-devel] PATCH: qcow2 image corruption
http://lists.gnu.org/archive/html/qemu-devel/2007-03/msg00773.html

[Qemu-devel] [PATCH] qcow2: release refcount table clusters of the old
table, after growing the refcount table
http://lists.gnu.org/archive/html/qemu-devel/2007-04/msg00043.html

Signed-off-by: Kevin Wolf <kwolf@suse.de>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Mar 27 17:14:41 2008 +0000 (2008-03-27)
parents 17e30b91b9e2
children e7abfeee2808
files tools/ioemu/block-qcow2.c
line diff
     1.1 --- a/tools/ioemu/block-qcow2.c	Thu Mar 27 17:13:37 2008 +0000
     1.2 +++ b/tools/ioemu/block-qcow2.c	Thu Mar 27 17:14:41 2008 +0000
     1.3 @@ -1886,6 +1886,8 @@ static int grow_refcount_table(BlockDriv
     1.4      int64_t table_offset;
     1.5      uint64_t data64;
     1.6      uint32_t data32;
     1.7 +    int old_table_size;
     1.8 +    int64_t old_table_offset;
     1.9  
    1.10      if (min_size <= s->refcount_table_size)
    1.11          return 0;
    1.12 @@ -1931,10 +1933,14 @@ static int grow_refcount_table(BlockDriv
    1.13                      &data32, sizeof(data32)) != sizeof(data32))
    1.14          goto fail;
    1.15      qemu_free(s->refcount_table);
    1.16 +    old_table_offset = s->refcount_table_offset;
    1.17 +    old_table_size = s->refcount_table_size;
    1.18      s->refcount_table = new_table;
    1.19      s->refcount_table_size = new_table_size;
    1.20 +    s->refcount_table_offset = table_offset;
    1.21  
    1.22      update_refcount(bs, table_offset, new_table_size2, 1);
    1.23 +    free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t));
    1.24      return 0;
    1.25   fail:
    1.26      free_clusters(bs, table_offset, new_table_size2);