From nobody Mon May 6 17:06:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548688693915772.490792481851; Mon, 28 Jan 2019 07:18:13 -0800 (PST) Received: from localhost ([127.0.0.1]:33534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go8fs-0006Vh-Cs for importer@patchew.org; Mon, 28 Jan 2019 10:18:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go8dZ-0005Ji-Ac for qemu-devel@nongnu.org; Mon, 28 Jan 2019 10:15:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1go8dX-0004FZ-CT for qemu-devel@nongnu.org; Mon, 28 Jan 2019 10:15:49 -0500 Received: from forwardcorp1g.cmail.yandex.net ([87.250.241.190]:46838) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1go8dP-0004DT-Qs; Mon, 28 Jan 2019 10:15:41 -0500 Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1g.cmail.yandex.net (Yandex) with ESMTP id B8F5320F40; Mon, 28 Jan 2019 18:15:36 +0300 (MSK) Received: from smtpcorp1p.mail.yandex.net (smtpcorp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:10]) by mxbackcorp1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id cNEYNejJNf-FaxqUIEQ; Mon, 28 Jan 2019 18:15:36 +0300 Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:408:250:b6ff:fe97:2682]) by smtpcorp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 32AXKRTRxI-Fa5CuNdk; Mon, 28 Jan 2019 18:15:36 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1548688536; bh=3aCLEYOdbA4K/YgW5htg/uslPFLqFNqxUhBgiFlfVro=; h=From:To:Cc:Subject:Date:Message-Id; b=o0I/RP48N1EhKIBtuMdKIqbbGI9j2/ff3/4dOqoabJUI9TW9z/V4iMKOZGR7/GcuP QS3/Jtzl9dfkSDtF3eK9lh3qujrlnqmM8AHarD8fdWemg5r+4wv9s50oY/yXOvq+RV mn9OBGYfTfF92CDL9dKgi8iwOaIzwZU24Rz9TQhY= Authentication-Results: mxbackcorp1g.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Anton Kuchin To: qemu-devel@nongnu.org Date: Mon, 28 Jan 2019 18:15:21 +0300 Message-Id: <20190128151521.13875-1-antonkuchin@yandex-team.ru> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 87.250.241.190 Subject: [Qemu-devel] [PATCH] qmp: Deprecate query-nodes option of query-blockstats X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, libvir-list@redhat.com, Markus Armbruster , Max Reitz , Anton Kuchin , Evgeny Yakovlev Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This option is broken since a6baa60807 in v2.9 and returns mostly zeroes instead of real stats because actual querring of BlockStats that resides in blk is missing. And it makes no sense because with this option BlockDriverState-s are iterated but BlockAcctStats belong to BlockBackend and not BDS since 7f0e9da6f13 in v2.5 Signed-off-by: Anton Kuchin --- block/qapi.c | 26 +++++++------------------- qapi/block-core.json | 8 +------- qemu-deprecated.texi | 5 +++++ 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/block/qapi.c b/block/qapi.c index c66f949db8..19d4b4ee42 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -502,8 +502,7 @@ static void bdrv_query_blk_stats(BlockDeviceStats *ds, = BlockBackend *blk) &ds->x_flush_latency_histogram); } =20 -static BlockStats *bdrv_query_bds_stats(BlockDriverState *bs, - bool blk_level) +static BlockStats *bdrv_query_bds_stats(BlockDriverState *bs) { BlockStats *s =3D NULL; =20 @@ -517,7 +516,7 @@ static BlockStats *bdrv_query_bds_stats(BlockDriverStat= e *bs, /* Skip automatically inserted nodes that the user isn't aware of in * a BlockBackend-level command. Stay at the exact node for a node-lev= el * command. */ - while (blk_level && bs->drv && bs->implicit) { + while (bs->drv && bs->implicit) { bs =3D backing_bs(bs); assert(bs); } @@ -531,12 +530,12 @@ static BlockStats *bdrv_query_bds_stats(BlockDriverSt= ate *bs, =20 if (bs->file) { s->has_parent =3D true; - s->parent =3D bdrv_query_bds_stats(bs->file->bs, blk_level); + s->parent =3D bdrv_query_bds_stats(bs->file->bs); } =20 - if (blk_level && bs->backing) { + if (bs->backing) { s->has_backing =3D true; - s->backing =3D bdrv_query_bds_stats(bs->backing->bs, blk_level); + s->backing =3D bdrv_query_bds_stats(bs->backing->bs); } =20 return s; @@ -577,21 +576,10 @@ BlockStatsList *qmp_query_blockstats(bool has_query_n= odes, { BlockStatsList *head =3D NULL, **p_next =3D &head; BlockBackend *blk; - BlockDriverState *bs; =20 /* Just to be safe if query_nodes is not always initialized */ if (has_query_nodes && query_nodes) { - for (bs =3D bdrv_next_node(NULL); bs; bs =3D bdrv_next_node(bs)) { - BlockStatsList *info =3D g_malloc0(sizeof(*info)); - AioContext *ctx =3D bdrv_get_aio_context(bs); - - aio_context_acquire(ctx); - info->value =3D bdrv_query_bds_stats(bs, false); - aio_context_release(ctx); - - *p_next =3D info; - p_next =3D &info->next; - } + error_setg(errp, "Option query_nodes is deprecated"); } else { for (blk =3D blk_all_next(NULL); blk; blk =3D blk_all_next(blk)) { BlockStatsList *info; @@ -604,7 +592,7 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nod= es, } =20 aio_context_acquire(ctx); - s =3D bdrv_query_bds_stats(blk_bs(blk), true); + s =3D bdrv_query_bds_stats(blk_bs(blk)); s->has_device =3D true; s->device =3D g_strdup(blk_name(blk)); =20 diff --git a/qapi/block-core.json b/qapi/block-core.json index 91685be6c2..2dd5f6032c 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -892,13 +892,7 @@ # # Query the @BlockStats for all virtual block devices. # -# @query-nodes: If true, the command will query all the block nodes -# that have a node name, in a list which will include "paren= t" -# information, but not "backing". -# If false or omitted, the behavior is as before - query all= the -# device backends, recursively including their "parent" and -# "backing". Filter nodes that were created implicitly are -# skipped over in this mode. (Since 2.3) +# @query-nodes: deprecated since 3.2 # # Returns: A list of @BlockStats for each virtual block devices. # diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 219206a836..e1e04ced7d 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -112,6 +112,11 @@ Use ``device_add'' for hotplugging vCPUs instead of ``= cpu-add''. See documentation of ``query-hotpluggable-cpus'' for additional details. =20 +@subsection query-blockstats (since 3.2) + +"query-nodes" parameter is not supported anymore because blockstats +are not a prorerty of node. + @section Human Monitor Protocol (HMP) commands =20 @subsection The hub_id parameter of 'hostfwd_add' / 'hostfwd_remove' (sinc= e 3.1) --=20 2.19.1