{"id":813773,"url":"http://patchwork.ozlabs.org/api/patches/813773/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1505385610-35529-5-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-5-git-send-email-pradeep.jagadeesh@huawei.com>","list_archive_url":null,"date":"2017-09-14T10:40:08","name":"[v11,4/6] hmp: create a throttle initialization function for code reuse","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"62b4f8a2a7ec58d96294c866ece284f49976f417","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-5-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/813773/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813773/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=\"n+MKWcMW\"; 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 3xtFYN4P1Lz9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 20:45:28 +1000 (AEST)","from localhost ([::1]:46885 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 1dsReA-0002zq-On\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 06:45:26 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:52248)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dsRZk-0006rt-CR\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:53 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dsRZe-0001yk-FH\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:52 -0400","from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33548)\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 1dsRZe-0001xd-3v\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:46 -0400","by mail-wr0-x244.google.com with SMTP id b9so1474740wra.0\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.44\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 14 Sep 2017 03:40:44 -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=ScPvH4Obbnvmv7xQmJQ5gebpCp1S8MORUcIB7ELURNk=;\n\tb=n+MKWcMW+luSQf0Nr5S7IzZLCZuENZaMAMYeOPvR0F/8kMOPjbh0XIlU0CpPPkIAbH\n\tjrIQVhuvqVYaY635eOS3Kch+1hnCf9q3V+ldgXcY57emziX/M1KdhGphwJVc9wHFoCDO\n\t0dqavPo/BG1wXx/KG5SAwJ6YPmPmpo/yktpTsSaPqyrqAtVprqgnW8JfkMZtvkW+Lz9e\n\tOGzJ4S45PdGhcJXUI7nZjSg57keyDsBeyH+uBnZaIBCq5xRvbFmzV7fajsS1HfzV8Z2E\n\tPA9VmTP8lMLXE9/OUur6xSGfs7gDEpl71UolMAAsbkWfnY3xHRmRyuOBeZqK8CeLq+U8\n\ttMOA==","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=ScPvH4Obbnvmv7xQmJQ5gebpCp1S8MORUcIB7ELURNk=;\n\tb=rGlcv86zXnJztXiEi6KIMHxmnju6eNbygmRg/9RcEV7Yn/chUzyuxDM1pleIYFhvIn\n\t49+hAC7CaOUbjDG6J30iWwYK7DdnwQ3kbtcZ1k7N9aFyUMrZ5pgVlU6vo8tVpYERKHmF\n\tBWpp5w5fC9ygxqXYqptESPfMJmz93CpiIQPa6CzBrA7FtvmW5EKSxYlyGTSrsIERlHAQ\n\tCPPZdH1qYl56q6yuyYyfWvY+C5YAjFU9pRq3fN7IeJ20paYUXSxjn9htsvnkXkcv7u56\n\tyUOFtRAWN5Hu84IO3j02Ba5FZQP7EwtHxhfSwl+FwV1wilpr6ie6JTL5lfvv+GhPZwXq\n\t43Vg==","X-Gm-Message-State":"AHPjjUjhBMmjEg9aTB1fC2t6ps1/7UVCv2MV7UkPJOO7D6oW3SKNVE3p\n\t43lTaKJlPFIjnA==","X-Google-Smtp-Source":"ADKCNb4/NW9EiKAouna483H+g0/SPigqd0t8heOCvuXwVCqgRhyB7l6a6DwrXU9RMXYQvEtKU/ikRA==","X-Received":"by 10.223.172.228 with SMTP id\n\to91mr17060830wrc.259.1505385645092; \n\tThu, 14 Sep 2017 03:40:45 -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:08 -0400","Message-Id":"<1505385610-35529-5-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 4/6] hmp: create a throttle initialization\n\tfunction for code reuse","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 creates a throttle initialization function to maximize the\ncode reusability. The same code is also used by fsdev.\n\nSigned-off-by: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>\nReviewed-by: Alberto Garcia <berto@igalia.com>\nReviewed-by: Greg Kurz <groug@kaod.org>\nAcked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>\n---\n hmp.c | 20 ++++++++++++++------\n 1 file changed, 14 insertions(+), 6 deletions(-)","diff":"diff --git a/hmp.c b/hmp.c\nindex cd046c6..acaf0e6 100644\n--- a/hmp.c\n+++ b/hmp.c\n@@ -1752,20 +1752,28 @@ void hmp_change(Monitor *mon, const QDict *qdict)\n     hmp_handle_error(mon, &err);\n }\n \n+static void hmp_initialize_throttle_limits(ThrottleLimits *iot,\n+                                           const QDict *qdict)\n+{\n+    iot->bps_total = qdict_get_int(qdict, \"bps\");\n+    iot->bps_read = qdict_get_int(qdict, \"bps_rd\");\n+    iot->bps_write = qdict_get_int(qdict, \"bps_wr\");\n+    iot->iops_total = qdict_get_int(qdict, \"iops\");\n+    iot->iops_read = qdict_get_int(qdict, \"iops_rd\");\n+    iot->iops_write = qdict_get_int(qdict, \"iops_wr\");\n+}\n+\n void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict)\n {\n     Error *err = NULL;\n+    ThrottleLimits *tlimits;\n     BlockIOThrottle throttle = {\n         .has_device = true,\n         .device = (char *) qdict_get_str(qdict, \"device\"),\n-        .bps = qdict_get_int(qdict, \"bps\"),\n-        .bps_rd = qdict_get_int(qdict, \"bps_rd\"),\n-        .bps_wr = qdict_get_int(qdict, \"bps_wr\"),\n-        .iops = qdict_get_int(qdict, \"iops\"),\n-        .iops_rd = qdict_get_int(qdict, \"iops_rd\"),\n-        .iops_wr = qdict_get_int(qdict, \"iops_wr\"),\n     };\n \n+    tlimits = qapi_BlockIOThrottle_base(&throttle);\n+    hmp_initialize_throttle_limits(tlimits, qdict);\n     qmp_block_set_io_throttle(&throttle, &err);\n     hmp_handle_error(mon, &err);\n }\n","prefixes":["v11","4/6"]}