From nobody Wed Nov 5 22:23:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538480152638853.0790249387253; Tue, 2 Oct 2018 04:35:52 -0700 (PDT) Received: from localhost ([::1]:43062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7Ixx-0006tA-He for importer@patchew.org; Tue, 02 Oct 2018 07:35:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7Ivq-0005ZQ-HF for qemu-devel@nongnu.org; Tue, 02 Oct 2018 07:33:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g7Ivk-00017j-Lv for qemu-devel@nongnu.org; Tue, 02 Oct 2018 07:33:38 -0400 Received: from relay.sw.ru ([185.231.240.75]:35978) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g7Ivk-00015L-Aw; Tue, 02 Oct 2018 07:33:32 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1g7Ive-0005Oe-Oy; Tue, 02 Oct 2018 14:33:26 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Tue, 2 Oct 2018 14:33:24 +0300 Message-Id: <20181002113325.12911-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181002113325.12911-1-vsementsov@virtuozzo.com> References: <20181002113325.12911-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 1/2] qapi: support device id for x-block-latency-histogram-set 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: kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, armbru@redhat.com, mreitz@redhat.com, nshirokovskiy@virtuozzo.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Support modern way of device selecting. Signed-off-by: Vladimir Sementsov-Ogievskiy --- qapi/block-core.json | 6 ++++-- blockdev.c | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index ac3b48ee54..4efd60d8ab 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -489,7 +489,9 @@ # If only @device parameter is specified, remove all present latency histo= grams # for the device. Otherwise, add/reset some of (or all) latency histograms. # -# @device: device name to set latency histogram for. +# @device: device name to set latency histogram for (better use @id). +# +# @id: The name or QOM path of the guest device. # # @boundaries: list of interval boundary values (see description in # BlockLatencyHistogramInfo definition). If specified, all @@ -547,7 +549,7 @@ # <- { "return": {} } ## { 'command': 'x-block-latency-histogram-set', - 'data': {'device': 'str', + 'data': {'*device': 'str', '*id': 'str', '*boundaries': ['uint64'], '*boundaries-read': ['uint64'], '*boundaries-write': ['uint64'], diff --git a/blockdev.c b/blockdev.c index a8755bd908..87f4ab3316 100644 --- a/blockdev.c +++ b/blockdev.c @@ -4368,20 +4368,22 @@ void qmp_x_blockdev_set_iothread(const char *node_n= ame, StrOrNull *iothread, } =20 void qmp_x_block_latency_histogram_set( - const char *device, + bool has_device, const char *device, + bool has_id, const char *id, bool has_boundaries, uint64List *boundaries, bool has_boundaries_read, uint64List *boundaries_read, bool has_boundaries_write, uint64List *boundaries_write, bool has_boundaries_flush, uint64List *boundaries_flush, Error **errp) { - BlockBackend *blk =3D blk_by_name(device); + BlockBackend *blk; BlockAcctStats *stats; =20 + blk =3D qmp_get_blk(has_device ? device : NULL, has_id ? id : NULL, er= rp); if (!blk) { - error_setg(errp, "Device '%s' not found", device); return; } + stats =3D blk_get_stats(blk); =20 if (!has_boundaries && !has_boundaries_read && !has_boundaries_write && --=20 2.18.0 From nobody Wed Nov 5 22:23:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538480150177847.1243089973789; Tue, 2 Oct 2018 04:35:50 -0700 (PDT) Received: from localhost ([::1]:43063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7Ixx-0006uc-4S for importer@patchew.org; Tue, 02 Oct 2018 07:35:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7Ivn-0005YO-W5 for qemu-devel@nongnu.org; Tue, 02 Oct 2018 07:33:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g7Ivl-00018j-C2 for qemu-devel@nongnu.org; Tue, 02 Oct 2018 07:33:35 -0400 Received: from relay.sw.ru ([185.231.240.75]:35972) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g7Ivk-00015J-U0; Tue, 02 Oct 2018 07:33:33 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1g7Ive-0005Oe-Qr; Tue, 02 Oct 2018 14:33:26 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Tue, 2 Oct 2018 14:33:25 +0300 Message-Id: <20181002113325.12911-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181002113325.12911-1-vsementsov@virtuozzo.com> References: <20181002113325.12911-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 2/2] qapi: drop x- from x-block-latency-histogram-set 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: kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, armbru@redhat.com, mreitz@redhat.com, nshirokovskiy@virtuozzo.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Libvirt part is ready, let's drop x- prefix. Signed-off-by: Vladimir Sementsov-Ogievskiy --- qapi/block-core.json | 4 ++-- blockdev.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 4efd60d8ab..e9c0079933 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -482,7 +482,7 @@ 'data': {'boundaries': ['uint64'], 'bins': ['uint64'] } } =20 ## -# @x-block-latency-histogram-set: +# @block-latency-histogram-set: # # Manage read, write and flush latency histograms for the device. # @@ -548,7 +548,7 @@ # "arguments": { "device": "drive0" } } # <- { "return": {} } ## -{ 'command': 'x-block-latency-histogram-set', +{ 'command': 'block-latency-histogram-set', 'data': {'*device': 'str', '*id': 'str', '*boundaries': ['uint64'], '*boundaries-read': ['uint64'], diff --git a/blockdev.c b/blockdev.c index 87f4ab3316..bc579d8f81 100644 --- a/blockdev.c +++ b/blockdev.c @@ -4367,7 +4367,7 @@ void qmp_x_blockdev_set_iothread(const char *node_nam= e, StrOrNull *iothread, aio_context_release(old_context); } =20 -void qmp_x_block_latency_histogram_set( +void qmp_block_latency_histogram_set( bool has_device, const char *device, bool has_id, const char *id, bool has_boundaries, uint64List *boundaries, --=20 2.18.0