mirror of
https://github.com/qemu/qemu.git
synced 2024-12-02 08:13:34 +08:00
bfe8043e92
Lazy refcounts is a performance optimization for qcow2 that postpones refcount metadata updates and instead marks the image dirty. In the case of crash or power failure the image will be left in a dirty state and repaired next time it is opened. Reducing metadata I/O is important for cache=writethrough and cache=directsync because these modes guarantee that data is on disk after each write (hence we cannot take advantage of caching updates in RAM). Refcount metadata is not needed for guest->file block address translation and therefore does not need to be on-disk at the time of write completion - this is the motivation behind the lazy refcount optimization. The lazy refcount optimization must be enabled at image creation time: qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=on a.qcow2 10G qemu-system-x86_64 -drive if=virtio,file=a.qcow2,cache=writethrough Update qemu-iotests 031 and 036 since the extension header size changes when we add feature bit table entries. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
205 lines
5.4 KiB
Plaintext
205 lines
5.4 KiB
Plaintext
QA output created by 031
|
|
|
|
===== Testing with -o compat=0.10 =====
|
|
|
|
=== Create image with unknown header extension ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
magic 0x514649fb
|
|
version 2
|
|
backing_file_offset 0x0
|
|
backing_file_size 0x0
|
|
cluster_bits 16
|
|
size 67108864
|
|
crypt_method 0
|
|
l1_size 1
|
|
l1_table_offset 0x30000
|
|
refcount_table_offset 0x10000
|
|
refcount_table_clusters 1
|
|
nb_snapshots 0
|
|
snapshot_offset 0x0
|
|
incompatible_features 0x0
|
|
compatible_features 0x0
|
|
autoclear_features 0x0
|
|
refcount_order 4
|
|
header_length 72
|
|
|
|
Header extension:
|
|
magic 0x12345678
|
|
length 31
|
|
data 'This is a test header extension'
|
|
|
|
No errors were found on the image.
|
|
|
|
=== Rewrite header with no backing file ===
|
|
|
|
magic 0x514649fb
|
|
version 2
|
|
backing_file_offset 0x0
|
|
backing_file_size 0x0
|
|
cluster_bits 16
|
|
size 67108864
|
|
crypt_method 0
|
|
l1_size 1
|
|
l1_table_offset 0x30000
|
|
refcount_table_offset 0x10000
|
|
refcount_table_clusters 1
|
|
nb_snapshots 0
|
|
snapshot_offset 0x0
|
|
incompatible_features 0x0
|
|
compatible_features 0x0
|
|
autoclear_features 0x0
|
|
refcount_order 4
|
|
header_length 72
|
|
|
|
Header extension:
|
|
magic 0x6803f857
|
|
length 96
|
|
data <binary>
|
|
|
|
Header extension:
|
|
magic 0x12345678
|
|
length 31
|
|
data 'This is a test header extension'
|
|
|
|
No errors were found on the image.
|
|
|
|
=== Add a backing file and format ===
|
|
|
|
magic 0x514649fb
|
|
version 2
|
|
backing_file_offset 0xf8
|
|
backing_file_size 0x17
|
|
cluster_bits 16
|
|
size 67108864
|
|
crypt_method 0
|
|
l1_size 1
|
|
l1_table_offset 0x30000
|
|
refcount_table_offset 0x10000
|
|
refcount_table_clusters 1
|
|
nb_snapshots 0
|
|
snapshot_offset 0x0
|
|
incompatible_features 0x0
|
|
compatible_features 0x0
|
|
autoclear_features 0x0
|
|
refcount_order 4
|
|
header_length 72
|
|
|
|
Header extension:
|
|
magic 0xe2792aca
|
|
length 11
|
|
data 'host_device'
|
|
|
|
Header extension:
|
|
magic 0x6803f857
|
|
length 96
|
|
data <binary>
|
|
|
|
Header extension:
|
|
magic 0x12345678
|
|
length 31
|
|
data 'This is a test header extension'
|
|
|
|
|
|
===== Testing with -o compat=1.1 =====
|
|
|
|
=== Create image with unknown header extension ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
magic 0x514649fb
|
|
version 3
|
|
backing_file_offset 0x0
|
|
backing_file_size 0x0
|
|
cluster_bits 16
|
|
size 67108864
|
|
crypt_method 0
|
|
l1_size 1
|
|
l1_table_offset 0x30000
|
|
refcount_table_offset 0x10000
|
|
refcount_table_clusters 1
|
|
nb_snapshots 0
|
|
snapshot_offset 0x0
|
|
incompatible_features 0x0
|
|
compatible_features 0x0
|
|
autoclear_features 0x0
|
|
refcount_order 4
|
|
header_length 104
|
|
|
|
Header extension:
|
|
magic 0x12345678
|
|
length 31
|
|
data 'This is a test header extension'
|
|
|
|
No errors were found on the image.
|
|
|
|
=== Rewrite header with no backing file ===
|
|
|
|
magic 0x514649fb
|
|
version 3
|
|
backing_file_offset 0x0
|
|
backing_file_size 0x0
|
|
cluster_bits 16
|
|
size 67108864
|
|
crypt_method 0
|
|
l1_size 1
|
|
l1_table_offset 0x30000
|
|
refcount_table_offset 0x10000
|
|
refcount_table_clusters 1
|
|
nb_snapshots 0
|
|
snapshot_offset 0x0
|
|
incompatible_features 0x0
|
|
compatible_features 0x0
|
|
autoclear_features 0x0
|
|
refcount_order 4
|
|
header_length 104
|
|
|
|
Header extension:
|
|
magic 0x6803f857
|
|
length 96
|
|
data <binary>
|
|
|
|
Header extension:
|
|
magic 0x12345678
|
|
length 31
|
|
data 'This is a test header extension'
|
|
|
|
No errors were found on the image.
|
|
|
|
=== Add a backing file and format ===
|
|
|
|
magic 0x514649fb
|
|
version 3
|
|
backing_file_offset 0x118
|
|
backing_file_size 0x17
|
|
cluster_bits 16
|
|
size 67108864
|
|
crypt_method 0
|
|
l1_size 1
|
|
l1_table_offset 0x30000
|
|
refcount_table_offset 0x10000
|
|
refcount_table_clusters 1
|
|
nb_snapshots 0
|
|
snapshot_offset 0x0
|
|
incompatible_features 0x0
|
|
compatible_features 0x0
|
|
autoclear_features 0x0
|
|
refcount_order 4
|
|
header_length 104
|
|
|
|
Header extension:
|
|
magic 0xe2792aca
|
|
length 11
|
|
data 'host_device'
|
|
|
|
Header extension:
|
|
magic 0x6803f857
|
|
length 96
|
|
data <binary>
|
|
|
|
Header extension:
|
|
magic 0x12345678
|
|
length 31
|
|
data 'This is a test header extension'
|
|
|
|
*** done
|