From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55382 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHPPZ-0003F3-66 for qemu-devel@nongnu.org; Wed, 26 May 2010 18:49:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHPPX-0002nC-ME for qemu-devel@nongnu.org; Wed, 26 May 2010 18:49:17 -0400 Received: from hall.aurel32.net ([88.191.82.174]:39843) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHPPX-0002m8-HL for qemu-devel@nongnu.org; Wed, 26 May 2010 18:49:15 -0400 Date: Thu, 27 May 2010 00:08:32 +0200 From: Aurelien Jarno Message-ID: <20100526220832.GO1402@hall.aurel32.net> References: <1274900672-4859-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1274900672-4859-1-git-send-email-agraf@suse.de> Sender: Aurelien Jarno Subject: [Qemu-devel] Re: [PATCH] Make cache=unsafe the default for -snapshot List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: kwolf@redhat.com, hch@lst.de, qemu-devel@nongnu.org, avi@redhat.com On Wed, May 26, 2010 at 09:04:32PM +0200, Alexander Graf wrote: > 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 Thanks, applied. > --- > 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 > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net