From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDzmz-0007hZ-6I for qemu-devel@nongnu.org; Wed, 12 Oct 2011 10:28:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDzmy-0006JI-40 for qemu-devel@nongnu.org; Wed, 12 Oct 2011 10:28:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDzmx-0006IQ-Ka for qemu-devel@nongnu.org; Wed, 12 Oct 2011 10:28:08 -0400 Message-ID: <4E95A495.3050403@redhat.com> Date: Wed, 12 Oct 2011 16:30:45 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <20111011031046.9587.44474.sendpatchset@skannery.in.ibm.com> <20111011031145.9587.93507.sendpatchset@skannery.in.ibm.com> In-Reply-To: <20111011031145.9587.93507.sendpatchset@skannery.in.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [v7 Patch 4/5]Qemu: Add commandline -drive option 'hostcache' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Supriya Kannery Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Christoph Hellwig Am 11.10.2011 05:11, schrieb Supriya Kannery: > qemu command option 'hostcache' added to -drive for block devices. > While starting a VM from qemu commandline, this option can be used > for setting host cache usage for block data access. Simultaneous > use of 'hostcache' and 'cache' options not allowed. > > Signed-off-by: Supriya Kannery I'm not sure if introducing this alone makes sense. I think I would only do it when we introduce more options that allow replacing all cache=... options by other parameters. > > --- > blockdev.c | 13 +++++++++++++ > qemu-config.c | 4 ++++ > qemu-options.hx | 2 +- > 3 files changed, 18 insertions(+), 1 deletion(-) > > Index: qemu/blockdev.c > =================================================================== > --- qemu.orig/blockdev.c > +++ qemu/blockdev.c > @@ -237,6 +237,7 @@ DriveInfo *drive_init(QemuOpts *opts, in > DriveInfo *dinfo; > int snapshot = 0; > int ret; > + int hostcache = 0; > > translation = BIOS_ATA_TRANSLATION_AUTO; > media = MEDIA_DISK; > @@ -319,7 +320,19 @@ DriveInfo *drive_init(QemuOpts *opts, in > } > } > > + if ((hostcache = qemu_opt_get_bool(opts, "hostcache", -1)) != -1) { > + if (!hostcache) { > + bdrv_flags |= BDRV_O_NOCACHE; > + } else { > + bdrv_flags &= ~BDRV_O_NOCACHE; > + } bdrv_flags is initialised to 0, so the else branch is unnecessary. Kevin