{"id":813769,"url":"http://patchwork.ozlabs.org/api/patches/813769/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1505385610-35529-4-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-4-git-send-email-pradeep.jagadeesh@huawei.com>","list_archive_url":null,"date":"2017-09-14T10:40:07","name":"[v11,3/6] qmp: factor out throttle code to reuse code","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"50f77cd172f6c1280ae6e1aa007edb8701bfa6f8","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-4-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/813769/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813769/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=\"mmancngt\"; 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 3xtFSq2CzFz9sDB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 20:41:31 +1000 (AEST)","from localhost ([::1]:46867 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 1dsRaL-0006u8-Bz\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 06:41:29 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:52194)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dsRZi-0006pz-15\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 1dsRZd-0001xp-OK\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:50 -0400","from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:37356)\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 1dsRZd-0001wd-DV\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:45 -0400","by mail-wr0-x244.google.com with SMTP id u48so1465652wrf.4\n\tfor <qemu-devel@nongnu.org>; Thu, 14 Sep 2017 03:40:45 -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.43\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 14 Sep 2017 03:40:43 -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=D8G1QRbFFpH0lZ2paMxJ5yLCN5Sk1RphI2r5zE6ycjY=;\n\tb=mmancngt8wxn4gzZn6jEqdkYdAD/4fjB9GXztfBRyQISXAgDGjhkEVdM3ADgPrilYK\n\taO7cr1vfCWQCFUT3zE++D8r0+iQuFABstpBOWpjSNZTBByw105QWfeGInhA6giSN1zfr\n\t4vbTuy83NJGU/zchIseNQfXF9MOMVWQzdLeWy8AnIok5PwWiNEjbmOi6Z5qISQrRnoH+\n\tnn3OSqdMnBRtOxsPdnaUA1CDpX2imRz9tNwY4nbIEi7jE6foFES0aTNlE6yFwgwoIkI2\n\tEofK5ZEzdy2UtT6YqZdsRkuut2HqMEq1l6ZBFEZvog4qy9Vj6C+FUPjDJRE2hitOHbt8\n\t3sDA==","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=D8G1QRbFFpH0lZ2paMxJ5yLCN5Sk1RphI2r5zE6ycjY=;\n\tb=rxfhp+7c1MeRLZU240UHIs1X89TWuZo27i4LsxOxfJoz39eTc/2Ndy1am8CA4lkZCx\n\t6WKNpKwg6qCDxrR+E+tGUOnxxFjwHhgXfr1i2scVdSWO0870QbJR+PU4u6py+5vgQiR5\n\tgKGEyyYoXhetj9NxSpg75NZhlVidYxBiLOkoTSwUTjqcebGQ5bQoOkb8V3Ck8PxOmQZ/\n\t+vPaizamkB88bl4ZzPIlLEs4WonX5G+cDeQiL0vcGkgYrJvx0HEV6UOCUWFpi4rbMDub\n\t6aj+gkPrpiTzCVAoD9oIbkn74qd1SplcTfb6ZaPb2qzLL/XVABDbIzewBUKyXcsTeAmx\n\t9Bjw==","X-Gm-Message-State":"AHPjjUhoQNkY2fBXc+GTiJKyxKxj9hyz/QOlFE7VU5mJp9kp9xa0ejK8\n\t0shR4XihZQ9+Gg==","X-Google-Smtp-Source":"ADKCNb4dG2ZoDsZqq7Gw1NQqkbbUheuVAaNBHQd1UmJh+JxObulCFGV2AunBX9yJGThMEgTWQqxWxA==","X-Received":"by 10.223.136.170 with SMTP id\n\tf39mr17693803wrf.164.1505385644286; \n\tThu, 14 Sep 2017 03:40:44 -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:07 -0400","Message-Id":"<1505385610-35529-4-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:c0c::244","Subject":"[Qemu-devel] [PATCH v11 3/6] qmp: factor out throttle code to reuse\n\tcode","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 reuses the code to set throttle limits.\n\nSigned-off-by: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>\nReviewed-by: Alberto Garcia <berto@igalia.com>\nReviewed-by: Greg Kurz <groug@kaod.org>\n---\n blockdev.c | 53 +++--------------------------------------------------\n 1 file changed, 3 insertions(+), 50 deletions(-)","diff":"diff --git a/blockdev.c b/blockdev.c\nindex 9d33c25..2bd8ebd 100644\n--- a/blockdev.c\n+++ b/blockdev.c\n@@ -2569,6 +2569,7 @@ void qmp_block_set_io_throttle(BlockIOThrottle *arg, Error **errp)\n     BlockDriverState *bs;\n     BlockBackend *blk;\n     AioContext *aio_context;\n+    ThrottleLimits *tlimit;\n \n     blk = qmp_get_blk(arg->has_device ? arg->device : NULL,\n                       arg->has_id ? arg->id : NULL,\n@@ -2586,56 +2587,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+    tlimit = qapi_BlockIOThrottle_base(arg);\n+    throttle_config_to_limits(&cfg, tlimit);\n \n     if (!throttle_is_valid(&cfg, errp)) {\n         goto out;\n","prefixes":["v11","3/6"]}