qcow2: Discard VM state in active L1 after creating snapshot
commit1ebf561c11302f4fbe4afdd82758fe053cf1d5fc
authorKevin Wolf <kwolf@redhat.com>
Fri, 6 Sep 2013 10:20:08 +0000 (6 12:20 +0200)
committerKevin Wolf <kwolf@redhat.com>
Thu, 12 Sep 2013 08:12:46 +0000 (12 10:12 +0200)
tree97ddd797d3feefe5751a858b3b2df42efbd3dea1
parent670df5e3b4b5ef830a7c3c970170dbfa11cbb8d2
qcow2: Discard VM state in active L1 after creating snapshot

During savevm, the VM state is written to the active L1 of the image and
then a snapshot is taken. After that, the VM state isn't needed any more
in the active L1 and should be discarded. This is implemented by this
patch.

The impact of not discarding the VM state is that a snapshot can never
become smaller than any previous snapshot (because it would be padded
with old VM state), and more importantly that future savevm operations
cause unnecessary COWs (with associated flushes), which makes subsequent
snapshots much slower.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
block/qcow2-snapshot.c
block/qcow2.c
block/qcow2.h