From 93913dfd8acbaddc8ef3716cd7b8a2830c99cb19 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 19 Jul 2011 13:01:48 +0200 Subject: qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm In snapshotting there is no guest involved, so we can safely use a writeback mode and do the flushes in the right place (i.e. at the very end). This improves the time that creating/restoring an internal snapshot takes with an image in writethrough mode. Signed-off-by: Kevin Wolf --- block/qcow2-cache.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'block/qcow2-cache.c') diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 382473933c..84088477a4 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -312,3 +312,15 @@ found: c->entries[i].dirty = true; } +bool qcow2_cache_set_writethrough(BlockDriverState *bs, Qcow2Cache *c, + bool enable) +{ + bool old = c->writethrough; + + if (!old && enable) { + qcow2_cache_flush(bs, c); + } + + c->writethrough = enable; + return old; +} -- cgit v1.2.1