Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/809755/?format=api
{ "id": 809755, "url": "http://patchwork.ozlabs.org/api/patches/809755/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1504541267-36954-6-git-send-email-pradeep.jagadeesh@huawei.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "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": "<1504541267-36954-6-git-send-email-pradeep.jagadeesh@huawei.com>", "list_archive_url": null, "date": "2017-09-04T16:07:46", "name": "[v10,5/6] fsdev: QMP interface for throttling", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "b48c9afd3f2af6f67b8af27d09b97e063c5d649b", "submitter": { "id": 69852, "url": "http://patchwork.ozlabs.org/api/people/69852/?format=api", "name": "Pradeep Jagadeesh", "email": "pradeepkiruvale@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1504541267-36954-6-git-send-email-pradeep.jagadeesh@huawei.com/mbox/", "series": [ { "id": 1415, "url": "http://patchwork.ozlabs.org/api/series/1415/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1415", "date": "2017-09-04T16:07:42", "name": "fsdev: qmp interface for io throttling", "version": 10, "mbox": "http://patchwork.ozlabs.org/series/1415/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/809755/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/809755/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=208.118.235.17; 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=\"to1JtHk1\"; dkim-atps=neutral" ], "Received": [ "from lists.gnu.org (lists.gnu.org [208.118.235.17])\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 3xmFGF0hBsz9s7m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 5 Sep 2017 02:11:31 +1000 (AEST)", "from localhost ([::1]:54751 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 1dotyD-00015d-En\n\tfor incoming@patchwork.ozlabs.org; Mon, 04 Sep 2017 12:11:29 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:46916)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dotvN-0007Mh-Ga\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:38 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dotvH-0008SM-Sb\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:33 -0400", "from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35916)\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 1dotvH-0008S9-IQ\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:27 -0400", "by mail-wm0-x241.google.com with SMTP id p17so708524wmd.3\n\tfor <qemu-devel@nongnu.org>; Mon, 04 Sep 2017 09:08:27 -0700 (PDT)", "from localhost.localdomain.localdomain ([217.110.131.66])\n\tby smtp.gmail.com with ESMTPSA id\n\tx67sm976582wma.7.2017.09.04.09.08.25\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 04 Sep 2017 09:08:25 -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=Bs+bxCF8jrU9e1Smx4QoH3EBcFUasbz2H4vC/zrnmpM=;\n\tb=to1JtHk1QM+PEmVeCZocgUQZcd+tNmlIEBvki7A7fA3FArwrMuaHNmh1gn+S1tkJTp\n\t0vMD9x1xZZ0vYn741znyrBqkIi54fguzp3SIYRvJjrupM2SR4dGM2HWttUz5UBvShWQP\n\tA8LTan3sn/wNExWBXyknpYqeY5JbZDYyMYT5l2MnlLhVJIZgOPFn1UxKofttj7dWna0M\n\tStvbibaQRbdkQLJ/Xm/lOOKAOonOVKRsUTehBP4yDhzQNrwelDx+eTNLcX0c1sAxnMWq\n\t9rVlF+p+dsE2kXFrbWghmR1xYf64KjmaaNx509BL/x7RtMEAyLQFg3rPyVio3hJScZEI\n\tFlEA==", "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=Bs+bxCF8jrU9e1Smx4QoH3EBcFUasbz2H4vC/zrnmpM=;\n\tb=kwcc8MOkapWQUAOCsAtQMi4IihW2ERkZyZrWynLZ+EeA+WTstc7W1QDtjNVOXmI4yy\n\ty2kl2ZwoPWzt75XIwBDTZ8aGljIwc1rdMkni8fhEhYmJPYFtabQXTZbSijaX+BDajz37\n\tSivDL0c0VywnTtlQWeQqqlmZsgstMkzlaLbGZRJ4m4uOusJB0OH9SFxa+Fw1FCZ64Sat\n\tTSeS7uMSvUheB6gFMbHJFmWp6kmrgn3KxLbXCdm0VNNqm41dSsJ1xULpDVBYDlI3yI1Z\n\tFZqyKf28rLFg1cXhoOfbHSvsWKF1GxXgaNAYEm3Hjk+AbYdiZGYhk4z4SrPDT/ZUP7A5\n\tlG4w==", "X-Gm-Message-State": "AHPjjUjboxlOsFRf3GMjnjaDsUO11wDnBovzqbM8AafCVYqxmW4wAhSH\n\thHA78fkoc7hyLE6o", "X-Google-Smtp-Source": "ADKCNb6mTMk4WJIzzdjGfut4tYvKi8GNl0jr2yjWNxI/YdP07qfPUruSV+mdvhYPgzkHkL6zI5XMSg==", "X-Received": "by 10.28.24.138 with SMTP id 132mr794890wmy.61.1504541306429;\n\tMon, 04 Sep 2017 09:08:26 -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": "Mon, 4 Sep 2017 12:07:46 -0400", "Message-Id": "<1504541267-36954-6-git-send-email-pradeep.jagadeesh@huawei.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1504541267-36954-1-git-send-email-pradeep.jagadeesh@huawei.com>", "References": "<1504541267-36954-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::241", "Subject": "[Qemu-devel] [PATCH v10 5/6] fsdev: QMP 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": "alberto garcia <berto@igalia.com>, Markus Armbruster <armbru@redhat.com>,\n\tqemu-devel@nongnu.org, \"Dr. David Alan Gilbert\" <dgilbert@redhat.com>,\n\tPradeep Jagadeesh <pradeep.jagadeesh@huawei.com>,\n\tjani kokkonen <jani.kokkonen@huawei.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 qmp interfaces for the fsdev\ndevices. This provides two interfaces one\nfor querying info of all the fsdev devices. The second one\nto set the IO limits for the required fsdev device.\n\nSigned-off-by: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>\n---\n Makefile | 4 ++\n fsdev/qemu-fsdev-dummy.c | 11 ++++\n fsdev/qemu-fsdev-throttle.c | 145 ++++++++++++++++++++++++++++++++++++++++++--\n fsdev/qemu-fsdev-throttle.h | 9 ++-\n fsdev/qemu-fsdev.c | 30 +++++++++\n monitor.c | 5 ++\n qapi-schema.json | 3 +\n qapi/fsdev.json | 81 +++++++++++++++++++++++++\n qmp.c | 14 +++++\n 9 files changed, 294 insertions(+), 8 deletions(-)\n create mode 100644 qapi/fsdev.json", "diff": "diff --git a/Makefile b/Makefile\nindex 81447b1..ec31ffa 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -414,6 +414,10 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \\\n $(SRC_PATH)/qapi/crypto.json $(SRC_PATH)/qapi/rocker.json \\\n $(SRC_PATH)/qapi/trace.json\n \n+ifdef CONFIG_VIRTFS\n+qapi-modules += $(SRC_PATH)/qapi/fsdev.json\n+endif\n+\n qapi-types.c qapi-types.h :\\\n $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)\n \t$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \\\ndiff --git a/fsdev/qemu-fsdev-dummy.c b/fsdev/qemu-fsdev-dummy.c\nindex 6dc0fbc..28c82d2 100644\n--- a/fsdev/qemu-fsdev-dummy.c\n+++ b/fsdev/qemu-fsdev-dummy.c\n@@ -14,8 +14,19 @@\n #include \"qemu-fsdev.h\"\n #include \"qemu/config-file.h\"\n #include \"qemu/module.h\"\n+#include \"qmp-commands.h\"\n \n int qemu_fsdev_add(QemuOpts *opts)\n {\n return 0;\n }\n+\n+void qmp_fsdev_set_io_throttle(IOThrottle *arg, Error **errp)\n+{\n+ return;\n+}\n+\n+IOThrottleList *qmp_query_fsdev_io_throttle(Error **errp)\n+{\n+ return NULL;\n+}\ndiff --git a/fsdev/qemu-fsdev-throttle.c b/fsdev/qemu-fsdev-throttle.c\nindex 0e6fb86..525352e 100644\n--- a/fsdev/qemu-fsdev-throttle.c\n+++ b/fsdev/qemu-fsdev-throttle.c\n@@ -16,6 +16,7 @@\n #include \"qemu/error-report.h\"\n #include \"qemu-fsdev-throttle.h\"\n #include \"qemu/iov.h\"\n+#include \"qemu/main-loop.h\"\n #include \"qemu/throttle-options.h\"\n \n static void fsdev_throttle_read_timer_cb(void *opaque)\n@@ -30,6 +31,141 @@ static void fsdev_throttle_write_timer_cb(void *opaque)\n qemu_co_enter_next(&fst->throttled_reqs[true]);\n }\n \n+typedef struct {\n+ FsThrottle *fst;\n+ bool is_write;\n+} RestartData;\n+\n+static bool coroutine_fn throttle_co_restart_queue(FsThrottle *fst,\n+ bool is_write)\n+{\n+ return qemu_co_queue_next(&fst->throttled_reqs[is_write]);\n+}\n+\n+static void schedule_next_request(FsThrottle *fst, bool is_write)\n+{\n+ bool must_wait = throttle_schedule_timer(&fst->ts, &fst->tt, is_write);\n+ if (!must_wait) {\n+ if (qemu_in_coroutine() &&\n+ throttle_co_restart_queue(fst, is_write)) {\n+ return;\n+ } else {\n+ int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);\n+ timer_mod(fst->tt.timers[is_write], now);\n+ }\n+ }\n+}\n+\n+static void coroutine_fn throttle_restart_queue_entry(void *opaque)\n+{\n+ RestartData *data = opaque;\n+ bool is_write = data->is_write;\n+ bool empty_queue = !throttle_co_restart_queue(data->fst, is_write);\n+ if (empty_queue) {\n+ schedule_next_request(data->fst, is_write);\n+ }\n+}\n+\n+static void throttle_restart_queues(FsThrottle *fst)\n+{\n+ Coroutine *co;\n+ RestartData rd = {\n+ .fst = fst,\n+ .is_write = true\n+ };\n+\n+ co = qemu_coroutine_create(throttle_restart_queue_entry, &rd);\n+ aio_co_enter(fst->ctx, co);\n+\n+ rd.is_write = false;\n+\n+ co = qemu_coroutine_create(throttle_restart_queue_entry, &rd);\n+ aio_co_enter(fst->ctx, co);\n+}\n+\n+static void coroutine_fn fsdev_throttle_config(FsThrottle *fst)\n+{\n+ if (throttle_enabled(&fst->cfg)) {\n+ throttle_config(&fst->ts, QEMU_CLOCK_REALTIME, &fst->cfg);\n+ } else {\n+ throttle_restart_queues(fst);\n+ }\n+}\n+\n+void fsdev_set_io_throttle(IOThrottle *arg, FsThrottle *fst, Error **errp)\n+{\n+ ThrottleConfig cfg;\n+\n+ throttle_set_io_limits(&cfg, arg);\n+\n+ if (throttle_is_valid(&cfg, errp)) {\n+ fst->cfg = cfg;\n+ fsdev_throttle_config(fst);\n+ }\n+}\n+\n+void fsdev_get_io_throttle(FsThrottle *fst, IOThrottle **fs9pcfg,\n+ char *fsdevice)\n+{\n+ ThrottleConfig cfg = fst->cfg;\n+ IOThrottle *fscfg = g_malloc0(sizeof(*fscfg));\n+\n+ fscfg->has_id = true;\n+ fscfg->id = g_strdup(fsdevice);\n+ fscfg->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg;\n+ fscfg->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg;\n+ fscfg->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg;\n+\n+ fscfg->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg;\n+ fscfg->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg;\n+ fscfg->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg;\n+\n+ fscfg->has_bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max;\n+ fscfg->bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max;\n+ fscfg->has_bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max;\n+ fscfg->bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max;\n+ fscfg->has_bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max;\n+ fscfg->bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max;\n+\n+ fscfg->has_iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max;\n+ fscfg->iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max;\n+ fscfg->has_iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max;\n+ fscfg->iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max;\n+ fscfg->has_iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max;\n+ fscfg->iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max;\n+\n+ fscfg->has_bps_max_length = fscfg->has_bps_max;\n+ fscfg->bps_max_length =\n+ cfg.buckets[THROTTLE_BPS_TOTAL].burst_length;\n+ fscfg->has_bps_rd_max_length = fscfg->has_bps_rd_max;\n+ fscfg->bps_rd_max_length =\n+ cfg.buckets[THROTTLE_BPS_READ].burst_length;\n+ fscfg->has_bps_wr_max_length = fscfg->has_bps_wr_max;\n+ fscfg->bps_wr_max_length =\n+ cfg.buckets[THROTTLE_BPS_WRITE].burst_length;\n+\n+ fscfg->has_iops_max_length = fscfg->has_iops_max;\n+ fscfg->iops_max_length =\n+ cfg.buckets[THROTTLE_OPS_TOTAL].burst_length;\n+ fscfg->has_iops_rd_max_length = fscfg->has_iops_rd_max;\n+ fscfg->iops_rd_max_length =\n+ cfg.buckets[THROTTLE_OPS_READ].burst_length;\n+ fscfg->has_iops_wr_max_length = fscfg->has_iops_wr_max;\n+ fscfg->iops_wr_max_length =\n+ cfg.buckets[THROTTLE_OPS_WRITE].burst_length;\n+\n+ fscfg->bps_max_length = cfg.buckets[THROTTLE_BPS_TOTAL].burst_length;\n+ fscfg->bps_rd_max_length = cfg.buckets[THROTTLE_BPS_READ].burst_length;\n+ fscfg->bps_wr_max_length = cfg.buckets[THROTTLE_BPS_WRITE].burst_length;\n+ fscfg->iops_max_length = cfg.buckets[THROTTLE_OPS_TOTAL].burst_length;\n+ fscfg->iops_rd_max_length = cfg.buckets[THROTTLE_OPS_READ].burst_length;\n+ fscfg->iops_wr_max_length = cfg.buckets[THROTTLE_OPS_WRITE].burst_length;\n+\n+ fscfg->iops_size = cfg.op_size;\n+\n+ *fs9pcfg = fscfg;\n+}\n+\n void fsdev_throttle_parse_opts(QemuOpts *opts, FsThrottle *fst, Error **errp)\n {\n throttle_parse_options(&fst->cfg, opts);\n@@ -40,8 +176,9 @@ void fsdev_throttle_init(FsThrottle *fst)\n {\n if (throttle_enabled(&fst->cfg)) {\n throttle_init(&fst->ts);\n+ fst->ctx = qemu_get_aio_context();\n throttle_timers_init(&fst->tt,\n- qemu_get_aio_context(),\n+ fst->ctx,\n QEMU_CLOCK_REALTIME,\n fsdev_throttle_read_timer_cb,\n fsdev_throttle_write_timer_cb,\n@@ -62,11 +199,7 @@ void coroutine_fn fsdev_co_throttle_request(FsThrottle *fst, bool is_write,\n }\n \n throttle_account(&fst->ts, is_write, iov_size(iov, iovcnt));\n-\n- if (!qemu_co_queue_empty(&fst->throttled_reqs[is_write]) &&\n- !throttle_schedule_timer(&fst->ts, &fst->tt, is_write)) {\n- qemu_co_queue_next(&fst->throttled_reqs[is_write]);\n- }\n+ schedule_next_request(fst, is_write);\n }\n }\n \ndiff --git a/fsdev/qemu-fsdev-throttle.h b/fsdev/qemu-fsdev-throttle.h\nindex e418643..bfeab40 100644\n--- a/fsdev/qemu-fsdev-throttle.h\n+++ b/fsdev/qemu-fsdev-throttle.h\n@@ -15,8 +15,6 @@\n #ifndef _FSDEV_THROTTLE_H\n #define _FSDEV_THROTTLE_H\n \n-#include \"block/aio.h\"\n-#include \"qemu/main-loop.h\"\n #include \"qemu/coroutine.h\"\n #include \"qapi/error.h\"\n #include \"qemu/throttle.h\"\n@@ -25,6 +23,7 @@ typedef struct FsThrottle {\n ThrottleState ts;\n ThrottleTimers tt;\n ThrottleConfig cfg;\n+ AioContext *ctx;\n CoQueue throttled_reqs[2];\n } FsThrottle;\n \n@@ -36,4 +35,10 @@ void coroutine_fn fsdev_co_throttle_request(FsThrottle *, bool ,\n struct iovec *, int);\n \n void fsdev_throttle_cleanup(FsThrottle *);\n+\n+void fsdev_set_io_throttle(IOThrottle *, FsThrottle *, Error **errp);\n+\n+void fsdev_get_io_throttle(FsThrottle *, IOThrottle **iothp,\n+ char *);\n+\n #endif /* _FSDEV_THROTTLE_H */\ndiff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c\nindex 266e442..0f701fc 100644\n--- a/fsdev/qemu-fsdev.c\n+++ b/fsdev/qemu-fsdev.c\n@@ -16,6 +16,7 @@\n #include \"qemu-common.h\"\n #include \"qemu/config-file.h\"\n #include \"qemu/error-report.h\"\n+#include \"qmp-commands.h\"\n \n static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries =\n QTAILQ_HEAD_INITIALIZER(fsdriver_entries);\n@@ -98,3 +99,32 @@ FsDriverEntry *get_fsdev_fsentry(char *id)\n }\n return NULL;\n }\n+\n+void qmp_fsdev_set_io_throttle(IOThrottle *arg, Error **errp)\n+{\n+\n+ FsDriverEntry *fse;\n+\n+ fse = get_fsdev_fsentry(arg->has_id ? arg->id : NULL);\n+ if (!fse) {\n+ error_setg(errp, \"Not a valid fsdev device\");\n+ return;\n+ }\n+\n+ fsdev_set_io_throttle(arg, &fse->fst, errp);\n+}\n+\n+IOThrottleList *qmp_query_fsdev_io_throttle(Error **errp)\n+{\n+ IOThrottleList *head = NULL, *p_next;\n+ struct FsDriverListEntry *fsle;\n+\n+ QTAILQ_FOREACH(fsle, &fsdriver_entries, next) {\n+ p_next = g_new0(IOThrottleList, 1);\n+ fsdev_get_io_throttle(&fsle->fse.fst, &p_next->value,\n+ fsle->fse.fsdev_id);\n+ p_next->next = head;\n+ head = p_next;\n+ }\n+ return head;\n+}\ndiff --git a/monitor.c b/monitor.c\nindex e0f8801..eebda1c 100644\n--- a/monitor.c\n+++ b/monitor.c\n@@ -998,6 +998,11 @@ static void qmp_unregister_commands_hack(void)\n && !defined(TARGET_S390X)\n qmp_unregister_command(&qmp_commands, \"query-cpu-definitions\");\n #endif\n+#ifndef CONFIG_VIRTFS\n+ qmp_unregister_command(&qmp_commands, \"fsdev-set-io-throttle\");\n+ qmp_unregister_command(&qmp_commands, \"query-fsdev-io-throttle\");\n+#endif\n+\n }\n \n void monitor_init_qmp_commands(void)\ndiff --git a/qapi-schema.json b/qapi-schema.json\nindex 802ea53..8cf8140 100644\n--- a/qapi-schema.json\n+++ b/qapi-schema.json\n@@ -81,6 +81,9 @@\n # QAPI block definitions\n { 'include': 'qapi/block.json' }\n \n+# QAPI fsdev definitions\n+{ 'include': 'qapi/fsdev.json' }\n+\n # QAPI event definitions\n { 'include': 'qapi/event.json' }\n \ndiff --git a/qapi/fsdev.json b/qapi/fsdev.json\nnew file mode 100644\nindex 0000000..21d074d\n--- /dev/null\n+++ b/qapi/fsdev.json\n@@ -0,0 +1,81 @@\n+# -*- Mode: Python -*-\n+\n+##\n+# == QAPI fsdev definitions\n+##\n+\n+##\n+# @fsdev-set-io-throttle:\n+#\n+# Change I/O limits for a 9p/fsdev device.\n+#\n+# I/O limits can be enabled by setting throttle value to non-zero number.\n+#\n+# I/O limits can be disabled by setting all throttle values to 0.\n+#\n+# Returns: Nothing on success\n+# If @device is not a valid fsdev device, GenericError\n+#\n+# Since: 2.10\n+#\n+# Example:\n+#\n+# -> { \"execute\": \"fsdev-set-io-throttle\",\n+# \"arguments\": { \"id\": \"id0-1-0\",\n+# \"bps\": 1000000,\n+# \"bps_rd\": 0,\n+# \"bps_wr\": 0,\n+# \"iops\": 0,\n+# \"iops_rd\": 0,\n+# \"iops_wr\": 0,\n+# \"bps_max\": 8000000,\n+# \"bps_rd_max\": 0,\n+# \"bps_wr_max\": 0,\n+# \"iops_max\": 0,\n+# \"iops_rd_max\": 0,\n+# \"iops_wr_max\": 0,\n+# \"bps_max_length\": 60,\n+# \"iops_size\": 0 } }\n+# <- { \"returns\": {} }\n+##\n+{ 'command': 'fsdev-set-io-throttle', 'boxed': true,\n+ 'data': 'IOThrottle' }\n+##\n+# @query-fsdev-io-throttle:\n+#\n+# Returns: a list of @IOThrottle describing I/O throttle\n+# values of each fsdev device\n+#\n+# Since: 2.10\n+#\n+# Example:\n+#\n+# -> { \"Execute\": \"query-fsdev-io-throttle\" }\n+# <- { \"returns\" : [\n+# {\n+# \"id\": \"id0-hd0\",\n+# \"bps\":1000000,\n+# \"bps_rd\":0,\n+# \"bps_wr\":0,\n+# \"iops\":1000000,\n+# \"iops_rd\":0,\n+# \"iops_wr\":0,\n+# \"bps_max\": 8000000,\n+# \"bps_rd_max\": 0,\n+# \"bps_wr_max\": 0,\n+# \"iops_max\": 0,\n+# \"iops_rd_max\": 0,\n+# \"iops_wr_max\": 0,\n+# \"bps_max_length\": 0,\n+# \"bps_rd_max_length\": 0,\n+# \"bps_wr_max_length\": 0,\n+# \"iops_max_length\": 0,\n+# \"iops_rd_max_length\": 0,\n+# \"iops_wr_max_length\": 0,\n+# \"iops_size\": 0\n+# }\n+# ]\n+# }\n+#\n+##\n+{ 'command': 'query-fsdev-io-throttle', 'returns': [ 'IOThrottle' ] }\ndiff --git a/qmp.c b/qmp.c\nindex b86201e..eed91e5 100644\n--- a/qmp.c\n+++ b/qmp.c\n@@ -130,6 +130,20 @@ void qmp_cpu_add(int64_t id, Error **errp)\n }\n }\n \n+#if defined(_WIN64) || defined(_WIN32) || defined(__FreeBSD__)\n+\n+void qmp_fsdev_set_io_throttle(IOThrottle *arg, Error **errp)\n+{\n+ return;\n+}\n+\n+IOThrottleList *qmp_query_fsdev_io_throttle(Error **errp)\n+{\n+ return NULL;\n+}\n+\n+#endif\n+\n #ifndef CONFIG_VNC\n /* If VNC support is enabled, the \"true\" query-vnc command is\n defined in the VNC subsystem */\n", "prefixes": [ "v10", "5/6" ] }