qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Prerna Saxena <prerna@linux.vnet.ibm.com>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: kwolf@redhat.com, Anthony Liguori <aliguori@us.ibm.com>,
	Ananth Narayan <ananth@linux.vnet.ibm.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: [Qemu-devel] [RFC][PATCH 2/2] Extend monitor command 'info block' to display cache settings for block devices.
Date: Mon, 28 Feb 2011 17:41:32 +0530	[thread overview]
Message-ID: <20110228174132.769fe22f@zephyr> (raw)
In-Reply-To: <20110228171956.05a84fb9@zephyr>

(qemu)info block
SAMPLE output :
ide0-hd0: type=hd removable=0 cache=none file=/tmp/abc.img ro=0
drv=qcow2 encrypted=0

---
 block.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/block.c b/block.c
index f7d91a2..c717888 100644
--- a/block.c
+++ b/block.c
@@ -1707,6 +1707,23 @@ static void bdrv_print_dict(QObject *obj, void *opaque)
         monitor_printf(mon, " locked=%d", qdict_get_bool(bs_dict, "locked"));
     }
 
+    if (qdict_haskey(bs_dict, "open_flags") &&
+        !strcmp(qdict_get_str(bs_dict, "type"), "hd")) {
+        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"));
 
@@ -1756,9 +1773,10 @@ void bdrv_info(Monitor *mon, QObject **ret_data)
         }
 
         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;
-- 
1.7.2.3



-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India

  parent reply	other threads:[~2011-02-28 12:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 11:49 [Qemu-devel] [RFC][PATCH 0/2] Allow cache settings for block devices to be changed at runtime Prerna Saxena
2011-02-28 12:07 ` [Qemu-devel] [RFC][PATCH 1/2] Add monitor command 'set-cache' to change cache settings for a block device Prerna Saxena
2011-02-28 12:11 ` Prerna Saxena [this message]
2011-02-28 15:15   ` [Qemu-devel] [RFC][PATCH 2/2] Extend monitor command 'info block' to display cache settings for block devices Kevin Wolf
2011-02-28 15:12 ` [Qemu-devel] [RFC][PATCH 0/2] Allow cache settings for block devices to be changed at runtime Kevin Wolf
2011-02-28 15:35   ` Stefan Hajnoczi
2011-02-28 15:48     ` Kevin Wolf
2011-03-01  9:55       ` Stefan Hajnoczi
2011-03-01 10:06         ` Kevin Wolf
2011-03-01 15:02           ` Chunqiang Tang
2011-03-01 13:03       ` Anthony Liguori
2011-03-01 13:22         ` Kevin Wolf
2011-03-01 15:47           ` Anthony Liguori
2011-03-01 12:42     ` Christoph Hellwig
2011-03-01 12:48       ` Stefan Hajnoczi
2011-03-01 12:50         ` Christoph Hellwig
2011-03-01 19:13           ` Anthony Liguori
2011-03-02  7:57             ` Kevin Wolf
2011-03-01 12:52       ` Kevin Wolf

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=20110228174132.769fe22f@zephyr \
    --to=prerna@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).