aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-05-26 17:51:49 +0200
committerAurelien Jarno <aurelien@aurel32.net>2010-05-26 20:05:14 +0200
commit016f5cf6ff465411733878a17c8f8febb7668321 (patch)
treecc50fdca4d1b3742bc655cefaeef5795fe730e62 /vl.c
parentd467b679f2993cb07fcc8112bfee6f6e8a40d093 (diff)
Add cache=unsafe parameter to -drive
Usually the guest can tell the host to flush data to disk. In some cases we don't want to flush though, but try to keep everything in cache. So let's add a new cache value to -drive that allows us to set the cache policy to most aggressive, disabling flushes. We call this mode "unsafe", as guest data is not guaranteed to survive host crashes anymore. This patch also adds a noop function for aio, so we can do nothing in AIO fashion. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index 328395e3dd..bc15dd74af 100644
--- a/vl.c
+++ b/vl.c
@@ -913,6 +913,9 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
bdrv_flags |= BDRV_O_NOCACHE;
} else if (!strcmp(buf, "writeback")) {
bdrv_flags |= BDRV_O_CACHE_WB;
+ } else if (!strcmp(buf, "unsafe")) {
+ bdrv_flags |= BDRV_O_CACHE_WB;
+ bdrv_flags |= BDRV_O_NO_FLUSH;
} else if (!strcmp(buf, "writethrough")) {
/* this is the default */
} else {