Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807105/?format=api
{ "id": 807105, "url": "http://patchwork.ozlabs.org/api/patches/807105/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1504016587-39779-4-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": "<1504016587-39779-4-git-send-email-pradeep.jagadeesh@huawei.com>", "list_archive_url": null, "date": "2017-08-29T14:23:04", "name": "[v8,3/6] throttle: move out function to reuse the code", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "9397c377b6f8ae4707abdbb75e40e5c6ae398a16", "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/1504016587-39779-4-git-send-email-pradeep.jagadeesh@huawei.com/mbox/", "series": [ { "id": 377, "url": "http://patchwork.ozlabs.org/api/series/377/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=377", "date": "2017-08-29T14:23:01", "name": "fsdev: qmp interface for io throttling", "version": 8, "mbox": "http://patchwork.ozlabs.org/series/377/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807105/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807105/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=\"O1+B3GvI\"; 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 3xhWB3406sz9t3P\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 00:24:59 +1000 (AEST)", "from localhost ([::1]:45212 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 1dmhRp-0001ns-CG\n\tfor incoming@patchwork.ozlabs.org; Tue, 29 Aug 2017 10:24:57 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:53686)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dmhQx-0001g3-JK\n\tfor qemu-devel@nongnu.org; Tue, 29 Aug 2017 10:24:04 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dmhQv-0004Do-US\n\tfor qemu-devel@nongnu.org; Tue, 29 Aug 2017 10:24:03 -0400", "from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33294)\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 1dmhQv-0004DS-Ke\n\tfor qemu-devel@nongnu.org; Tue, 29 Aug 2017 10:24:01 -0400", "by mail-wr0-x244.google.com with SMTP id k94so2410554wrc.0\n\tfor <qemu-devel@nongnu.org>; Tue, 29 Aug 2017 07:24:01 -0700 (PDT)", "from localhost.localdomain.localdomain ([217.110.131.66])\n\tby smtp.gmail.com with ESMTPSA id\n\t15sm2540487wmv.45.2017.08.29.07.23.59\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 29 Aug 2017 07:24:00 -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=rzDROED0CTzRR0Srkya+UDdqlCvGx1/jjY45f0aZWqU=;\n\tb=O1+B3GvIXV2Evsx5k46yWl/h5nLF+pE0jdKh1N4Ng1ytqW16wRLGl41KW7bwWRZGvB\n\tyTyOkX9i687uZWr4Ln2CCubPRGnb6E+PbqBFEAUaYxeSw705u4IwhWUqjxe75gL7yk8z\n\t3X8j+lKPJHxtxTISRm0nSbw3Sk/endyR6jvCRVSvAPDHLCRBRSQtWJ3aoaFx8U4T4mEI\n\tpGamvbb59inPDySHv4kmpeWr0xs2hE6Te7D2Og5jru8RWZewYADohKbHwVNhgxqi/lCZ\n\tQt8/ZFkyEQtAWMakh4L1s0QK96mEvrBbwoIqdHx5w0Zk8yGDMMP6nWjboiK1N2eZNe18\n\tqCKA==", "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=rzDROED0CTzRR0Srkya+UDdqlCvGx1/jjY45f0aZWqU=;\n\tb=Su1LK5eqLaOav3ZdfDUYHX87qVUmxxSnGATVvMmkld+MYH9+5xq8aBUmZv7koSPKzz\n\tvEZd6KYRV/6KKNI4Kr57AVWoVcae/IypqY70x1SCBAHwV9EZhYVR8Df8o6Rn9az3jVe6\n\t9qz1sDAzhqJoiGqBk6Tt4HUqLNnxPrXclNuF/6woMG3Ulqzr5bOP4oEyz1uMsjACk+UU\n\tTt3wGjxZxcMWbvjKlVV55EMgTzdtalF27s7LNxtOW3QNS9MJWPOGXflr8kpso8VRbpK4\n\t26HsjgtXNgjNmAZ+QwDdHS7PmmstYStZK88LsGU6LQJfMIc9Wq5UtofT11qCVzi7rCJ5\n\tPXbQ==", "X-Gm-Message-State": "AHYfb5jNS2BZOJJVyGIo9vIp4P5sa4ahVFQu6C/g58fVNnGz+ryZwJEr\n\t5+/+BCK9tWpK4w==", "X-Received": "by 10.223.184.187 with SMTP id i56mr324055wrf.323.1504016640544; \n\tTue, 29 Aug 2017 07:24:00 -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": "Tue, 29 Aug 2017 10:23:04 -0400", "Message-Id": "<1504016587-39779-4-git-send-email-pradeep.jagadeesh@huawei.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1504016587-39779-1-git-send-email-pradeep.jagadeesh@huawei.com>", "References": "<1504016587-39779-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:c0c::244", "Subject": "[Qemu-devel] [PATCH v8 3/6] throttle: move out function to reuse\n\tthe code", "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\tMarkus Armbruster <armbru@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 move out the throttle code to util/throttle.c to maximize\nthe reusability of the code.The same code is also used by fsdev.\n\nSigned-off-by: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>\n---\n blockdev.c | 53 +++---------------------------------\n include/qemu/throttle-options.h | 3 +++\n util/throttle.c | 59 +++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 65 insertions(+), 50 deletions(-)", "diff": "diff --git a/blockdev.c b/blockdev.c\nindex 780ae58..1caf2e0 100644\n--- a/blockdev.c\n+++ b/blockdev.c\n@@ -2571,6 +2571,7 @@ void qmp_block_set_io_throttle(BlockIOThrottle *arg, Error **errp)\n BlockDriverState *bs;\n BlockBackend *blk;\n AioContext *aio_context;\n+ IOThrottle *iothrottle;\n \n blk = qmp_get_blk(arg->has_device ? arg->device : NULL,\n arg->has_id ? arg->id : NULL,\n@@ -2588,56 +2589,8 @@ void qmp_block_set_io_throttle(BlockIOThrottle *arg, Error **errp)\n goto out;\n }\n \n- throttle_config_init(&cfg);\n- cfg.buckets[THROTTLE_BPS_TOTAL].avg = arg->bps;\n- cfg.buckets[THROTTLE_BPS_READ].avg = arg->bps_rd;\n- cfg.buckets[THROTTLE_BPS_WRITE].avg = arg->bps_wr;\n-\n- cfg.buckets[THROTTLE_OPS_TOTAL].avg = arg->iops;\n- cfg.buckets[THROTTLE_OPS_READ].avg = arg->iops_rd;\n- cfg.buckets[THROTTLE_OPS_WRITE].avg = arg->iops_wr;\n-\n- if (arg->has_bps_max) {\n- cfg.buckets[THROTTLE_BPS_TOTAL].max = arg->bps_max;\n- }\n- if (arg->has_bps_rd_max) {\n- cfg.buckets[THROTTLE_BPS_READ].max = arg->bps_rd_max;\n- }\n- if (arg->has_bps_wr_max) {\n- cfg.buckets[THROTTLE_BPS_WRITE].max = arg->bps_wr_max;\n- }\n- if (arg->has_iops_max) {\n- cfg.buckets[THROTTLE_OPS_TOTAL].max = arg->iops_max;\n- }\n- if (arg->has_iops_rd_max) {\n- cfg.buckets[THROTTLE_OPS_READ].max = arg->iops_rd_max;\n- }\n- if (arg->has_iops_wr_max) {\n- cfg.buckets[THROTTLE_OPS_WRITE].max = arg->iops_wr_max;\n- }\n-\n- if (arg->has_bps_max_length) {\n- cfg.buckets[THROTTLE_BPS_TOTAL].burst_length = arg->bps_max_length;\n- }\n- if (arg->has_bps_rd_max_length) {\n- cfg.buckets[THROTTLE_BPS_READ].burst_length = arg->bps_rd_max_length;\n- }\n- if (arg->has_bps_wr_max_length) {\n- cfg.buckets[THROTTLE_BPS_WRITE].burst_length = arg->bps_wr_max_length;\n- }\n- if (arg->has_iops_max_length) {\n- cfg.buckets[THROTTLE_OPS_TOTAL].burst_length = arg->iops_max_length;\n- }\n- if (arg->has_iops_rd_max_length) {\n- cfg.buckets[THROTTLE_OPS_READ].burst_length = arg->iops_rd_max_length;\n- }\n- if (arg->has_iops_wr_max_length) {\n- cfg.buckets[THROTTLE_OPS_WRITE].burst_length = arg->iops_wr_max_length;\n- }\n-\n- if (arg->has_iops_size) {\n- cfg.op_size = arg->iops_size;\n- }\n+ iothrottle = qapi_BlockIOThrottle_base(arg);\n+ throttle_set_io_limits(&cfg, iothrottle);\n \n if (!throttle_is_valid(&cfg, errp)) {\n goto out;\ndiff --git a/include/qemu/throttle-options.h b/include/qemu/throttle-options.h\nindex f63d38c..a9deb8e 100644\n--- a/include/qemu/throttle-options.h\n+++ b/include/qemu/throttle-options.h\n@@ -11,6 +11,7 @@\n #define THROTTLE_OPTIONS_H\n \n #include \"typedefs.h\"\n+#include \"qapi-types.h\"\n \n #define THROTTLE_OPTS \\\n { \\\n@@ -93,4 +94,6 @@\n \n void throttle_parse_options(ThrottleConfig *, QemuOpts *);\n \n+void throttle_set_io_limits(ThrottleConfig *, IOThrottle *);\n+\n #endif\ndiff --git a/util/throttle.c b/util/throttle.c\nindex 95c2ecf..2d00532 100644\n--- a/util/throttle.c\n+++ b/util/throttle.c\n@@ -553,3 +553,62 @@ void throttle_parse_options(ThrottleConfig *throttle_cfg, QemuOpts *opts)\n throttle_cfg->op_size =\n qemu_opt_get_number(opts, \"throttling.iops-size\", 0);\n }\n+\n+/* set the throttle limits\n+ *\n+ * @arg: iothrottle limits\n+ * @cfg: throttle configuration\n+ */\n+void throttle_set_io_limits(ThrottleConfig *cfg, IOThrottle *arg)\n+{\n+ throttle_config_init(cfg);\n+ cfg->buckets[THROTTLE_BPS_TOTAL].avg = arg->bps;\n+ cfg->buckets[THROTTLE_BPS_READ].avg = arg->bps_rd;\n+ cfg->buckets[THROTTLE_BPS_WRITE].avg = arg->bps_wr;\n+\n+ cfg->buckets[THROTTLE_OPS_TOTAL].avg = arg->iops;\n+ cfg->buckets[THROTTLE_OPS_READ].avg = arg->iops_rd;\n+ cfg->buckets[THROTTLE_OPS_WRITE].avg = arg->iops_wr;\n+\n+ if (arg->has_bps_max) {\n+ cfg->buckets[THROTTLE_BPS_TOTAL].max = arg->bps_max;\n+ }\n+ if (arg->has_bps_rd_max) {\n+ cfg->buckets[THROTTLE_BPS_READ].max = arg->bps_rd_max;\n+ }\n+ if (arg->has_bps_wr_max) {\n+ cfg->buckets[THROTTLE_BPS_WRITE].max = arg->bps_wr_max;\n+ }\n+ if (arg->has_iops_max) {\n+ cfg->buckets[THROTTLE_OPS_TOTAL].max = arg->iops_max;\n+ }\n+ if (arg->has_iops_rd_max) {\n+ cfg->buckets[THROTTLE_OPS_READ].max = arg->iops_rd_max;\n+ }\n+ if (arg->has_iops_wr_max) {\n+ cfg->buckets[THROTTLE_OPS_WRITE].max = arg->iops_wr_max;\n+ }\n+\n+ if (arg->has_bps_max_length) {\n+ cfg->buckets[THROTTLE_BPS_TOTAL].burst_length = arg->bps_max_length;\n+ }\n+ if (arg->has_bps_rd_max_length) {\n+ cfg->buckets[THROTTLE_BPS_READ].burst_length = arg->bps_rd_max_length;\n+ }\n+ if (arg->has_bps_wr_max_length) {\n+ cfg->buckets[THROTTLE_BPS_WRITE].burst_length = arg->bps_wr_max_length;\n+ }\n+ if (arg->has_iops_max_length) {\n+ cfg->buckets[THROTTLE_OPS_TOTAL].burst_length = arg->iops_max_length;\n+ }\n+ if (arg->has_iops_rd_max_length) {\n+ cfg->buckets[THROTTLE_OPS_READ].burst_length = arg->iops_rd_max_length;\n+ }\n+ if (arg->has_iops_wr_max_length) {\n+ cfg->buckets[THROTTLE_OPS_WRITE].burst_length = arg->iops_wr_max_length;\n+ }\n+\n+ if (arg->has_iops_size) {\n+ cfg->op_size = arg->iops_size;\n+ }\n+}\n", "prefixes": [ "v8", "3/6" ] }