qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, hch@lst.de, aurelien@aurel32.net, avi@redhat.com
Subject: [Qemu-devel] [PATCH] Make cache=unsafe the default for -snapshot
Date: Wed, 26 May 2010 21:04:32 +0200	[thread overview]
Message-ID: <1274900672-4859-1-git-send-email-agraf@suse.de> (raw)

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>
---
 qemu-options.hx |    6 +++---
 vl.c            |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index b389f36..6db6d91 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -165,8 +165,7 @@ Specify the controller's PCI address (if=virtio only).
 By default, writeback caching is used for all block devices. It 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 always used.
+or loses power, then the guest may experience data corruption.
 
 Writethrough caching means that the host page cache will be used to read
 and write data but write notification will be sent to the guest only when
@@ -184,7 +183,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 a70e487..21bd808 100644
--- a/vl.c
+++ b/vl.c
@@ -1108,9 +1108,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) {
-- 
1.6.0.2

             reply	other threads:[~2010-05-26 19:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26 19:04 Alexander Graf [this message]
2010-05-26 22:08 ` [Qemu-devel] Re: [PATCH] Make cache=unsafe the default for -snapshot Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1274900672-4859-1-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=avi@redhat.com \
    --cc=hch@lst.de \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).