Merge qcow2 fixes from qemu-devel (cvs):

- Qcow2 corruption fix, by Juergen Keil.
- Qcow2: Release refcount table clusters after growing the refcount table,
  by Juergen Keil.
This commit is contained in:
Juergen Lock 2007-05-26 16:08:17 +00:00
parent 6c1654e729
commit 7cd4402a2b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=191912
2 changed files with 26 additions and 1 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= qemu
PORTVERSION= 0.9.0
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= emulators
MASTER_SITES= http://qemu.org/:release \
http://qemu-forum.ipi.fi/qemu-snapshots/:snapshot \

View File

@ -0,0 +1,25 @@
Index: qemu/block-qcow2.c
@@ -1886,6 +1886,8 @@
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,10 +1933,14 @@
&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);