From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlZnt-0001wu-VK for qemu-devel@nongnu.org; Tue, 04 Nov 2014 03:49:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlZnn-00069L-Ql for qemu-devel@nongnu.org; Tue, 04 Nov 2014 03:49:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlZnn-00069F-Ij for qemu-devel@nongnu.org; Tue, 04 Nov 2014 03:49:23 -0500 Message-ID: <5458930D.9070108@redhat.com> Date: Tue, 04 Nov 2014 09:49:17 +0100 From: Max Reitz MIME-Version: 1.0 References: <1414559044-14501-1-git-send-email-famz@redhat.com> <1414559044-14501-5-git-send-email-famz@redhat.com> <5450AF47.8010408@redhat.com> <20141031032015.GC22382@fam-t430.nay.redhat.com> In-Reply-To: <20141031032015.GC22382@fam-t430.nay.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/4] qmp: Add optional switch "query-nodes" in query-blockstats List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , Benoit Canet , Markus Armbruster , qemu-devel@nongnu.org, Luiz Capitulino , Stefan Hajnoczi On 2014-10-31 at 04:20, Fam Zheng wrote: > On Wed, 10/29 10:11, Max Reitz wrote: >> On 2014-10-29 at 06:04, Fam Zheng wrote: >>> This bool option will allow query all the node names. It iterates all >>> the BDSes that are assigned a name, also in this case don't query up the >>> backing chain. >>> >>> Signed-off-by: Fam Zheng >>> --- >>> block/qapi.c | 20 +++++++++++++------- >>> hmp.c | 2 +- >>> qapi/block-core.json | 4 +++- >>> qmp-commands.hx | 2 +- >>> 4 files changed, 18 insertions(+), 10 deletions(-) >>> >>> diff --git a/block/qapi.c b/block/qapi.c >>> index a4d1a20..e26033e 100644 >>> --- a/block/qapi.c >>> +++ b/block/qapi.c >>> @@ -322,7 +322,8 @@ static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info, >>> qapi_free_BlockInfo(info); >>> } >>> -static BlockStats *bdrv_query_stats(const BlockDriverState *bs) >>> +static BlockStats *bdrv_query_stats(const BlockDriverState *bs, >>> + bool query_backing) >>> { >>> BlockStats *s; >>> @@ -352,12 +353,12 @@ static BlockStats *bdrv_query_stats(const BlockDriverState *bs) >>> if (bs->file) { >>> s->has_parent = true; >>> - s->parent = bdrv_query_stats(bs->file); >>> + s->parent = bdrv_query_stats(bs->file, query_backing); >>> } >>> - if (bs->backing_hd) { >>> + if (query_backing && bs->backing_hd) { >>> s->has_backing = true; >>> - s->backing = bdrv_query_stats(bs->backing_hd); >>> + s->backing = bdrv_query_stats(bs->backing_hd, query_backing); >>> } >> Is there a specific reason why you're not querying the backing chain but >> still recurse to bs->file? > Unlike its backing, there can be some information in ->file which is > interesting to the node itself, because it is ->file carries out the actual > read/write on the image. Makes sense? Ah, I forgot to answer. Well, ->backing carries out reads, too. I thought you omitted it because you could give it a node-name as well and therefore you'd have some BDS appear twice; but the same applies to ->file, that's why I asked. Max