From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv6Cp-0005Q0-QH for qemu-devel@nongnu.org; Wed, 08 Feb 2012 07:01:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rv6Ck-0003SB-3s for qemu-devel@nongnu.org; Wed, 08 Feb 2012 07:00:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv6Cj-0003Ru-TT for qemu-devel@nongnu.org; Wed, 08 Feb 2012 07:00:54 -0500 Date: Wed, 8 Feb 2012 10:00:42 -0200 From: Luiz Capitulino Message-ID: <20120208100042.4747cf2c@doriath.home> In-Reply-To: <20120201030614.2990.87825.sendpatchset@skannery.in.ibm.com> References: <20120201030557.2990.74150.sendpatchset@skannery.in.ibm.com> <20120201030614.2990.87825.sendpatchset@skannery.in.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC Patch 1/7]Qemu: Enhance "info block" to display host cache setting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Supriya Kannery Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel@nongnu.org, Christoph Hellwig On Wed, 01 Feb 2012 08:36:14 +0530 Supriya Kannery wrote: > Enhance "info block" to display hostcache setting for each > block device. > > Example: > (qemu) info block > ide0-hd0: removable=0 file=../rhel6-32.raw ro=0 drv=raw encrypted=0 > > Enhanced to display "hostcache" setting: > (qemu) info block > ide0-hd0: removable=0 hostcache=1 file=../rhel6-32.raw ro=0 drv=raw encrypted=0 The day we'll want to refactor 'info block' output is coming... > Signed-off-by: Supriya Kannery > > --- > block.c | 20 ++++++++++++++++---- > qmp-commands.hx | 2 ++ > 2 files changed, 18 insertions(+), 4 deletions(-) > > Index: qemu/qapi-schema.json > =================================================================== > --- qemu.orig/qapi-schema.json > +++ qemu/qapi-schema.json > @@ -423,6 +423,8 @@ > # @locked: True if the guest has locked this device from having its media > # removed > # > +# @hostcache: True if host pagecache is enabled. > +# > # @tray_open: #optional True if the device has a tray and it is open > # (only present if removable is true) > # > @@ -436,7 +438,7 @@ > ## > { 'type': 'BlockInfo', > 'data': {'device': 'str', 'type': 'str', 'removable': 'bool', > - 'locked': 'bool', '*inserted': 'BlockDeviceInfo', > + 'locked': 'bool','hostcache': 'bool', '*inserted': 'BlockDeviceInfo', > '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus'} } > > ## > Index: qemu/block.c > =================================================================== > --- qemu.orig/block.c > +++ qemu/block.c > @@ -2285,6 +2285,7 @@ BlockInfoList *qmp_query_block(Error **e > info->value->device = g_strdup(bs->device_name); > info->value->type = g_strdup("unknown"); > info->value->locked = bdrv_dev_is_medium_locked(bs); > + info->value->hostcache = !(bs->open_flags & BDRV_O_NOCACHE); > info->value->removable = bdrv_dev_has_removable_media(bs); > > if (bdrv_dev_has_removable_media(bs)) { > Index: qemu/hmp.c > =================================================================== > --- qemu.orig/hmp.c > +++ qemu/hmp.c > @@ -209,6 +209,8 @@ void hmp_info_block(Monitor *mon) > monitor_printf(mon, " tray-open=%d", info->value->tray_open); > } > > + monitor_printf(mon, " hostcache=%d", info->value->hostcache); > + > if (info->value->has_io_status) { > monitor_printf(mon, " io-status=%s", > BlockDeviceIoStatus_lookup[info->value->io_status]); >