From nobody Mon Feb 9 16:12:34 2026 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.zoho.com; dkim=fail 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498749436239667.7780881805891; Thu, 29 Jun 2017 08:17:16 -0700 (PDT) Received: from localhost ([::1]:39932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQbBv-00053f-QQ for importer@patchew.org; Thu, 29 Jun 2017 11:17:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQb6V-0008Um-Ry for qemu-devel@nongnu.org; Thu, 29 Jun 2017 11:11:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQb6U-00032L-Np for qemu-devel@nongnu.org; Thu, 29 Jun 2017 11:11:35 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:35222) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQb6U-00031x-Dw for qemu-devel@nongnu.org; Thu, 29 Jun 2017 11:11:34 -0400 Received: by mail-wr0-x243.google.com with SMTP id z45so37152726wrb.2 for ; Thu, 29 Jun 2017 08:11:34 -0700 (PDT) Received: from localhost.localdomain.localdomain ([217.110.131.66]) by smtp.gmail.com with ESMTPSA id r142sm1679641wmg.24.2017.06.29.08.11.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2017 08:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BIoJ0IkM66X+ctpHjC2L7VyYfk5FTxA6cF6lh+EZngM=; b=Ki02MAEG/VOgF6hiuNJ7D7H44KbDBoUSAqaBFf/gSWht8gDGMJcTonMYC77ZSGECnx rYZPNhgntBmdu1tORYZL2Ysfd+YlmEdtH/lgfVKGs6V5PT3Cdj4/941L/YPttkU4NAq2 7RqH5PiCsI7e7A013GjzmiU9BAg+k652pDMr0NTfRofKDUlMnB2jqP2veX0QZZ+n9cRI a2pe7Z10i4KcT0jnBxk92KtywHdB98OAko1A/TNlEE4aUo0PuIFnkuCABhL5MRuFKvMt vzQRybaNGkM2uVqRB7qltA1jPerlR51s6ZGgdg1htGP57xP8IBnYUJvd8cfY14LToVd7 gH2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BIoJ0IkM66X+ctpHjC2L7VyYfk5FTxA6cF6lh+EZngM=; b=Mnw5jJ9Aia9dTayqqTOWXYvBjwU0wV9hPUoZNb4FsvLLWV6gdCTVDiBp6FGPBUFFt8 0CVrDyW2xsjHYTxEzlw9vCJK/L9MJHgp9dN1vMcEHFCsyvOYJJfVnUhsuJEQiEvo8Hh6 MRMG1WqHMTtYX8CcZlN4Tk9Ff3E8l2htmHvF+ftDxr2thGesyw4JyWfx1q7SEE+N4vVf gqYEf6t8pAV47Vmu/G74KHzA6+ZdJ6alkpW3fovLguG5vu3FHcGaR9+FVeSPmOCOZshl 8rPG7TLB0jsNlVcmuJgYb/OXMeuUIUvvevujKfLgToi72dNkKSZJbx+/KwtEqT6CbMhr ZhyQ== X-Gm-Message-State: AKS2vOwgCdKZWUauZTR3lgiqKDUKacu2b+BB27J81QV3qqbok7AUBKR8 3O0OhfyjfhApcQ== X-Received: by 10.223.135.210 with SMTP id c18mr22783998wrc.109.1498749093458; Thu, 29 Jun 2017 08:11:33 -0700 (PDT) From: Pradeep Jagadeesh X-Google-Original-From: Pradeep Jagadeesh To: "eric blake" , "greg kurz" Date: Thu, 29 Jun 2017 11:10:55 -0400 Message-Id: <1498749056-38565-6-git-send-email-pradeep.jagadeesh@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1498749056-38565-1-git-send-email-pradeep.jagadeesh@huawei.com> References: <1498749056-38565-1-git-send-email-pradeep.jagadeesh@huawei.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PATCH v6 5/6] fsdev: hmp interface for throttling 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: qemu-devel@nongnu.org, jani kokkonen , alberto garcia , Pradeep Jagadeesh , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch introduces hmp interfaces for the fsdev devices. Signed-off-by: Pradeep Jagadeesh --- hmp-commands-info.hx | 18 ++++++++++++++ hmp-commands.hx | 19 +++++++++++++++ hmp.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++ hmp.h | 4 ++++ 4 files changed, 107 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index ae16901..f23b627 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -84,6 +84,24 @@ STEXI Show block device statistics. ETEXI =20 +#if defined(CONFIG_VIRTFS) + + { + .name =3D "query-fsdev-iothrottle", + .args_type =3D "", + .params =3D "", + .help =3D "show fsdev device throttle information", + .cmd =3D hmp_fsdev_get_io_throttle, + }, + +#endif + +STEXI +@item info fsdev throttle +@findex fsdevthrottleinfo +Show fsdev device throttleinfo. +ETEXI + { .name =3D "block-jobs", .args_type =3D "", diff --git a/hmp-commands.hx b/hmp-commands.hx index e763606..c60fd7e 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1662,6 +1662,25 @@ STEXI Change I/O throttle limits for a block drive to @var{bps} @var{bps_rd} @va= r{bps_wr} @var{iops} @var{iops_rd} @var{iops_wr} ETEXI =20 +#if defined(CONFIG_VIRTFS) + + { + .name =3D "fsdev-set-io-throttle", + .args_type =3D "device:B,bps:l,bps_rd:l,bps_wr:l,iops:l,iops_rd:l= ,iops_wr:l", + .params =3D "device bps bps_rd bps_wr iops iops_rd iops_wr", + .help =3D "change I/O throttle limits for a fs devices", + .cmd =3D hmp_fsdev_set_io_throttle, + }, + +#endif + +STEXI +@item fsdev_set_io_throttle @var{device} @var{bps} @var{bps_rd} @var{bps_w= r} @var{iops} @var{iops_rd} @var{iops_wr} +@findex fsdev_set_io_throttle +Change I/O throttle limits for a fs devices to @var{bps} @var{bps_rd} @var= {bps_wr} @var{iops} @var{iops_rd} @var{iops_wr} +ETEXI + + { .name =3D "set_password", .args_type =3D "protocol:s,password:s,connected:s?", diff --git a/hmp.c b/hmp.c index 220d301..b1c698b 100644 --- a/hmp.c +++ b/hmp.c @@ -1776,6 +1776,72 @@ void hmp_block_set_io_throttle(Monitor *mon, const Q= Dict *qdict) hmp_handle_error(mon, &err); } =20 +#ifdef CONFIG_VIRTFS + +void hmp_fsdev_set_io_throttle(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + IOThrottle throttle; + + hmp_initialize_io_throttle(&throttle, qdict); + qmp_fsdev_set_io_throttle(&throttle, &err); + hmp_handle_error(mon, &err); +} + +static void print_fsdev_throttle_config(Monitor *mon, IOThrottle *fscfg, + Error *err) +{ + if (fscfg->bps || fscfg->bps_rd || fscfg->bps_wr || + fscfg->iops || fscfg->iops_rd || fscfg->iops_wr) + { + monitor_printf(mon, "%s", fscfg->id); + monitor_printf(mon, " I/O throttling:" + " bps=3D%" PRId64 + " bps_rd=3D%" PRId64 " bps_wr=3D%" PRId64 + " bps_max=3D%" PRId64 + " bps_rd_max=3D%" PRId64 + " bps_wr_max=3D%" PRId64 + " iops=3D%" PRId64 " iops_rd=3D%" PRId64 + " iops_wr=3D%" PRId64 + " iops_max=3D%" PRId64 + " iops_rd_max=3D%" PRId64 + " iops_wr_max=3D%" PRId64 + " iops_size=3D%" PRId64, + fscfg->bps, + fscfg->bps_rd, + fscfg->bps_wr, + fscfg->bps_max, + fscfg->bps_rd_max, + fscfg->bps_wr_max, + fscfg->iops, + fscfg->iops_rd, + fscfg->iops_wr, + fscfg->iops_max, + fscfg->iops_rd_max, + fscfg->iops_wr_max, + fscfg->iops_size); + } + hmp_handle_error(mon, &err); +} + +void hmp_fsdev_get_io_throttle(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + IOThrottleList *fs9p_list, *info; + fs9p_list =3D qmp_query_fsdev_io_throttle(&err); + + for (info =3D fs9p_list; info; info =3D info->next) { + if (info !=3D fs9p_list) { + monitor_printf(mon, "\n"); + } + print_fsdev_throttle_config(mon, info->value, err); + qapi_free_IOThrottle(info->value); + } + qapi_free_IOThrottleList(fs9p_list); +} + +#endif + void hmp_block_stream(Monitor *mon, const QDict *qdict) { Error *error =3D NULL; diff --git a/hmp.h b/hmp.h index d8b94ce..05e72f2 100644 --- a/hmp.h +++ b/hmp.h @@ -81,6 +81,10 @@ void hmp_set_password(Monitor *mon, const QDict *qdict); void hmp_expire_password(Monitor *mon, const QDict *qdict); void hmp_eject(Monitor *mon, const QDict *qdict); void hmp_change(Monitor *mon, const QDict *qdict); +#ifdef CONFIG_VIRTFS +void hmp_fsdev_set_io_throttle(Monitor *mon, const QDict *qdict); +void hmp_fsdev_get_io_throttle(Monitor *mon, const QDict *qdict); +#endif void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict); void hmp_block_stream(Monitor *mon, const QDict *qdict); void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict); --=20 1.8.3.1