From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjRBt-0007hw-CB for qemu-devel@nongnu.org; Wed, 20 Jul 2011 03:27:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjRBq-0006WO-Gy for qemu-devel@nongnu.org; Wed, 20 Jul 2011 03:27:32 -0400 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:37846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjRBp-0006WG-PO for qemu-devel@nongnu.org; Wed, 20 Jul 2011 03:27:30 -0400 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp06.au.ibm.com (8.14.4/8.13.1) with ESMTP id p6K7Qh07017691 for ; Wed, 20 Jul 2011 17:26:43 +1000 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6K7RSJ81372272 for ; Wed, 20 Jul 2011 17:27:28 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6K7RRME028846 for ; Wed, 20 Jul 2011 17:27:28 +1000 Message-ID: <4E26861E.4040904@in.ibm.com> Date: Wed, 20 Jul 2011 13:09:10 +0530 From: Supriya Kannery MIME-Version: 1.0 References: <20110704104237.28170.97021.sendpatchset@skannery> <20110704104343.28170.4657.sendpatchset@skannery> <4E12EFEC.4040408@in.ibm.com> In-Reply-To: <4E12EFEC.4040408@in.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [V4 Patch 4/4 - Updated]Qemu: Add commandline -drive option 'hostcache' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Supriya Kannery , qemu-devel@nongnu.org, Christoph Hellwig On 07/05/2011 04:35 PM, Supriya Kannery wrote: > Updated patch to use qemu_opt_get_bool() instead of qemu_opt_get() > to read 'hostcache' > > ------------------------------------------------------------------- > 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. It is not > allowed to specify both 'hostcache' and 'cache' options in the same > commandline. User has to specify only one among these. > > Signed-off-by: Supriya Kannery > > --- > 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 > @@ -238,6 +238,7 @@ DriveInfo *drive_init(QemuOpts *opts, in > DriveInfo *dinfo; > int snapshot = 0; > int ret; > + int hostcache = 0; > > translation = BIOS_ATA_TRANSLATION_AUTO; > > @@ -324,7 +325,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; > + } > + } > + > if ((buf = qemu_opt_get(opts, "cache")) != NULL) { > + if (hostcache != -1) { > + error_report("'hostcache' and 'cache' cannot co-exist"); > + return NULL; > + } > if (!strcmp(buf, "off") || !strcmp(buf, "none")) { > bdrv_flags |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB; > } else if (!strcmp(buf, "writeback")) { > Index: qemu/qemu-options.hx > =================================================================== > --- qemu.orig/qemu-options.hx > +++ qemu/qemu-options.hx > @@ -120,7 +120,7 @@ DEF("drive", HAS_ARG, QEMU_OPTION_drive, > " [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]\n" > " [,cache=writethrough|writeback|none|unsafe][,format=f]\n" > " [,serial=s][,addr=A][,id=name][,aio=threads|native]\n" > - " [,readonly=on|off]\n" > + " [,readonly=on|off][,hostcache=on|off]\n" > " use 'file' as a drive image\n", QEMU_ARCH_ALL) > STEXI > @item -drive @var{option}[,@var{option}[,@var{option}[,...]]] > Index: qemu/qemu-config.c > =================================================================== > --- qemu.orig/qemu-config.c > +++ qemu/qemu-config.c > @@ -78,6 +78,10 @@ static QemuOptsList qemu_drive_opts = { > },{ > .name = "readonly", > .type = QEMU_OPT_BOOL, > + },{ > + .name = "hostcache", > + .type = QEMU_OPT_BOOL, > + .help = "set or reset hostcache (on/off)" > }, > { /* end of list */ } > }, > Please review..