From nobody Wed Nov 5 11:08:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504541737427339.8647830355545; Mon, 4 Sep 2017 09:15:37 -0700 (PDT) Received: from localhost ([::1]:54773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dou2C-0004BQ-9h for importer@patchew.org; Mon, 04 Sep 2017 12:15:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dotvL-0007LT-67 for qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dotvG-0008S2-Iv for qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:31 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:37924) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dotvG-0008Ro-CW for qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:26 -0400 Received: by mail-wm0-x244.google.com with SMTP id u26so699764wma.5 for ; Mon, 04 Sep 2017 09:08:26 -0700 (PDT) Received: from localhost.localdomain.localdomain ([217.110.131.66]) by smtp.gmail.com with ESMTPSA id x67sm976582wma.7.2017.09.04.09.08.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Sep 2017 09:08:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0A09PHsWtkbl3qVkFa3DyhICvvM1yY42z7IfzxkBSHc=; b=dUdLz7Qf1+uBCRVv29stsNCWl3n8GF9zwh6qSV0Ripzj2LNo36wE5+8zzmZufPnrjv htVdHla6e/Khqrq5/+wMPDLCABS2+wTWReqKEwe1CKREcQf54sEXSzbYstCiKlRWfUfi JzcljPcvwbkFX4iO77Kxc7JZhJHCi33PvpPRuUaqSpKNmxte/PBf6dzdfknJZQg9dxuA uZkue26seH+5fBXekdpYP0nYhPbslwXeqKOtCXqtXwUTXP3KDqEx99VPW4NA1PvclM9D II3oHxDhnE8B8N/wXGQAn/CCFz/3xli4J4tXF2vKEq2LgCx5Gl16fc8NUbdrBA+JE34D hWfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0A09PHsWtkbl3qVkFa3DyhICvvM1yY42z7IfzxkBSHc=; b=q3KBd0l1t6Eo9s382IuV+PGBc7ZT7gj8sjsLtzxRGPObevsn7I9UYpptPTdDGzXZP3 6279HV+LBuGJwlZncRXydLV7jr5WqMS3pBzST6o6v+bsmHrZhu9APcPXyi/13h6OUFtK bqAtzApojcB4lWziBDV102Wk7qYQDWnYuXRbWIziAcmmKZFam+9PIp2QgaKaWfV9a0JU Exm4Mz+YNZY5jIrxBdDYW527TDAexllX+DN57Vmc38Bmcs8CCqetYag3b4sGzUgC6XKU k86MeAqFtjiWKhMGZpY7ykXPg948fxde3KQzqcQRTlMjUcTcnGcOpIZD5pMdw3cbztGO GnHw== X-Gm-Message-State: AHPjjUjIWiFIvJkMoNkNUmhuskuB/pZhwsLcgaSW0YwH5OBPv+ZsxZF5 WrTJExyedRKyzQ== X-Google-Smtp-Source: ADKCNb6UFROlyBB/dmmwyMsKNxIxUjC3YN2kj4iyhw8ZGVAh7vqXIRiFPkiguMi+LHYDlp4jRh7qQA== X-Received: by 10.28.217.85 with SMTP id q82mr743258wmg.89.1504541305425; Mon, 04 Sep 2017 09:08:25 -0700 (PDT) From: Pradeep Jagadeesh X-Google-Original-From: Pradeep Jagadeesh To: "eric blake" , "greg kurz" 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 recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PATCH v10 4/6] hmp: create a throttle initialization function for code reusability X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, jani kokkonen , alberto garcia , Pradeep Jagadeesh , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch creates a throttle initialization function to maximize the code reusability. The same code is also used by fsdev. Acked-by: Dr. David Alan Gilbert Signed-off-by: Pradeep Jagadeesh Reviewed-by: Alberto Garcia Reviewed-by: Greg Kurz --- hmp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/hmp.c b/hmp.c index fd80dce..2dbfb80 100644 --- a/hmp.c +++ b/hmp.c @@ -1758,20 +1758,27 @@ void hmp_change(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } =20 +static void hmp_initialize_io_throttle(IOThrottle *iot, const QDict *qdict) +{ + iot->bps =3D qdict_get_int(qdict, "bps"); + iot->bps_rd =3D qdict_get_int(qdict, "bps_rd"); + iot->bps_wr =3D qdict_get_int(qdict, "bps_wr"); + iot->iops =3D qdict_get_int(qdict, "iops"); + iot->iops_rd =3D qdict_get_int(qdict, "iops_rd"); + iot->iops_wr =3D qdict_get_int(qdict, "iops_wr"); +} + void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; + IOThrottle *iothrottle; BlockIOThrottle throttle =3D { .has_device =3D true, .device =3D (char *) qdict_get_str(qdict, "device"), - .bps =3D qdict_get_int(qdict, "bps"), - .bps_rd =3D qdict_get_int(qdict, "bps_rd"), - .bps_wr =3D qdict_get_int(qdict, "bps_wr"), - .iops =3D qdict_get_int(qdict, "iops"), - .iops_rd =3D qdict_get_int(qdict, "iops_rd"), - .iops_wr =3D qdict_get_int(qdict, "iops_wr"), }; =20 + iothrottle =3D qapi_BlockIOThrottle_base(&throttle); + hmp_initialize_io_throttle(iothrottle, qdict); qmp_block_set_io_throttle(&throttle, &err); hmp_handle_error(mon, &err); } --=20 1.8.3.1