{"id":817454,"url":"http://patchwork.ozlabs.org/api/patches/817454/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1506081825-14209-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":"<1506081825-14209-5-git-send-email-pradeep.jagadeesh@huawei.com>","list_archive_url":null,"date":"2017-09-22T12:03:43","name":"[v12,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/1506081825-14209-5-git-send-email-pradeep.jagadeesh@huawei.com/mbox/","series":[{"id":4607,"url":"http://patchwork.ozlabs.org/api/series/4607/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4607","date":"2017-09-22T12:03:39","name":"fsdev: qmp interface for io throttling","version":12,"mbox":"http://patchwork.ozlabs.org/series/4607/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817454/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817454/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=\"eSMiweRP\"; 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 3xzBxq4dhPz9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 22:05:19 +1000 (AEST)","from localhost ([::1]:58479 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 1dvMhp-0006Q1-MN\n\tfor incoming@patchwork.ozlabs.org; Fri, 22 Sep 2017 08:05:17 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:46751)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dvMgx-0006M0-Qf\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 08:04:27 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pradeepkiruvale@gmail.com>) id 1dvMgw-0004uZ-NQ\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 08:04:23 -0400","from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33825)\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 1dvMgw-0004uA-HD\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 08:04:22 -0400","by mail-wm0-x241.google.com with SMTP id i131so1099417wma.1\n\tfor <qemu-devel@nongnu.org>; Fri, 22 Sep 2017 05:04:22 -0700 (PDT)","from localhost.localdomain.localdomain ([217.110.131.66])\n\tby smtp.gmail.com with ESMTPSA id\n\tv78sm2567133wmv.48.2017.09.22.05.04.20\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 22 Sep 2017 05:04:20 -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=eSMiweRP1q7jGGaj7W3ogppjYcEg8Uj7MBJV9lHvqn8WHKC3lvPf6zzoR0LFGl1hOT\n\tGF6fKx9B5nQXaKFiA3v+T1rcBOxM8pcKQFgNQPMgB+48WKJJEEgT4LuUddy80KR8xqv3\n\t0le6Kv9YIXv/SykjN40h4Qc42+N3bTusbmNk/CvH7BkKoJR2kHb8DvT5nnoKA+3IL/Ir\n\tOqp+AYCK/j595VrhTnaxlDPgu+1Ic01EnV6OtP7SbDEfyjctio+3HgY72AndJQUkmIFf\n\tNGzAClLDuKt7iDWLf6Rgw3MkxDNqYXhFk55Aq1JrLmLFnGTQ9+e+AamnkqwnXA4sfeAV\n\tIqYA==","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=XF35Lb9xgmaJGJK0MHL6h/LzAnTUkgLXNfAPnSESXkis8D1r0ztEqnp/rBnR/Bt0PK\n\tUeNimhd2UO1o/wqIt85qMkdL/gCrEtMu80Qj55GuGtEKXqQBofu+D/lzfT/ALDHNIHfg\n\tfqiYeHd+Xin+oxoliNo2xAsIitt52mviizJZnyTfOjS3JTCULTImaZE/LN9kRcjoiDRW\n\twpnJ6GtPBj53KVVeJWQUdRijRFIdj3j95iA+61Ech/e+EmonW8Hu2gm4T6OR25jZO23n\n\tyfTRP69XGNTNFIEZ+vqjm5yvwztP5dTbT8oV1Qk2kH1IiK9It6MPPuo86zG4Mv2xGIgZ\n\t8WOg==","X-Gm-Message-State":"AHPjjUgbfR/7ouDAX4vhlKtTEAavgwjZgiMkfQEGmdm73DnfiWlWQ050\n\tAhMxdJG3+Uz6XlrkOyKE/x7Pyg==","X-Google-Smtp-Source":"AOwi7QC5PLoa0BmNFtb4IC20zZ/v/sngbt8YL97wHT7P1zvdxb1McvzxT1mTNiyrvf2M3Ycuc12ugQ==","X-Received":"by 10.28.156.18 with SMTP id f18mr3527723wme.63.1506081861427;\n\tFri, 22 Sep 2017 05:04:21 -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":"Fri, 22 Sep 2017 08:03:43 -0400","Message-Id":"<1506081825-14209-5-git-send-email-pradeep.jagadeesh@huawei.com>","X-Mailer":"git-send-email 1.8.3.1","In-Reply-To":"<1506081825-14209-1-git-send-email-pradeep.jagadeesh@huawei.com>","References":"<1506081825-14209-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::241","Subject":"[Qemu-devel] [PATCH v12 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":["v12","4/6"]}