From nobody Mon Feb 9 09:34:46 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506955130731912.5015435347062; Mon, 2 Oct 2017 07:38:50 -0700 (PDT) Received: from localhost ([::1]:52623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz1rf-0000XY-47 for importer@patchew.org; Mon, 02 Oct 2017 10:38:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz1nP-0005Zt-2e for qemu-devel@nongnu.org; Mon, 02 Oct 2017 10:34:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz1nN-0007w4-VP for qemu-devel@nongnu.org; Mon, 02 Oct 2017 10:34:11 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:54666) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dz1nN-0007vA-Mf for qemu-devel@nongnu.org; Mon, 02 Oct 2017 10:34:09 -0400 Received: by mail-wm0-x241.google.com with SMTP id i124so11009703wmf.3 for ; Mon, 02 Oct 2017 07:34:09 -0700 (PDT) Received: from localhost.localdomain.localdomain ([217.110.131.66]) by smtp.gmail.com with ESMTPSA id b89sm28440668wrd.42.2017.10.02.07.34.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 07:34:07 -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=k6XI8Mh5TAanMTeqJUqaDQXYMF/OojY77VMCh+2Zrmo=; b=UXl1Fe/qZl9laRUaj+roJGP3g+ABWg7ZxjP347UswW5CxIfJ1Kt5mfJ54SoVcejv/j 3uKjWd8DSRqlCJB6BHr1OmT3O1TKG0Ns/AvA7LK5ILDPT7L2JQw2HO3yOTG8rA0VgJ+H Um9+wpxEUFYCYeq47wpw9Q0iBdRV/KdGYKqqJTM3wVYjMEjwCqwLVWHy680ZTGa5QS5e Em7TOcEzftee087+cAeRhsrR96gBJqCVCCic2soq5tm8BQijenQnqKEoidDCCVqfikEE kO8B4cgMbdkkfR9Hw6XbpXS4eGS4YyLKtwM/zTlXUx/DgKYXGJ65q8XEWDIBt97Ew//m CNgg== 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=k6XI8Mh5TAanMTeqJUqaDQXYMF/OojY77VMCh+2Zrmo=; b=hktcEav0L/iH24FxIwJObinApoe1DJvuteTh1QxikjOi5bar5rhVzDDXZ2NVjsji88 OHMD6sgEQ7SF+EpqY3OouT+TBnEdtzWx2VNtA14sVgeRmo7ahEQcPh/W3838CJpCm/Jo vxGnTE2jOPYvwrLMYmMLxpbCVt2fEVQzRxTBVJULH2H1j8OdWiwAAUUGvYs5eaCFa4Sd Tok3VR8BloVl4wowlR3DwAKfJjHmm3oXt3EqPqKhbjBQUxtN2Lna3UdhKll8MAWbXN0A M3mcV74TuJA9ARRMHJkx/+ygP3xUi0MgJyDcSxJ86Y/s+aBChwXQIsv0cY3T0zfpfPdt Z6CQ== X-Gm-Message-State: AMCzsaWxT82LAK+Wz7Oh7CXwOW7+utg7h2GTr0ApTbmLkIigJKq2TR/y rBY1XAgAzop/Qn65bzxIZaY= X-Google-Smtp-Source: AOwi7QAHgBIqm3HfiLUu3I5160Hbj0Wv/KJ0LnkZ+n+jt9Uj/l8ENosFMb/uIlMXZFOk7xp2VGVrEQ== X-Received: by 10.28.178.205 with SMTP id b196mr526052wmf.103.1506954848586; Mon, 02 Oct 2017 07:34:08 -0700 (PDT) From: Pradeep Jagadeesh X-Google-Original-From: Pradeep Jagadeesh To: "eric blake" , "greg kurz" Date: Mon, 2 Oct 2017 10:33:32 -0400 Message-Id: <1506954812-6552-7-git-send-email-pradeep.jagadeesh@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1506954812-6552-1-git-send-email-pradeep.jagadeesh@huawei.com> References: <1506954812-6552-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:c09::241 Subject: [Qemu-devel] [PATCH v13 6/6] fsdev: hmp interface for throttling X-BeenThere: qemu-devel@gnu.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@gnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 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 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Alberto Garcia --- hmp-commands-info.hx | 18 ++++++++++++++++ hmp-commands.hx | 19 ++++++++++++++++ hmp.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++ hmp.h | 4 ++++ 4 files changed, 102 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 4f1ece9..9e1a26f 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 "fsdev_iothrottle", + .args_type =3D "", + .params =3D "", + .help =3D "show fsdev iothrottle information", + .cmd =3D hmp_info_fsdev_iothrottle, + }, + +#endif + +STEXI +@item info fsdev_iothrottle +@findex fsdev_iothrottle +Show fsdev device throttle info. +ETEXI + { .name =3D "block-jobs", .args_type =3D "", diff --git a/hmp-commands.hx b/hmp-commands.hx index 1941e19..aef9f79 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1680,6 +1680,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 904fc4a..dc0dbf1 100644 --- a/hmp.c +++ b/hmp.c @@ -1792,6 +1792,67 @@ 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; + ThrottleLimits *tlimits; + FsdevIOThrottle throttle =3D { + .has_id =3D true, + .id =3D (char *) qdict_get_str(qdict, "device"), + }; + + tlimits =3D qapi_FsdevIOThrottle_base(&throttle); + hmp_initialize_throttle_limits(tlimits, qdict); + qmp_fsdev_set_io_throttle(&throttle, &err); + hmp_handle_error(mon, &err); +} + +static void print_fsdev_throttle_config(Monitor *mon, FsdevIOThrottle *fsc= fg) +{ + 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 + "\n", + fscfg->bps_total, + fscfg->bps_read, + fscfg->bps_write, + fscfg->bps_total_max, + fscfg->bps_read_max, + fscfg->bps_write_max, + fscfg->iops_total, + fscfg->iops_read, + fscfg->iops_write, + fscfg->iops_total_max, + fscfg->iops_read_max, + fscfg->iops_write_max, + fscfg->iops_size); +} + +void hmp_info_fsdev_iothrottle(Monitor *mon, const QDict *qdict) +{ + FsdevIOThrottleList *fsdev_list, *info; + fsdev_list =3D qmp_query_fsdev_io_throttle(NULL); + + for (info =3D fsdev_list; info; info =3D info->next) { + print_fsdev_throttle_config(mon, info->value); + } + qapi_free_FsdevIOThrottleList(fsdev_list); +} + +#endif + void hmp_block_stream(Monitor *mon, const QDict *qdict) { Error *error =3D NULL; diff --git a/hmp.h b/hmp.h index 3605003..5a06590 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_info_fsdev_iothrottle(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