[{"id":1768522,"web_url":"http://patchwork.ozlabs.org/comment/1768522/","msgid":"<20170914132200.6d9dd860@bahia.lan>","list_archive_url":null,"date":"2017-09-14T11:22:00","subject":"Re: [Qemu-devel] [PATCH v11 3/6] qmp: factor out throttle code to\n\treuse code","submitter":{"id":69178,"url":"http://patchwork.ozlabs.org/api/people/69178/","name":"Greg Kurz","email":"groug@kaod.org"},"content":"On Thu, 14 Sep 2017 06:40:07 -0400\nPradeep Jagadeesh <pradeepkiruvale@gmail.com> wrote:\n\n> This patch reuses the code to set throttle limits.\n> \n> Signed-off-by: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>\n> Reviewed-by: Alberto Garcia <berto@igalia.com>\n> Reviewed-by: Greg Kurz <groug@kaod.org>\n> ---\n>  blockdev.c | 53 +++--------------------------------------------------\n\nSame remarks as for the previous patch...\n\n>  1 file changed, 3 insertions(+), 50 deletions(-)\n> \n> diff --git a/blockdev.c b/blockdev.c\n> index 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;","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>)","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 3xtGNT69LZz9sPs\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 21:22:49 +1000 (AEST)","from localhost ([::1]:46997 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 1dsSEJ-0006fY-UY\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 07:22:47 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:44493)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1dsSDl-0006aG-E5\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 07:22:14 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1dsSDh-00076r-6b\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 07:22:13 -0400","from 2.mo2.mail-out.ovh.net ([188.165.53.149]:45109)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <groug@kaod.org>) id 1dsSDg-00075P-Vs\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 07:22:09 -0400","from player770.ha.ovh.net (b6.ovh.net [213.186.33.56])\n\tby mo2.mail-out.ovh.net (Postfix) with ESMTP id BB080AA975\n\tfor <qemu-devel@nongnu.org>; Thu, 14 Sep 2017 13:22:07 +0200 (CEST)","from bahia.lan (gar31-1-82-66-74-139.fbx.proxad.net [82.66.74.139])\n\t(Authenticated sender: groug@kaod.org)\n\tby player770.ha.ovh.net (Postfix) with ESMTPSA id 4888E3C006A;\n\tThu, 14 Sep 2017 13:22:01 +0200 (CEST)"],"Date":"Thu, 14 Sep 2017 13:22:00 +0200","From":"Greg Kurz <groug@kaod.org>","To":"Pradeep Jagadeesh <pradeepkiruvale@gmail.com>","Message-ID":"<20170914132200.6d9dd860@bahia.lan>","In-Reply-To":"<1505385610-35529-4-git-send-email-pradeep.jagadeesh@huawei.com>","References":"<1505385610-35529-1-git-send-email-pradeep.jagadeesh@huawei.com>\n\t<1505385610-35529-4-git-send-email-pradeep.jagadeesh@huawei.com>","X-Mailer":"Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu)","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha1;\n\tboundary=\"Sig_/L+cPxva5Yk+RHB=FUZCik8u\";\n\tprotocol=\"application/pgp-signature\"","X-Ovh-Tracer-Id":"7376614718019508699","X-VR-SPAMSTATE":"OK","X-VR-SPAMSCORE":"-100","X-VR-SPAMCAUSE":"gggruggvucftvghtrhhoucdtuddrfeelledrgeeigdegudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"188.165.53.149","Subject":"Re: [Qemu-devel] [PATCH v11 3/6] qmp: factor out throttle code to\n\treuse 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":"alberto garcia <berto@igalia.com>, qemu-devel@nongnu.org,\n\tMarkus Armbruster <armbru@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>"}}]