From nobody Thu Nov 6 18:27:52 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; 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 1542272597756103.84422351428464; Thu, 15 Nov 2018 01:03:17 -0800 (PST) Received: from localhost ([::1]:37517 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNDYS-0003Tu-8R for importer@patchew.org; Thu, 15 Nov 2018 04:03:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNDWJ-0002Zk-ME for qemu-devel@nongnu.org; Thu, 15 Nov 2018 04:01:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNDWG-0005R0-BN for qemu-devel@nongnu.org; Thu, 15 Nov 2018 04:01:03 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:57299 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNDWF-0005PJ-CK for qemu-devel@nongnu.org; Thu, 15 Nov 2018 04:01:00 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A6C4DF8C48254; Thu, 15 Nov 2018 17:00:55 +0800 (CST) Received: from huawei.com (10.143.28.95) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.408.0; Thu, 15 Nov 2018 17:00:50 +0800 From: xiezhide To: Date: Thu, 15 Nov 2018 16:55:15 +0800 Message-ID: <37e2a76b4020a5f9e48fe3b7c36d8e4bfb111569.1542301855.git.xiezhide@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.143.28.95] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 45.249.212.32 Subject: [Qemu-devel] [PATCH v4 2/4] fsdev-throttle-qmp: move struct ThrottleLimits to new file 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: berto@igalia.com, armbru@redhat.com, zengcanfu@huawei.com, groug@kaod.org, aneesh.kumar@linux.vnet.ibm.com, jinxuefeng@huawei.com, chenhui.rtos@huawei.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" this patch move ThrottleLimits to new file and rename struct field with common format Signed-off-by: xiezhide --- Makefile | 9 +++ Makefile.objs | 4 ++ blockdev.c | 51 +--------------- qapi/block-core.json | 122 +------------------------------------ qapi/qapi-schema.json | 1 + qapi/tlimits.json | 89 +++++++++++++++++++++++++++ util/throttle.c | 163 +++++++++++++++++++++++++---------------------= ---- 7 files changed, 188 insertions(+), 251 deletions(-) create mode 100644 qapi/tlimits.json diff --git a/Makefile b/Makefile index f294718..8990081 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,7 @@ GENERATED_FILES +=3D qapi/qapi-types-sockets.h qapi/qap= i-types-sockets.c GENERATED_FILES +=3D qapi/qapi-types-tpm.h qapi/qapi-types-tpm.c GENERATED_FILES +=3D qapi/qapi-types-trace.h qapi/qapi-types-trace.c GENERATED_FILES +=3D qapi/qapi-types-transaction.h qapi/qapi-types-transac= tion.c +GENERATED_FILES +=3D qapi/qapi-types-tlimits.h qapi/qapi-types-tlimits.c GENERATED_FILES +=3D qapi/qapi-types-ui.h qapi/qapi-types-ui.c GENERATED_FILES +=3D qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c GENERATED_FILES +=3D qapi/qapi-visit.h qapi/qapi-visit.c @@ -125,6 +126,7 @@ GENERATED_FILES +=3D qapi/qapi-visit-sockets.h qapi/qap= i-visit-sockets.c GENERATED_FILES +=3D qapi/qapi-visit-tpm.h qapi/qapi-visit-tpm.c GENERATED_FILES +=3D qapi/qapi-visit-trace.h qapi/qapi-visit-trace.c GENERATED_FILES +=3D qapi/qapi-visit-transaction.h qapi/qapi-visit-transac= tion.c +GENERATED_FILES +=3D qapi/qapi-visit-tlimits.h qapi/qapi-visit-tlimits.c GENERATED_FILES +=3D qapi/qapi-visit-ui.h qapi/qapi-visit-ui.c GENERATED_FILES +=3D qapi/qapi-commands.h qapi/qapi-commands.c GENERATED_FILES +=3D qapi/qapi-commands-block-core.h qapi/qapi-commands-bl= ock-core.c @@ -143,6 +145,7 @@ GENERATED_FILES +=3D qapi/qapi-commands-sockets.h qapi/= qapi-commands-sockets.c GENERATED_FILES +=3D qapi/qapi-commands-tpm.h qapi/qapi-commands-tpm.c GENERATED_FILES +=3D qapi/qapi-commands-trace.h qapi/qapi-commands-trace.c GENERATED_FILES +=3D qapi/qapi-commands-transaction.h qapi/qapi-commands-t= ransaction.c +GENERATED_FILES +=3D qapi/qapi-commands-tlimits.h qapi/qapi-commands-tlimi= ts.c GENERATED_FILES +=3D qapi/qapi-commands-ui.h qapi/qapi-commands-ui.c GENERATED_FILES +=3D qapi/qapi-events.h qapi/qapi-events.c GENERATED_FILES +=3D qapi/qapi-events-block-core.h qapi/qapi-events-block-= core.c @@ -161,6 +164,7 @@ GENERATED_FILES +=3D qapi/qapi-events-sockets.h qapi/qa= pi-events-sockets.c GENERATED_FILES +=3D qapi/qapi-events-tpm.h qapi/qapi-events-tpm.c GENERATED_FILES +=3D qapi/qapi-events-trace.h qapi/qapi-events-trace.c GENERATED_FILES +=3D qapi/qapi-events-transaction.h qapi/qapi-events-trans= action.c +GENERATED_FILES +=3D qapi/qapi-events-tlimits.h qapi/qapi-events-tlimits.c GENERATED_FILES +=3D qapi/qapi-events-ui.h qapi/qapi-events-ui.c GENERATED_FILES +=3D qapi/qapi-introspect.c qapi/qapi-introspect.h GENERATED_FILES +=3D qapi/qapi-doc.texi @@ -598,6 +602,7 @@ qapi-modules =3D $(SRC_PATH)/qapi/qapi-schema.json $(SR= C_PATH)/qapi/common.json \ $(SRC_PATH)/qapi/tpm.json \ $(SRC_PATH)/qapi/trace.json \ $(SRC_PATH)/qapi/transaction.json \ + $(SRC_PATH)/qapi/tlimits.json \ $(SRC_PATH)/qapi/ui.json =20 qapi/qapi-builtin-types.c qapi/qapi-builtin-types.h \ @@ -618,6 +623,7 @@ qapi/qapi-types-sockets.c qapi/qapi-types-sockets.h \ qapi/qapi-types-tpm.c qapi/qapi-types-tpm.h \ qapi/qapi-types-trace.c qapi/qapi-types-trace.h \ qapi/qapi-types-transaction.c qapi/qapi-types-transaction.h \ +qapi/qapi-types-tlimits.c qapi/qapi-types-tlimits.h \ qapi/qapi-types-ui.c qapi/qapi-types-ui.h \ qapi/qapi-builtin-visit.c qapi/qapi-builtin-visit.h \ qapi/qapi-visit.c qapi/qapi-visit.h \ @@ -637,6 +643,7 @@ qapi/qapi-visit-sockets.c qapi/qapi-visit-sockets.h \ qapi/qapi-visit-tpm.c qapi/qapi-visit-tpm.h \ qapi/qapi-visit-trace.c qapi/qapi-visit-trace.h \ qapi/qapi-visit-transaction.c qapi/qapi-visit-transaction.h \ +qapi/qapi-visit-tlimits.c qapi/qapi-visit-tlimits.h \ qapi/qapi-visit-ui.c qapi/qapi-visit-ui.h \ qapi/qapi-commands.h qapi/qapi-commands.c \ qapi/qapi-commands-block-core.c qapi/qapi-commands-block-core.h \ @@ -655,6 +662,7 @@ qapi/qapi-commands-sockets.c qapi/qapi-commands-sockets= .h \ qapi/qapi-commands-tpm.c qapi/qapi-commands-tpm.h \ qapi/qapi-commands-trace.c qapi/qapi-commands-trace.h \ qapi/qapi-commands-transaction.c qapi/qapi-commands-transaction.h \ +qapi/qapi-commands-tlimits.c qapi/qapi-commands-tlimits.h \ qapi/qapi-commands-ui.c qapi/qapi-commands-ui.h \ qapi/qapi-events.c qapi/qapi-events.h \ qapi/qapi-events-block-core.c qapi/qapi-events-block-core.h \ @@ -673,6 +681,7 @@ qapi/qapi-events-sockets.c qapi/qapi-events-sockets.h \ qapi/qapi-events-tpm.c qapi/qapi-events-tpm.h \ qapi/qapi-events-trace.c qapi/qapi-events-trace.h \ qapi/qapi-events-transaction.c qapi/qapi-events-transaction.h \ +qapi/qapi-events-tlimits.c qapi/qapi-events-tlimits.h \ qapi/qapi-events-ui.c qapi/qapi-events-ui.h \ qapi/qapi-introspect.h qapi/qapi-introspect.c \ qapi/qapi-doc.texi: \ diff --git a/Makefile.objs b/Makefile.objs index 1e1ff38..682e6ba 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -20,6 +20,7 @@ util-obj-y +=3D qapi/qapi-types-sockets.o util-obj-y +=3D qapi/qapi-types-tpm.o util-obj-y +=3D qapi/qapi-types-trace.o util-obj-y +=3D qapi/qapi-types-transaction.o +util-obj-y +=3D qapi/qapi-types-tlimits.o util-obj-y +=3D qapi/qapi-types-ui.o util-obj-y +=3D qapi/qapi-builtin-visit.o util-obj-y +=3D qapi/qapi-visit.o @@ -39,6 +40,7 @@ util-obj-y +=3D qapi/qapi-visit-sockets.o util-obj-y +=3D qapi/qapi-visit-tpm.o util-obj-y +=3D qapi/qapi-visit-trace.o util-obj-y +=3D qapi/qapi-visit-transaction.o +util-obj-y +=3D qapi/qapi-visit-tlimits.o util-obj-y +=3D qapi/qapi-visit-ui.o util-obj-y +=3D qapi/qapi-events.o util-obj-y +=3D qapi/qapi-events-block-core.o @@ -57,6 +59,7 @@ util-obj-y +=3D qapi/qapi-events-sockets.o util-obj-y +=3D qapi/qapi-events-tpm.o util-obj-y +=3D qapi/qapi-events-trace.o util-obj-y +=3D qapi/qapi-events-transaction.o +util-obj-y +=3D qapi/qapi-events-tlimits.o util-obj-y +=3D qapi/qapi-events-ui.o util-obj-y +=3D qapi/qapi-introspect.o =20 @@ -154,6 +157,7 @@ common-obj-y +=3D qapi/qapi-commands-sockets.o common-obj-y +=3D qapi/qapi-commands-tpm.o common-obj-y +=3D qapi/qapi-commands-trace.o common-obj-y +=3D qapi/qapi-commands-transaction.o +common-obj-y +=3D qapi/qapi-commands-tlimits.o common-obj-y +=3D qapi/qapi-commands-ui.o common-obj-y +=3D qapi/qapi-introspect.o common-obj-y +=3D qmp.o hmp.o diff --git a/blockdev.c b/blockdev.c index fce5d8f..0683c07 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2701,56 +2701,7 @@ 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; - } + throttle_limits_to_config(qapi_BlockIOThrottle_base(arg), &cfg, errp); =20 if (!throttle_is_valid(&cfg, errp)) { goto out; diff --git a/qapi/block-core.json b/qapi/block-core.json index d4fe710..05296b0 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -8,6 +8,7 @@ { 'include': 'crypto.json' } { 'include': 'job.json' } { 'include': 'sockets.json' } +{ 'include': 'tlimits.json' } =20 ## # @SnapshotInfo: @@ -2155,130 +2156,13 @@ # # @id: The name or QOM path of the guest device (since: 2.8) # -# @bps: total throughput limit in bytes per second -# -# @bps_rd: read throughput limit in bytes per second -# -# @bps_wr: write throughput limit in bytes per second -# -# @iops: total I/O operations per second -# -# @iops_rd: read I/O operations per second -# -# @iops_wr: write I/O operations per second -# -# @bps_max: total throughput limit during bursts, -# in bytes (Since 1.7) -# -# @bps_rd_max: read throughput limit during bursts, -# in bytes (Since 1.7) -# -# @bps_wr_max: write throughput limit during bursts, -# in bytes (Since 1.7) -# -# @iops_max: total I/O operations per second during bursts, -# in bytes (Since 1.7) -# -# @iops_rd_max: read I/O operations per second during bursts, -# in bytes (Since 1.7) -# -# @iops_wr_max: write I/O operations per second during bursts, -# in bytes (Since 1.7) -# -# @bps_max_length: maximum length of the @bps_max burst -# period, in seconds. It must only -# be set if @bps_max is set as well. -# Defaults to 1. (Since 2.6) -# -# @bps_rd_max_length: maximum length of the @bps_rd_max -# burst period, in seconds. It must only -# be set if @bps_rd_max is set as well. -# Defaults to 1. (Since 2.6) -# -# @bps_wr_max_length: maximum length of the @bps_wr_max -# burst period, in seconds. It must only -# be set if @bps_wr_max is set as well. -# Defaults to 1. (Since 2.6) -# -# @iops_max_length: maximum length of the @iops burst -# period, in seconds. It must only -# be set if @iops_max is set as well. -# Defaults to 1. (Since 2.6) -# -# @iops_rd_max_length: maximum length of the @iops_rd_max -# burst period, in seconds. It must only -# be set if @iops_rd_max is set as well. -# Defaults to 1. (Since 2.6) -# -# @iops_wr_max_length: maximum length of the @iops_wr_max -# burst period, in seconds. It must only -# be set if @iops_wr_max is set as well. -# Defaults to 1. (Since 2.6) -# -# @iops_size: an I/O size in bytes (Since 1.7) -# # @group: throttle group name (Since 2.4) # # Since: 1.1 ## { 'struct': 'BlockIOThrottle', - 'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int', - 'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': '= int', - '*bps_max': 'int', '*bps_rd_max': 'int', - '*bps_wr_max': 'int', '*iops_max': 'int', - '*iops_rd_max': 'int', '*iops_wr_max': 'int', - '*bps_max_length': 'int', '*bps_rd_max_length': 'int', - '*bps_wr_max_length': 'int', '*iops_max_length': 'int', - '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int', - '*iops_size': 'int', '*group': 'str' } } - -## -# @ThrottleLimits: -# -# Limit parameters for throttling. -# Since some limit combinations are illegal, limits should always be set i= n one -# transaction. All fields are optional. When setting limits, if a field is -# missing the current value is not changed. -# -# @iops-total: limit total I/O operations per second -# @iops-total-max: I/O operations burst -# @iops-total-max-length: length of the iops-total-max burst period, in s= econds -# It must only be set if @iops-total-max is set a= s well. -# @iops-read: limit read operations per second -# @iops-read-max: I/O operations read burst -# @iops-read-max-length: length of the iops-read-max burst period, in se= conds -# It must only be set if @iops-read-max is set as= well. -# @iops-write: limit write operations per second -# @iops-write-max: I/O operations write burst -# @iops-write-max-length: length of the iops-write-max burst period, in s= econds -# It must only be set if @iops-write-max is set a= s well. -# @bps-total: limit total bytes per second -# @bps-total-max: total bytes burst -# @bps-total-max-length: length of the bps-total-max burst period, in se= conds. -# It must only be set if @bps-total-max is set as= well. -# @bps-read: limit read bytes per second -# @bps-read-max: total bytes read burst -# @bps-read-max-length: length of the bps-read-max burst period, in sec= onds -# It must only be set if @bps-read-max is set as = well. -# @bps-write: limit write bytes per second -# @bps-write-max: total bytes write burst -# @bps-write-max-length: length of the bps-write-max burst period, in se= conds -# It must only be set if @bps-write-max is set as= well. -# @iops-size: when limiting by iops max size of an I/O in byt= es -# -# Since: 2.11 -## -{ 'struct': 'ThrottleLimits', - 'data': { '*iops-total' : 'int', '*iops-total-max' : 'int', - '*iops-total-max-length' : 'int', '*iops-read' : 'int', - '*iops-read-max' : 'int', '*iops-read-max-length' : 'int', - '*iops-write' : 'int', '*iops-write-max' : 'int', - '*iops-write-max-length' : 'int', '*bps-total' : 'int', - '*bps-total-max' : 'int', '*bps-total-max-length' : 'int', - '*bps-read' : 'int', '*bps-read-max' : 'int', - '*bps-read-max-length' : 'int', '*bps-write' : 'int', - '*bps-write-max' : 'int', '*bps-write-max-length' : 'int', - '*iops-size' : 'int' } } + 'base': 'ThrottleLimits', + 'data': { '*device': 'str', '*id': 'str', '*group': 'str' } } =20 ## # @block-stream: diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index 65b6dc2..13d7c0f 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -94,3 +94,4 @@ { 'include': 'trace.json' } { 'include': 'introspect.json' } { 'include': 'misc.json' } +{ 'include': 'tlimits.json' } diff --git a/qapi/tlimits.json b/qapi/tlimits.json new file mode 100644 index 0000000..6bcbaf6 --- /dev/null +++ b/qapi/tlimits.json @@ -0,0 +1,89 @@ +# -*- Mode: Python -*- + +## +# =3D=3D Throttle limits +## + +## +# @ThrottleLimits: +# +# Limit parameters for throttling. +# Since some limit combinations are illegal, limits should always be set i= n one +# transaction. All fields are optional. When setting limits, if a field is +# missing the current value is not changed. +# +# @bps: total throughput limit in bytes per second +# +# @bps_rd: read throughput limit in bytes per second +# +# @bps_wr: write throughput limit in bytes per second +# +# @iops: total I/O operations per second +# +# @iops_rd: read I/O operations per second +# +# @iops_wr: write I/O operations per second +# +# @bps_max: total throughput limit during bursts, +# in bytes (Since 1.7) +# +# @bps_rd_max: read throughput limit during bursts, +# in bytes (Since 1.7) +# +# @bps_wr_max: write throughput limit during bursts, +# in bytes (Since 1.7) +# +# @iops_max: total I/O operations per second during bursts, +# in bytes (Since 1.7) +# +# @iops_rd_max: read I/O operations per second during bursts, +# in bytes (Since 1.7) +# +# @iops_wr_max: write I/O operations per second during bursts, +# in bytes (Since 1.7) +# +# @bps_max_length: maximum length of the @bps_max burst +# period, in seconds. It must only +# be set if @bps_max is set as well. +# Defaults to 1. (Since 2.6) +# +# @bps_rd_max_length: maximum length of the @bps_rd_max +# burst period, in seconds. It must only +# be set if @bps_rd_max is set as well. +# Defaults to 1. (Since 2.6) +# +# @bps_wr_max_length: maximum length of the @bps_wr_max +# burst period, in seconds. It must only +# be set if @bps_wr_max is set as well. +# Defaults to 1. (Since 2.6) +# +# @iops_max_length: maximum length of the @iops burst +# period, in seconds. It must only +# be set if @iops_max is set as well. +# Defaults to 1. (Since 2.6) +# +# @iops_rd_max_length: maximum length of the @iops_rd_max +# burst period, in seconds. It must only +# be set if @iops_rd_max is set as well. +# Defaults to 1. (Since 2.6) +# +# @iops_wr_max_length: maximum length of the @iops_wr_max +# burst period, in seconds. It must only +# be set if @iops_wr_max is set as well. +# Defaults to 1. (Since 2.6) +# +# @iops_size: an I/O size in bytes (Since 1.7) +# +# Since: 4.0 +# +## +{ 'struct': 'ThrottleLimits', + 'data': { '*bps': 'int', '*bps_rd': 'int', + '*bps_wr': 'int', '*iops': 'int', '*iops_rd': 'int', '*iops_wr= ': 'int', + '*bps_max': 'int', '*bps_rd_max': 'int', + '*bps_wr_max': 'int', '*iops_max': 'int', + '*iops_rd_max': 'int', '*iops_wr_max': 'int', + '*bps_max_length': 'int', '*bps_rd_max_length': 'int', + '*bps_wr_max_length': 'int', '*iops_max_length': 'int', + '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int', + '*iops_size': 'int' } } diff --git a/util/throttle.c b/util/throttle.c index e7db2ad..b421e33 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -496,98 +496,97 @@ void throttle_account(ThrottleState *ts, bool is_writ= e, uint64_t size) void throttle_limits_to_config(ThrottleLimits *arg, ThrottleConfig *cfg, Error **errp) { - if (arg->has_bps_total) { - cfg->buckets[THROTTLE_BPS_TOTAL].avg =3D arg->bps_total; + if (arg->has_bps) { + cfg->buckets[THROTTLE_BPS_TOTAL].avg =3D arg->bps; } - if (arg->has_bps_read) { - cfg->buckets[THROTTLE_BPS_READ].avg =3D arg->bps_read; + if (arg->has_bps_rd) { + cfg->buckets[THROTTLE_BPS_READ].avg =3D arg->bps_rd; } - if (arg->has_bps_write) { - cfg->buckets[THROTTLE_BPS_WRITE].avg =3D arg->bps_write; + if (arg->has_bps_wr) { + cfg->buckets[THROTTLE_BPS_WRITE].avg =3D arg->bps_wr; } =20 - if (arg->has_iops_total) { - cfg->buckets[THROTTLE_OPS_TOTAL].avg =3D arg->iops_total; + if (arg->has_iops) { + cfg->buckets[THROTTLE_OPS_TOTAL].avg =3D arg->iops; } - if (arg->has_iops_read) { - cfg->buckets[THROTTLE_OPS_READ].avg =3D arg->iops_read; + if (arg->has_iops_rd) { + cfg->buckets[THROTTLE_OPS_READ].avg =3D arg->iops_rd; } - if (arg->has_iops_write) { - cfg->buckets[THROTTLE_OPS_WRITE].avg =3D arg->iops_write; + if (arg->has_iops_wr) { + cfg->buckets[THROTTLE_OPS_WRITE].avg =3D arg->iops_wr; } =20 - if (arg->has_bps_total_max) { - cfg->buckets[THROTTLE_BPS_TOTAL].max =3D arg->bps_total_max; + if (arg->has_bps_max) { + cfg->buckets[THROTTLE_BPS_TOTAL].max =3D arg->bps_max; } - if (arg->has_bps_read_max) { - cfg->buckets[THROTTLE_BPS_READ].max =3D arg->bps_read_max; + if (arg->has_bps_rd_max) { + cfg->buckets[THROTTLE_BPS_READ].max =3D arg->bps_rd_max; } - if (arg->has_bps_write_max) { - cfg->buckets[THROTTLE_BPS_WRITE].max =3D arg->bps_write_max; + if (arg->has_bps_wr_max) { + cfg->buckets[THROTTLE_BPS_WRITE].max =3D arg->bps_wr_max; } - if (arg->has_iops_total_max) { - cfg->buckets[THROTTLE_OPS_TOTAL].max =3D arg->iops_total_max; + if (arg->has_iops_max) { + cfg->buckets[THROTTLE_OPS_TOTAL].max =3D arg->iops_max; } - if (arg->has_iops_read_max) { - cfg->buckets[THROTTLE_OPS_READ].max =3D arg->iops_read_max; + if (arg->has_iops_rd_max) { + cfg->buckets[THROTTLE_OPS_READ].max =3D arg->iops_rd_max; } - if (arg->has_iops_write_max) { - cfg->buckets[THROTTLE_OPS_WRITE].max =3D arg->iops_write_max; + if (arg->has_iops_wr_max) { + cfg->buckets[THROTTLE_OPS_WRITE].max =3D arg->iops_wr_max; } =20 - if (arg->has_bps_total_max_length) { - if (arg->bps_total_max_length > UINT_MAX) { + if (arg->has_bps_max_length) { + if (arg->bps_max_length > UINT_MAX) { error_setg(errp, "bps-total-max-length value must be in" " the range [0, %u]", UINT_MAX); return; } - cfg->buckets[THROTTLE_BPS_TOTAL].burst_length =3D arg->bps_total_m= ax_length; + cfg->buckets[THROTTLE_BPS_TOTAL].burst_length =3D arg->bps_max_len= gth; } - if (arg->has_bps_read_max_length) { - if (arg->bps_read_max_length > UINT_MAX) { + if (arg->has_bps_rd_max_length) { + if (arg->bps_rd_max_length > UINT_MAX) { error_setg(errp, "bps-read-max-length value must be in" " the range [0, %u]", UINT_MAX); return; } - cfg->buckets[THROTTLE_BPS_READ].burst_length =3D arg->bps_read_max= _length; + cfg->buckets[THROTTLE_BPS_READ].burst_length =3D arg->bps_rd_max_l= ength; } - if (arg->has_bps_write_max_length) { - if (arg->bps_write_max_length > UINT_MAX) { + if (arg->has_bps_wr_max_length) { + if (arg->bps_wr_max_length > UINT_MAX) { error_setg(errp, "bps-write-max-length value must be in" " the range [0, %u]", UINT_MAX); return; } - cfg->buckets[THROTTLE_BPS_WRITE].burst_length =3D arg->bps_write_m= ax_length; + cfg->buckets[THROTTLE_BPS_WRITE].burst_length =3D arg->bps_wr_max_= length; } - if (arg->has_iops_total_max_length) { - if (arg->iops_total_max_length > UINT_MAX) { + if (arg->has_iops_max_length) { + if (arg->iops_max_length > UINT_MAX) { error_setg(errp, "iops-total-max-length value must be in" " the range [0, %u]", UINT_MAX); return; } - cfg->buckets[THROTTLE_OPS_TOTAL].burst_length =3D arg->iops_total_= max_length; + cfg->buckets[THROTTLE_OPS_TOTAL].burst_length =3D arg->iops_max_le= ngth; } - if (arg->has_iops_read_max_length) { - if (arg->iops_read_max_length > UINT_MAX) { + if (arg->has_iops_rd_max_length) { + if (arg->iops_rd_max_length > UINT_MAX) { error_setg(errp, "iops-read-max-length value must be in" " the range [0, %u]", UINT_MAX); return; } - cfg->buckets[THROTTLE_OPS_READ].burst_length =3D arg->iops_read_ma= x_length; + cfg->buckets[THROTTLE_OPS_READ].burst_length =3D arg->iops_rd_max_= length; } - if (arg->has_iops_write_max_length) { - if (arg->iops_write_max_length > UINT_MAX) { + if (arg->has_iops_wr_max_length) { + if (arg->iops_wr_max_length > UINT_MAX) { error_setg(errp, "iops-write-max-length value must be in" " the range [0, %u]", UINT_MAX); return; } - cfg->buckets[THROTTLE_OPS_WRITE].burst_length =3D arg->iops_write_= max_length; + cfg->buckets[THROTTLE_OPS_WRITE].burst_length =3D arg->iops_wr_max= _length; } =20 if (arg->has_iops_size) { cfg->op_size =3D arg->iops_size; } - throttle_is_valid(cfg, errp); } =20 @@ -598,45 +597,45 @@ void throttle_limits_to_config(ThrottleLimits *arg, T= hrottleConfig *cfg, */ void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var) { - var->bps_total =3D cfg->buckets[THROTTLE_BPS_TOTAL].avg; - var->bps_read =3D cfg->buckets[THROTTLE_BPS_READ].avg; - var->bps_write =3D cfg->buckets[THROTTLE_BPS_WRITE].avg; - var->iops_total =3D cfg->buckets[THROTTLE_OPS_TOTAL].avg; - var->iops_read =3D cfg->buckets[THROTTLE_OPS_READ].avg; - var->iops_write =3D cfg->buckets[THROTTLE_OPS_WRITE].avg; - var->bps_total_max =3D cfg->buckets[THROTTLE_BPS_TOTAL].max; - var->bps_read_max =3D cfg->buckets[THROTTLE_BPS_READ].max; - var->bps_write_max =3D cfg->buckets[THROTTLE_BPS_WRITE].max; - var->iops_total_max =3D cfg->buckets[THROTTLE_OPS_TOTAL].max; - var->iops_read_max =3D cfg->buckets[THROTTLE_OPS_READ].max; - var->iops_write_max =3D cfg->buckets[THROTTLE_OPS_WRITE].max; - var->bps_total_max_length =3D cfg->buckets[THROTTLE_BPS_TOTAL].burs= t_length; - var->bps_read_max_length =3D cfg->buckets[THROTTLE_BPS_READ].burst= _length; - var->bps_write_max_length =3D cfg->buckets[THROTTLE_BPS_WRITE].burs= t_length; - var->iops_total_max_length =3D cfg->buckets[THROTTLE_OPS_TOTAL].burs= t_length; - var->iops_read_max_length =3D cfg->buckets[THROTTLE_OPS_READ].burst= _length; - var->iops_write_max_length =3D cfg->buckets[THROTTLE_OPS_WRITE].burs= t_length; - var->iops_size =3D cfg->op_size; - - var->has_bps_total =3D true; - var->has_bps_read =3D true; - var->has_bps_write =3D true; - var->has_iops_total =3D true; - var->has_iops_read =3D true; - var->has_iops_write =3D true; - var->has_bps_total_max =3D true; - var->has_bps_read_max =3D true; - var->has_bps_write_max =3D true; - var->has_iops_total_max =3D true; - var->has_iops_read_max =3D true; - var->has_iops_write_max =3D true; - var->has_bps_read_max_length =3D true; - var->has_bps_total_max_length =3D true; - var->has_bps_write_max_length =3D true; - var->has_iops_total_max_length =3D true; - var->has_iops_read_max_length =3D true; - var->has_iops_write_max_length =3D true; - var->has_iops_size =3D true; + var->bps =3D cfg->buckets[THROTTLE_BPS_TOTAL].avg; + var->bps_rd =3D cfg->buckets[THROTTLE_BPS_READ].avg; + var->bps_wr =3D cfg->buckets[THROTTLE_BPS_WRITE].avg; + var->iops =3D cfg->buckets[THROTTLE_OPS_TOTAL].avg; + var->iops_rd =3D cfg->buckets[THROTTLE_OPS_READ].avg; + var->iops_wr =3D cfg->buckets[THROTTLE_OPS_WRITE].avg; + var->bps_max =3D cfg->buckets[THROTTLE_BPS_TOTAL].max; + var->bps_rd_max =3D cfg->buckets[THROTTLE_BPS_READ].max; + var->bps_wr_max =3D cfg->buckets[THROTTLE_BPS_WRITE].max; + var->iops_max =3D cfg->buckets[THROTTLE_OPS_TOTAL].max; + var->iops_rd_max =3D cfg->buckets[THROTTLE_OPS_READ].max; + var->iops_wr_max =3D cfg->buckets[THROTTLE_OPS_WRITE].max; + var->bps_max_length =3D cfg->buckets[THROTTLE_BPS_TOTAL].burst= _length; + var->bps_rd_max_length =3D cfg->buckets[THROTTLE_BPS_READ].burst_= length; + var->bps_wr_max_length =3D cfg->buckets[THROTTLE_BPS_WRITE].burst= _length; + var->iops_max_length =3D cfg->buckets[THROTTLE_OPS_TOTAL].burst= _length; + var->iops_rd_max_length =3D cfg->buckets[THROTTLE_OPS_READ].burst_= length; + var->iops_wr_max_length =3D cfg->buckets[THROTTLE_OPS_WRITE].burst= _length; + var->iops_size =3D cfg->op_size; + + var->has_bps =3D true; + var->has_bps_rd =3D true; + var->has_bps_wr =3D true; + var->has_iops =3D true; + var->has_iops_rd =3D true; + var->has_iops_wr =3D true; + var->has_bps_max =3D true; + var->has_bps_rd_max =3D true; + var->has_bps_wr_max =3D true; + var->has_iops_max =3D true; + var->has_iops_rd_max =3D true; + var->has_iops_wr_max =3D true; + var->has_bps_rd_max_length =3D true; + var->has_bps_max_length =3D true; + var->has_bps_wr_max_length =3D true; + var->has_iops_max_length =3D true; + var->has_iops_rd_max_length =3D true; + var->has_iops_wr_max_length =3D true; + var->has_iops_size =3D true; } =20 /* parse the throttle options --=20 1.8.3.1