qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Supriya Kannery <supriyak@linux.vnet.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>,
	qemu-devel@nongnu.org, Prerna Saxena <prerna@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [RFC Patch 1/3]Qemu: Enhance "info block" to display cache setting
Date: Tue, 17 May 2011 10:39:48 +0200	[thread overview]
Message-ID: <4DD23454.7070705@redhat.com> (raw)
In-Reply-To: <20110516181037.7142.76146.sendpatchset@skannery>

Am 16.05.2011 20:10, schrieb Supriya Kannery:
> Enhance "info block" to display cache setting
> 
> Example:
> (qemu) info block
> ide0-hd0: type=hd removable=0 file=../rhel6-32.qcow2 ro=0 drv=qcow2 
> encrypted=0
> 
> Enhanced to include "cache" setting:
> (qemu) info block
> ide0-hd0: type=hd removable=0 cache=none file=../rhel6-32.qcow2 ro=0 
> drv=qcow2 encrypted=0
> 
> Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
> Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
> 
> ---
>  block.c |   18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> Index: qemu/block.c
> ===================================================================
> --- qemu.orig/block.c
> +++ qemu/block.c
> @@ -1713,6 +1713,19 @@ static void bdrv_print_dict(QObject *obj
>          monitor_printf(mon, " locked=%d", qdict_get_bool(bs_dict, "locked"));
>      }
>  
> +    if (qdict_haskey(bs_dict, "open_flags")) {
> +        int open_flags = qdict_get_int(bs_dict, "open_flags");
> +        if (open_flags & BDRV_O_NOCACHE) {
> +            monitor_printf(mon, " cache=none");
> +        } else if (open_flags & BDRV_O_CACHE_WB) {
> +            if (open_flags & BDRV_O_NO_FLUSH)
> +                monitor_printf(mon, " cache=unsafe");
> +            else
> +                monitor_printf(mon, " cache=writeback");
> +        } else
> +            monitor_printf(mon, " cache=writethrough");
> +    }
> +
>      if (qdict_haskey(bs_dict, "inserted")) {
>          QDict *qdict = qobject_to_qdict(qdict_get(bs_dict, "inserted"));
>  
> @@ -1762,9 +1775,10 @@ void bdrv_info(Monitor *mon, QObject **r
>          }
>  
>          bs_obj = qobject_from_jsonf("{ 'device': %s, 'type': %s, "
> -                                    "'removable': %i, 'locked': %i }",
> +                                    "'removable': %i, 'locked': %i, "
> +                                    "'open_flags': %d }",
>                                      bs->device_name, type, bs->removable,
> -                                    bs->locked);
> +                                    bs->locked, bs->open_flags);
>  
>          if (bs->drv) {
>              QObject *obj;

bs->open_flags is a purely internal thing and its meaning is not
guaranteed to be stable. Exposing it to the user is wrong.

Kevin

  reply	other threads:[~2011-05-17  8:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-16 18:10 [Qemu-devel] [RFC Patch 0/3]Qemu: Enable dynamic cache change through qemu monitor Supriya Kannery
2011-05-16 18:10 ` [Qemu-devel] [RFC Patch 1/3]Qemu: Enhance "info block" to display cache setting Supriya Kannery
2011-05-17  8:39   ` Kevin Wolf [this message]
2011-05-17  9:00     ` supriya kannery
2011-05-16 18:10 ` [Qemu-devel] [RFC Patch 2/3]Qemu: New error classes for file reopen and device insertion Supriya Kannery
2011-05-16 18:11 ` [Qemu-devel] [RFC Patch 3/3]Qemu: Add command "cache_set" for dynamic cache change Supriya Kannery
2011-05-16 20:23 ` [Qemu-devel] [RFC Patch 0/3]Qemu: Enable dynamic cache change through qemu monitor Christoph Hellwig
2011-05-16 21:10   ` Anthony Liguori
2011-05-17  9:27     ` supriya kannery
2011-05-17 15:41     ` Christoph Hellwig
2011-05-20  5:41       ` Supriya Kannery
2011-05-17  9:18   ` supriya kannery

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=4DD23454.7070705@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hch@lst.de \
    --cc=prerna@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=supriyak@linux.vnet.ibm.com \
    /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).