From 1ebf561c11302f4fbe4afdd82758fe053cf1d5fc Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 6 Sep 2013 12:20:08 +0200 Subject: 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 Reviewed-by: Max Reitz --- block/qcow2.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'block/qcow2.c') diff --git a/block/qcow2.c b/block/qcow2.c index 147822e8fd..c9e266e22e 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1757,11 +1757,6 @@ static coroutine_fn int qcow2_co_flush_to_os(BlockDriverState *bs) return 0; } -static int64_t qcow2_vm_state_offset(BDRVQcowState *s) -{ - return (int64_t)s->l1_vm_state_index << (s->cluster_bits + s->l2_bits); -} - static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { BDRVQcowState *s = bs->opaque; -- cgit v1.2.1