All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, pkrempa@redhat.com, mreitz@redhat.com,
	eblake@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH for-3.0 2/3] block/qapi: Include anonymous BBs in query-blockstats
Date: Fri, 27 Jul 2018 16:15:38 +0200	[thread overview]
Message-ID: <20180727141539.506-3-kwolf@redhat.com> (raw)
In-Reply-To: <20180727141539.506-1-kwolf@redhat.com>

Consistent with query-block, query-blockstats should not only include
named BlockBackends, but also those that are anonmyous, but belong to a
device model.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qapi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/block/qapi.c b/block/qapi.c
index 50f867d634..339727f0f4 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -593,12 +593,16 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
             p_next = &info->next;
         }
     } else {
-        for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
+        for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {
             BlockStatsList *info = g_malloc0(sizeof(*info));
             AioContext *ctx = blk_get_aio_context(blk);
             BlockStats *s;
             char *qdev;
 
+            if (!*blk_name(blk) && !blk_get_attached_dev(blk)) {
+                continue;
+            }
+
             aio_context_acquire(ctx);
             s = bdrv_query_bds_stats(blk_bs(blk), true);
             s->has_device = true;
-- 
2.13.6

  parent reply	other threads:[~2018-07-27 14:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 14:15 [Qemu-devel] [PATCH for-3.0 0/3] Fix query-blockstats with -blockdev Kevin Wolf
2018-07-27 14:15 ` [Qemu-devel] [PATCH for-3.0 1/3] block/qapi: Add 'qdev' field to query-blockstats result Kevin Wolf
2018-07-27 15:07   ` Eric Blake
2018-07-27 15:58     ` Kevin Wolf
2018-07-30 11:25       ` Peter Krempa
2018-07-27 14:15 ` Kevin Wolf [this message]
2018-07-27 15:08   ` [Qemu-devel] [PATCH for-3.0 2/3] block/qapi: Include anonymous BBs in query-blockstats Eric Blake
2018-07-27 14:15 ` [Qemu-devel] [PATCH for-3.0 3/3] qemu-iotests: Test query-blockstats with -drive and -blockdev Kevin Wolf
2018-07-27 15:12   ` Eric Blake
2018-07-27 16:01     ` 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=20180727141539.506-3-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=eblake@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.