{"id":813768,"url":"http://patchwork.ozlabs.org/api/patches/813768/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1505385610-35529-7-git-send-email-pradeep.jagadeesh@huawei.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505385610-35529-7-git-send-email-pradeep.jagadeesh@huawei.com>","list_archive_url":null,"date":"2017-09-14T10:40:10","name":"[v11,6/6] fsdev: hmp interface for throttling","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"309bfab842310b14892a5f2a80ffe5a28f881f00","submitter":{"id":69852,"url":"http://patchwork.ozlabs.org/api/people/69852/?format=json","name":"Pradeep Jagadeesh","email":"pradeepkiruvale@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1505385610-35529-7-git-send-email-pradeep.jagadeesh@huawei.com/mbox/","series":[{"id":3065,"url":"http://patchwork.ozlabs.org/api/series/3065/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3065","date":"2017-09-14T10:40:06","name":"fsdev: qmp interface for io throttling","version":11,"mbox":"http://patchwork.ozlabs.org/series/3065/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/813768/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813768/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"jZFI9QVY\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtFSp3s4wz9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 20:41:30 +1000 (AEST)","from localhost ([::1]:46866 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsRaK-0006u1-I0\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 06:41:28 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:52197)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dsRZi-0006q1-19\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:51 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dsRZg-000212-Pb\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:50 -0400","from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33675)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <pradeepkiruvale@gmail.com>)\n\tid 1dsRZg-0001zr-F0\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:48 -0400","by mail-wm0-x242.google.com with SMTP id 187so2884675wmn.0\n\tfor <qemu-devel@nongnu.org>; Thu, 14 Sep 2017 03:40:48 -0700 (PDT)","from localhost.localdomain.localdomain ([217.110.131.66])\n\tby smtp.gmail.com with ESMTPSA id\n\tw14sm742801wmf.13.2017.09.14.03.40.46\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 14 Sep 2017 03:40:46 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=clxHdF063gSl2z+SG1HGpEXg4uKErp3vr8lBkxlZfZg=;\n\tb=jZFI9QVYbMPVQaWRqfIgsdWr23TVPfkrS1NhDObGq6GA1m4pNH3XskLyoRDaApqoX2\n\tJpLr20yd5c6GFYqdjTntHFHncBm0F630999MgKof2gqW7MHh+U6Lx6Kef80le0qjml3e\n\t4d7HkwhOY1T54ig945qllf4GpQPhvBESBwf2hD+FSEpyCHU/Xm+zX/ip69l72wabITzO\n\tf1bQQqhIjK6VJOTplaz+/pANnJkIUiMtbpBe2JhKzG8gsptULLR8AKz2b+2xsAasL4Ke\n\t4TrbrNPzEwwxioOhWaDNmBiSuEDwNVfYt07fHUhKDeGwXscct1sWbfm4z7SnTlvanuVW\n\tmHYA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=clxHdF063gSl2z+SG1HGpEXg4uKErp3vr8lBkxlZfZg=;\n\tb=VCSaEqcgVlPf787LobkgoPPRVRpLGa7ludKbyg1nlmbTiYOMgR1di8+uJ0PbllGTz/\n\txrgRziOMtjBP7k7VzCIswImhgtK9JFviCpizMBI6qc7ZFZ//JBAsLphbSLiLM0r2i7RD\n\tsZud8Ek0HSpO5hbqcia+BHoEaR2y68Y0cn2u/tHL1Dv0X6uYPZrpqBY/okC1vzJLkRqZ\n\tGnwUZY2fEsAYR7BWlSoda7xocsX9DtTi7WL2fsF11gA1YSNS/bqATXwqPtI/8jlTQ3Ha\n\t82QjXx8QuLf+RfyRBoToM8QCWHgRB8T97VM/mCMheHPDRDE1uX/Z3RnY1xPMQ+hNrcht\n\tmJTw==","X-Gm-Message-State":"AHPjjUiGocrIBMBWei3FNYpUachgndVm/oALNvRCNqJHjOW2MBimVs+6\n\tO7y/EAalfq42ADnZ","X-Google-Smtp-Source":"AOwi7QA8fhnNT6tH/3vFVmzaGjIuu2TbbJGfYL5L65spH7agQLJXsPNRgTWGjc4ueTvw5y5nGgAvGQ==","X-Received":"by 10.28.111.196 with SMTP id c65mr1394118wmi.18.1505385647356; \n\tThu, 14 Sep 2017 03:40:47 -0700 (PDT)","From":"Pradeep Jagadeesh <pradeepkiruvale@gmail.com>","X-Google-Original-From":"Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>","To":"\"eric blake\" <eblake@redhat.com>,\n\t\"greg kurz\" <groug@kaod.org>","Date":"Thu, 14 Sep 2017 06:40:10 -0400","Message-Id":"<1505385610-35529-7-git-send-email-pradeep.jagadeesh@huawei.com>","X-Mailer":"git-send-email 1.8.3.1","In-Reply-To":"<1505385610-35529-1-git-send-email-pradeep.jagadeesh@huawei.com>","References":"<1505385610-35529-1-git-send-email-pradeep.jagadeesh@huawei.com>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c09::242","Subject":"[Qemu-devel] [PATCH v11 6/6] fsdev: hmp interface for throttling","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-devel@nongnu.org, jani kokkonen <jani.kokkonen@huawei.com>,\n\talberto garcia <berto@igalia.com>,\n\tPradeep Jagadeesh <pradeep.jagadeesh@huawei.com>,\n\t\"Dr. David Alan Gilbert\" <dgilbert@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"This patch introduces hmp interfaces for the fsdev\ndevices.\n\nSigned-off-by: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>\nReviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>\n---\n hmp-commands-info.hx | 18 ++++++++++++++++\n hmp-commands.hx      | 19 +++++++++++++++++\n hmp.c                | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n hmp.h                |  4 ++++\n 4 files changed, 100 insertions(+)","diff":"diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx\nindex 4ab7fce..54f1968 100644\n--- a/hmp-commands-info.hx\n+++ b/hmp-commands-info.hx\n@@ -84,6 +84,24 @@ STEXI\n Show block device statistics.\n ETEXI\n \n+#if defined(CONFIG_VIRTFS)\n+\n+    {\n+        .name       = \"fsdev_iothrottle\",\n+        .args_type  = \"\",\n+        .params     = \"\",\n+        .help       = \"show fsdev iothrottle information\",\n+        .cmd        = hmp_info_fsdev_iothrottle,\n+    },\n+\n+#endif\n+\n+STEXI\n+@item info fsdev_iothrottle\n+@findex fsdev_iothrottle\n+Show fsdev device throttle info.\n+ETEXI\n+\n     {\n         .name       = \"block-jobs\",\n         .args_type  = \"\",\ndiff --git a/hmp-commands.hx b/hmp-commands.hx\nindex 1941e19..aef9f79 100644\n--- a/hmp-commands.hx\n+++ b/hmp-commands.hx\n@@ -1680,6 +1680,25 @@ STEXI\n Change I/O throttle limits for a block drive to @var{bps} @var{bps_rd} @var{bps_wr} @var{iops} @var{iops_rd} @var{iops_wr}\n ETEXI\n \n+#if defined(CONFIG_VIRTFS)\n+\n+    {\n+        .name       = \"fsdev_set_io_throttle\",\n+        .args_type  = \"device:B,bps:l,bps_rd:l,bps_wr:l,iops:l,iops_rd:l,iops_wr:l\",\n+        .params     = \"device bps bps_rd bps_wr iops iops_rd iops_wr\",\n+        .help       = \"change I/O throttle limits for a fs devices\",\n+        .cmd        = hmp_fsdev_set_io_throttle,\n+    },\n+\n+#endif\n+\n+STEXI\n+@item fsdev_set_io_throttle @var{device} @var{bps} @var{bps_rd} @var{bps_wr} @var{iops} @var{iops_rd} @var{iops_wr}\n+@findex fsdev_set_io_throttle\n+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}\n+ETEXI\n+\n+\n     {\n         .name       = \"set_password\",\n         .args_type  = \"protocol:s,password:s,connected:s?\",\ndiff --git a/hmp.c b/hmp.c\nindex acaf0e6..ceec6c9 100644\n--- a/hmp.c\n+++ b/hmp.c\n@@ -1778,6 +1778,65 @@ void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict)\n     hmp_handle_error(mon, &err);\n }\n \n+#ifdef CONFIG_VIRTFS\n+\n+void hmp_fsdev_set_io_throttle(Monitor *mon, const QDict *qdict)\n+{\n+    Error *err = NULL;\n+    ThrottleLimits throttle = {\n+        .has_id = true,\n+        .id = (char *) qdict_get_str(qdict, \"device\"),\n+    };\n+\n+    hmp_initialize_throttle_limits(&throttle, qdict);\n+    qmp_fsdev_set_io_throttle(&throttle, &err);\n+    hmp_handle_error(mon, &err);\n+}\n+\n+static void print_fsdev_throttle_config(Monitor *mon, ThrottleLimits *fscfg)\n+{\n+    monitor_printf(mon, \"%s\", fscfg->id);\n+    monitor_printf(mon, \"    I/O throttling:\"\n+                   \" bps=%\" PRId64\n+                   \" bps_rd=%\" PRId64  \" bps_wr=%\" PRId64\n+                   \" bps_max=%\" PRId64\n+                   \" bps_rd_max=%\" PRId64\n+                   \" bps_wr_max=%\" PRId64\n+                   \" iops=%\" PRId64 \" iops_rd=%\" PRId64\n+                   \" iops_wr=%\" PRId64\n+                   \" iops_max=%\" PRId64\n+                   \" iops_rd_max=%\" PRId64\n+                   \" iops_wr_max=%\" PRId64\n+                   \" iops_size=%\" PRId64\n+                   \"\\n\",\n+                   fscfg->bps_total,\n+                   fscfg->bps_read,\n+                   fscfg->bps_write,\n+                   fscfg->bps_total_max,\n+                   fscfg->bps_read_max,\n+                   fscfg->bps_write_max,\n+                   fscfg->iops_total,\n+                   fscfg->iops_read,\n+                   fscfg->iops_write,\n+                   fscfg->iops_total_max,\n+                   fscfg->iops_read_max,\n+                   fscfg->iops_write_max,\n+                   fscfg->iops_size);\n+}\n+\n+void hmp_info_fsdev_iothrottle(Monitor *mon, const QDict *qdict)\n+{\n+    ThrottleLimitsList *fsdev_list, *info;\n+    fsdev_list = qmp_query_fsdev_io_throttle(NULL);\n+\n+    for (info = fsdev_list; info; info = info->next) {\n+        print_fsdev_throttle_config(mon, info->value);\n+    }\n+    qapi_free_ThrottleLimitsList(fsdev_list);\n+}\n+\n+#endif\n+\n void hmp_block_stream(Monitor *mon, const QDict *qdict)\n {\n     Error *error = NULL;\ndiff --git a/hmp.h b/hmp.h\nindex 1ff4552..d700d7d 100644\n--- a/hmp.h\n+++ b/hmp.h\n@@ -81,6 +81,10 @@ void hmp_set_password(Monitor *mon, const QDict *qdict);\n void hmp_expire_password(Monitor *mon, const QDict *qdict);\n void hmp_eject(Monitor *mon, const QDict *qdict);\n void hmp_change(Monitor *mon, const QDict *qdict);\n+#ifdef CONFIG_VIRTFS\n+void hmp_fsdev_set_io_throttle(Monitor *mon, const QDict *qdict);\n+void hmp_info_fsdev_iothrottle(Monitor *mon, const QDict *qdict);\n+#endif\n void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict);\n void hmp_block_stream(Monitor *mon, const QDict *qdict);\n void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict);\n","prefixes":["v11","6/6"]}