{"id":807106,"url":"http://patchwork.ozlabs.org/api/1.0/patches/807106/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/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":""},"msgid":"<1504016587-39779-5-git-send-email-pradeep.jagadeesh@huawei.com>","date":"2017-08-29T14:23:05","name":"[v8,4/6] hmp: create a throttle initialization function for code reusability","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"efbdee8fb33fe7cf85860113c4e2251a10456fda","submitter":{"id":69852,"url":"http://patchwork.ozlabs.org/api/1.0/people/69852/?format=json","name":"Pradeep Jagadeesh","email":"pradeepkiruvale@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1504016587-39779-5-git-send-email-pradeep.jagadeesh@huawei.com/mbox/","series":[{"id":377,"url":"http://patchwork.ozlabs.org/api/1.0/series/377/?format=json","date":"2017-08-29T14:23:01","name":"fsdev: qmp interface for io throttling","version":8,"mbox":"http://patchwork.ozlabs.org/series/377/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807106/checks/","tags":{},"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=\"JsVqTBMp\"; 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 3xhWB46bt3z9t16\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 00:25:00 +1000 (AEST)","from localhost ([::1]:45213 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 1dmhRq-0001pO-NX\n\tfor incoming@patchwork.ozlabs.org; Tue, 29 Aug 2017 10:24:58 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:53742)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dmhR2-0001jX-Sr\n\tfor qemu-devel@nongnu.org; Tue, 29 Aug 2017 10:24:14 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dmhQw-0004EE-NP\n\tfor qemu-devel@nongnu.org; Tue, 29 Aug 2017 10:24:08 -0400","from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:35524)\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 1dmhQw-0004Ds-Gc\n\tfor qemu-devel@nongnu.org; Tue, 29 Aug 2017 10:24:02 -0400","by mail-wr0-x242.google.com with SMTP id a47so2408636wra.2\n\tfor <qemu-devel@nongnu.org>; Tue, 29 Aug 2017 07:24:02 -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.24.00\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=0A09PHsWtkbl3qVkFa3DyhICvvM1yY42z7IfzxkBSHc=;\n\tb=JsVqTBMpmv8qgloIEkIoVGScrr5ln1MueQhLRew3dEk/jP+a62yeF/tQJPhAaiiYbA\n\tJON2CnkM8Wsv1++w8GnKOkJArWizy75XXizxZF+WgFk01TTQncZKPYc2EfiiFrELjcPM\n\trI1fxXOPpHctZ9zFWnIhZFyYJSXa0KUvsROMP2O8dMLEHF4ZiW0joiSlnOBA3LlTSrfQ\n\t8LOv75LXqskuEaC/PeS9jDN9dG2wZmg7g9HjJgtE2ROMFRT1d0iX8tPHApn3T/LWN2AP\n\t5ribI63krdPHsooKxw5bFeSI1AjP3Z78BmIe8499LhIvIPTG9fufruEXm21792LdinhD\n\t+UpA==","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=0A09PHsWtkbl3qVkFa3DyhICvvM1yY42z7IfzxkBSHc=;\n\tb=fCsVCNRabKZIZkGYjyD5Ey76kqeGa0hY9drwKyAivxS5YrnrwbVxul7XJoePIY4pfC\n\t2MLoioCv1bL9pRns+wKaWsd2RZYZh3Rby39YgNFn3Ys5oFCpOxtF8O8L7OaYAi6SQoo6\n\tx/W6ElmqyWA4N8LrAWSpxnkN+9ENWqC3cnFFzPhozQ0yCubAzNMTWq7KRBrdGxKVEmNU\n\tjl2TokdJozRCdhVgWvWcToe4tVr4OxWoxnCsqZEpUOJk6WcCNydi1zzxgdgLNV3LNA68\n\tN1DrxGxOP0osHQUNK62gQfLwcUVOkyj3LIS2U4uOTH2HUbDynJLFGBDORSAtT9lj3ty8\n\tvgQg==","X-Gm-Message-State":"AHYfb5jM+uFLU5+eRPsLhHSN4hSIyVeZmxp2ovXbnJJVTyzyMBJlEedL\n\tNCV7Px+v7vcFkRsylS8=","X-Received":"by 10.223.142.245 with SMTP id q108mr344641wrb.2.1504016641533; \n\tTue, 29 Aug 2017 07:24:01 -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:05 -0400","Message-Id":"<1504016587-39779-5-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::242","Subject":"[Qemu-devel] [PATCH v8 4/6] hmp: create a throttle initialization\n\tfunction for code reusability","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\nAcked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>\nSigned-off-by: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>\n---\n hmp.c | 19 +++++++++++++------\n 1 file changed, 13 insertions(+), 6 deletions(-)","diff":"diff --git a/hmp.c b/hmp.c\nindex fd80dce..2dbfb80 100644\n--- a/hmp.c\n+++ b/hmp.c\n@@ -1758,20 +1758,27 @@ void hmp_change(Monitor *mon, const QDict *qdict)\n     hmp_handle_error(mon, &err);\n }\n \n+static void hmp_initialize_io_throttle(IOThrottle *iot, const QDict *qdict)\n+{\n+    iot->bps = qdict_get_int(qdict, \"bps\");\n+    iot->bps_rd = qdict_get_int(qdict, \"bps_rd\");\n+    iot->bps_wr = qdict_get_int(qdict, \"bps_wr\");\n+    iot->iops = qdict_get_int(qdict, \"iops\");\n+    iot->iops_rd = qdict_get_int(qdict, \"iops_rd\");\n+    iot->iops_wr = 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+    IOThrottle *iothrottle;\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+    iothrottle = qapi_BlockIOThrottle_base(&throttle);\n+    hmp_initialize_io_throttle(iothrottle, qdict);\n     qmp_block_set_io_throttle(&throttle, &err);\n     hmp_handle_error(mon, &err);\n }\n","prefixes":["v8","4/6"]}