]> git.proxmox.com Git - qemu.git/commitdiff
Make cache=unsafe the default for -snapshot
authorAlexander Graf <agraf@suse.de>
Wed, 26 May 2010 19:04:32 +0000 (21:04 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Wed, 26 May 2010 22:08:09 +0000 (00:08 +0200)
When using -snapshot we don't care about data integrity of the cow file
at all, so let's disable flushing there and squeeze out the last drop
of performance we could possibly get.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
qemu-options.hx
vl.c

index cea9b72b2a30d1fb3a86b94b0e5085f3bb9745c8..a6928b7aa3bbe759465d6dde2998fb41c1f4eade 100644 (file)
@@ -170,8 +170,7 @@ the storage subsystem.
 Writeback caching will report data writes as completed as soon as the data is
 present in the host page cache.  This is safe as long as you trust your host.
 If your host crashes or loses power, then the guest may experience data
-corruption.  When using the @option{-snapshot} option, writeback caching is
-used by default.
+corruption.
 
 The host page cache can be avoided entirely with @option{cache=none}.  This will
 attempt to do disk IO directly to the guests memory.  QEMU may still perform
@@ -185,7 +184,8 @@ In case you don't care about data integrity over host failures, use
 cache=unsafe. This option tells qemu that it never needs to write any data
 to the disk but can instead keeps things in cache. If anything goes wrong,
 like your host losing power, the disk storage getting disconnected accidently,
-etc. you're image will most probably be rendered unusable.
+etc. you're image will most probably be rendered unusable.   When using
+the @option{-snapshot} option, unsafe caching is always used.
 
 Instead of @option{-cdrom} you can use:
 @example
diff --git a/vl.c b/vl.c
index bc15dd74af93dfadece6289170e3a7b0e06e768b..417554fc64359196168f07a6029699b11d49ddf3 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -1105,9 +1105,9 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
         return NULL;
     }
     if (snapshot) {
-        /* always use write-back with snapshot */
+        /* always use cache=unsafe with snapshot */
         bdrv_flags &= ~BDRV_O_CACHE_MASK;
-        bdrv_flags |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB);
+        bdrv_flags |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH);
     }
 
     if (media == MEDIA_CDROM) {