]> git.proxmox.com Git - mirror_qemu.git/commit - block/qcow2.c
qcow2: implement lazy refcounts
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Fri, 27 Jul 2012 08:05:22 +0000 (09:05 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 6 Aug 2012 20:39:14 +0000 (22:39 +0200)
commitbfe8043e9214d2fc6572cc72b5f2218308747acd
tree40d56873d87524c6b4b062f43851e44ededcae9c
parent91cf8a35e777cdbdc3bf0d39c319ac9f76b7a296
qcow2: implement lazy refcounts

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>
block/qcow2-cluster.c
block/qcow2.c
block/qcow2.h
block_int.h
tests/qemu-iotests/031.out
tests/qemu-iotests/036.out