From nobody Tue Feb 10 00:58:17 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506955264934232.43400314842597; Mon, 2 Oct 2017 07:41:04 -0700 (PDT) Received: from localhost ([::1]:52637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz1tr-0002VH-4k for importer@patchew.org; Mon, 02 Oct 2017 10:40:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz1nQ-0005bi-T7 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 10:34:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz1nK-0007uF-Qk for qemu-devel@nongnu.org; Mon, 02 Oct 2017 10:34:12 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:37884) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dz1nK-0007tu-KN for qemu-devel@nongnu.org; Mon, 02 Oct 2017 10:34:06 -0400 Received: by mail-wr0-x243.google.com with SMTP id v38so946576wrc.4 for ; Mon, 02 Oct 2017 07:34:06 -0700 (PDT) Received: from localhost.localdomain.localdomain ([217.110.131.66]) by smtp.gmail.com with ESMTPSA id b89sm28440668wrd.42.2017.10.02.07.34.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 07:34:04 -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=m3NAjA+cvXsRviwHqSSZXq4D/GYGgIOWt6wrE/wZ8aQ=; b=YZpVraJorg4d5C+iND1eG+dlhStQRbRAcMcv1COW/fWjJKrJHXR0vbjAAXfz7IPJGl a5cIzPfGEuwbZd09q+2Zk+VAssYzvNMAZtLXUUh/PjvysYUcuIH2P2m2jxHmyX9+UGJs yuqayNuRYYeUWRrABLL1hrJUzpFzpSWPpIBypBp+HkeCslL9Vj5KW1R/Ur4BBS76kR9v sUDubADxm4urj+JloTpVkQ3RXyQZBOZnhEe6VyrOH8YOz0sjiJEksJdF1VjOAkROoLmY V8xvUlj0v/cWKAHyeHOAq8Tr1R53HbFb/4Hc5p+XaeMMYq8cPzzlLbhsSCdOaAyb9xk2 w9WQ== 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=m3NAjA+cvXsRviwHqSSZXq4D/GYGgIOWt6wrE/wZ8aQ=; b=LrQHoYhBBC9RIVkfuHAGuCU4r+NELydiJrJAlWYh+pzurD+ajyz5gDOxoODjxDkUZP FxBVKbeie1AwogYeJdFT7L4bUlmYp9c7BMzsPdkA35xwmIUPFxpMyx2PTOaezG2hw9vw 3oRIn4+bHEL5IQIq8W9gk36hUhG2q5FUpkX0B/ROW1pzeoJP4JXNVMW+6RzJsgYo7CQa ZNnpmvSGm+OSJ/aDwDILhdAY68JXsGtaNNzw3H8LqEp/XoekrqUMl9JUUN94qoo6R9TB 5Tt7mSlSTmcLhQ0O7hcWnT/jity54DWZh0lmqWX3Ws8YtRVEPI5ZnZCooj4f2KUsDkde vTdg== X-Gm-Message-State: AMCzsaWkOaoVeRp4SoS4QkGQPXMg1hvPBLq/57H0qh2eslnle7K1BckF 0TkdC6I7McCtKL+bQUEEH/Q= X-Google-Smtp-Source: AOwi7QDyhGyzo4mXB/8Uj0AxHn9eu2C3x2VCx4q2dYbWKle1pDe5H5COp7rWy/sROR7txkoTpQliyg== X-Received: by 10.223.146.101 with SMTP id 92mr6813111wrj.21.1506954845577; Mon, 02 Oct 2017 07:34:05 -0700 (PDT) From: Pradeep Jagadeesh X-Google-Original-From: Pradeep Jagadeesh To: "eric blake" , "greg kurz" Date: Mon, 2 Oct 2017 10:33:29 -0400 Message-Id: <1506954812-6552-4-git-send-email-pradeep.jagadeesh@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1506954812-6552-1-git-send-email-pradeep.jagadeesh@huawei.com> References: <1506954812-6552-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:c0c::243 Subject: [Qemu-devel] [PATCH v13 3/6] qmp: factor out throttle code to reuse code X-BeenThere: qemu-devel@gnu.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 , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch reuses the code to set throttle limits. Signed-off-by: Pradeep Jagadeesh --- blockdev.c | 53 +++-------------------------------------------------- 1 file changed, 3 insertions(+), 50 deletions(-) diff --git a/blockdev.c b/blockdev.c index 43f706d..364df4d 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2570,6 +2570,7 @@ void qmp_block_set_io_throttle(BlockIOThrottle *arg, = Error **errp) BlockDriverState *bs; BlockBackend *blk; AioContext *aio_context; + ThrottleLimits *tlimit; =20 blk =3D qmp_get_blk(arg->has_device ? arg->device : NULL, arg->has_id ? arg->id : NULL, @@ -2587,56 +2588,8 @@ void qmp_block_set_io_throttle(BlockIOThrottle *arg,= Error **errp) goto out; } =20 - throttle_config_init(&cfg); - cfg.buckets[THROTTLE_BPS_TOTAL].avg =3D arg->bps; - cfg.buckets[THROTTLE_BPS_READ].avg =3D arg->bps_rd; - cfg.buckets[THROTTLE_BPS_WRITE].avg =3D arg->bps_wr; - - cfg.buckets[THROTTLE_OPS_TOTAL].avg =3D arg->iops; - cfg.buckets[THROTTLE_OPS_READ].avg =3D arg->iops_rd; - cfg.buckets[THROTTLE_OPS_WRITE].avg =3D arg->iops_wr; - - if (arg->has_bps_max) { - cfg.buckets[THROTTLE_BPS_TOTAL].max =3D arg->bps_max; - } - if (arg->has_bps_rd_max) { - cfg.buckets[THROTTLE_BPS_READ].max =3D arg->bps_rd_max; - } - if (arg->has_bps_wr_max) { - cfg.buckets[THROTTLE_BPS_WRITE].max =3D arg->bps_wr_max; - } - if (arg->has_iops_max) { - cfg.buckets[THROTTLE_OPS_TOTAL].max =3D arg->iops_max; - } - if (arg->has_iops_rd_max) { - cfg.buckets[THROTTLE_OPS_READ].max =3D arg->iops_rd_max; - } - if (arg->has_iops_wr_max) { - cfg.buckets[THROTTLE_OPS_WRITE].max =3D arg->iops_wr_max; - } - - if (arg->has_bps_max_length) { - cfg.buckets[THROTTLE_BPS_TOTAL].burst_length =3D arg->bps_max_leng= th; - } - if (arg->has_bps_rd_max_length) { - cfg.buckets[THROTTLE_BPS_READ].burst_length =3D arg->bps_rd_max_le= ngth; - } - if (arg->has_bps_wr_max_length) { - cfg.buckets[THROTTLE_BPS_WRITE].burst_length =3D arg->bps_wr_max_l= ength; - } - if (arg->has_iops_max_length) { - cfg.buckets[THROTTLE_OPS_TOTAL].burst_length =3D arg->iops_max_len= gth; - } - if (arg->has_iops_rd_max_length) { - cfg.buckets[THROTTLE_OPS_READ].burst_length =3D arg->iops_rd_max_l= ength; - } - if (arg->has_iops_wr_max_length) { - cfg.buckets[THROTTLE_OPS_WRITE].burst_length =3D arg->iops_wr_max_= length; - } - - if (arg->has_iops_size) { - cfg.op_size =3D arg->iops_size; - } + tlimit =3D qapi_BlockIOThrottle_base(arg); + throttle_config_to_limits(&cfg, tlimit); =20 if (!throttle_is_valid(&cfg, errp)) { goto out; --=20 1.8.3.1