summaryrefslogtreecommitdiff
path: root/block/qcow2-cache.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2011-07-19 13:01:48 +0200
committerKevin Wolf <kwolf@redhat.com>2011-07-19 15:39:22 +0200
commit93913dfd8acbaddc8ef3716cd7b8a2830c99cb19 (patch)
tree4bec586c8b3b30c6ab432fe1237070cfa9a93428 /block/qcow2-cache.c
parent4a1d5e1fded54358ddc4d8cbd53388ca7c93499b (diff)
downloadqemu-93913dfd8acbaddc8ef3716cd7b8a2830c99cb19.tar.gz
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 <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2-cache.c')
-rw-r--r--block/qcow2-cache.c12
1 files changed, 12 insertions, 0 deletions
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;
+}