{"id":809758,"url":"http://patchwork.ozlabs.org/api/1.0/patches/809758/?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":"<1504541267-36954-5-git-send-email-pradeep.jagadeesh@huawei.com>","date":"2017-09-04T16:07:45","name":"[v10,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/1504541267-36954-5-git-send-email-pradeep.jagadeesh@huawei.com/mbox/","series":[{"id":1415,"url":"http://patchwork.ozlabs.org/api/1.0/series/1415/?format=json","date":"2017-09-04T16:07:42","name":"fsdev: qmp interface for io throttling","version":10,"mbox":"http://patchwork.ozlabs.org/series/1415/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809758/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=208.118.235.17; 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=\"dUdLz7Qf\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [208.118.235.17])\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 3xmFLT05RNz9s7m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 02:15:13 +1000 (AEST)","from localhost ([::1]:54766 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 1dou1l-0003eD-UK\n\tfor incoming@patchwork.ozlabs.org; Mon, 04 Sep 2017 12:15:09 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:46902)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dotvL-0007LT-67\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:36 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dotvG-0008S2-Iv\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:31 -0400","from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:37924)\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 1dotvG-0008Ro-CW\n\tfor qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:26 -0400","by mail-wm0-x244.google.com with SMTP id u26so699764wma.5\n\tfor <qemu-devel@nongnu.org>; Mon, 04 Sep 2017 09:08:26 -0700 (PDT)","from localhost.localdomain.localdomain ([217.110.131.66])\n\tby smtp.gmail.com with ESMTPSA id\n\tx67sm976582wma.7.2017.09.04.09.08.24\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 04 Sep 2017 09:08:24 -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=dUdLz7Qf1+uBCRVv29stsNCWl3n8GF9zwh6qSV0Ripzj2LNo36wE5+8zzmZufPnrjv\n\thtVdHla6e/Khqrq5/+wMPDLCABS2+wTWReqKEwe1CKREcQf54sEXSzbYstCiKlRWfUfi\n\tJzcljPcvwbkFX4iO77Kxc7JZhJHCi33PvpPRuUaqSpKNmxte/PBf6dzdfknJZQg9dxuA\n\tuZkue26seH+5fBXekdpYP0nYhPbslwXeqKOtCXqtXwUTXP3KDqEx99VPW4NA1PvclM9D\n\tII3oHxDhnE8B8N/wXGQAn/CCFz/3xli4J4tXF2vKEq2LgCx5Gl16fc8NUbdrBA+JE34D\n\thWfw==","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=q3KBd0l1t6Eo9s382IuV+PGBc7ZT7gj8sjsLtzxRGPObevsn7I9UYpptPTdDGzXZP3\n\t6279HV+LBuGJwlZncRXydLV7jr5WqMS3pBzST6o6v+bsmHrZhu9APcPXyi/13h6OUFtK\n\tbqAtzApojcB4lWziBDV102Wk7qYQDWnYuXRbWIziAcmmKZFam+9PIp2QgaKaWfV9a0JU\n\tExm4Mz+YNZY5jIrxBdDYW527TDAexllX+DN57Vmc38Bmcs8CCqetYag3b4sGzUgC6XKU\n\tk86MeAqFtjiWKhMGZpY7ykXPg948fxde3KQzqcQRTlMjUcTcnGcOpIZD5pMdw3cbztGO\n\tGnHw==","X-Gm-Message-State":"AHPjjUjIWiFIvJkMoNkNUmhuskuB/pZhwsLcgaSW0YwH5OBPv+ZsxZF5\n\tWrTJExyedRKyzQ==","X-Google-Smtp-Source":"ADKCNb6UFROlyBB/dmmwyMsKNxIxUjC3YN2kj4iyhw8ZGVAh7vqXIRiFPkiguMi+LHYDlp4jRh7qQA==","X-Received":"by 10.28.217.85 with SMTP id q82mr743258wmg.89.1504541305425;\n\tMon, 04 Sep 2017 09:08:25 -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":"Mon,  4 Sep 2017 12:07:45 -0400","Message-Id":"<1504541267-36954-5-git-send-email-pradeep.jagadeesh@huawei.com>","X-Mailer":"git-send-email 1.8.3.1","In-Reply-To":"<1504541267-36954-1-git-send-email-pradeep.jagadeesh@huawei.com>","References":"<1504541267-36954-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:c09::244","Subject":"[Qemu-devel] [PATCH v10 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":["v10","4/6"]}