From nobody Thu Nov 6 16:28:07 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 1542355765831644.8027993905355; Fri, 16 Nov 2018 00:09:25 -0800 (PST) Received: from localhost ([::1]:42641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNZBs-0004ip-Gx for importer@patchew.org; Fri, 16 Nov 2018 03:09:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNZ84-0001vx-Pj for qemu-devel@nongnu.org; Fri, 16 Nov 2018 03:05:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNZ81-00060q-I5 for qemu-devel@nongnu.org; Fri, 16 Nov 2018 03:05:28 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:3107 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNZ80-0005ul-Pc for qemu-devel@nongnu.org; Fri, 16 Nov 2018 03:05:25 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B964F9A3B94CF; Fri, 16 Nov 2018 16:05:18 +0800 (CST) Received: from huawei.com (10.143.28.95) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.408.0; Fri, 16 Nov 2018 16:05:10 +0800 From: xiezhide To: Date: Fri, 16 Nov 2018 15:59:35 +0800 Message-ID: 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 X-Received-From: 45.249.212.190 Subject: [Qemu-devel] [PATCH v5 2/6] fsdev-throttle-qmp: Rename the ThrottleLimits member names 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" Rename the ThrottleLimits member names and modify related code Signed-off-by: xiezhide --- qapi/block-core.json | 70 +++++++++++----------- util/throttle.c | 163 +++++++++++++++++++++++++----------------------= ---- 2 files changed, 116 insertions(+), 117 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index d4fe710..4ffaaea 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2240,45 +2240,45 @@ # 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 +# @iops: limit total I/O operations per second +# @iops_max: I/O operations burst +# @iops_max_length: length of the iops_total_max burst period, in seconds +# It must only be set if @iops_total_max is set a= s well. +# @iops_rd: limit read operations per second +# @iops_rd_max: I/O operations read burst +# @iops_rd_max_length: length of the iops_read_max burst period, in seco= nds +# It must only be set if @iops_read_max is set as= well. +# @iops_wr: limit write operations per second +# @iops_wr_max: I/O operations write burst +# @iops_wr_max_length: length of the iops_write_max burst period, in seco= nds +# It must only be set if @iops_write_max is set a= s well. +# @bps: limit total bytes per second +# @bps_max: total bytes burst +# @bps_max_length: length of the bps_total_max burst period, in seconds. +# It must only be set if @bps_total_max is set as= well. +# @bps_rd: limit read bytes per second +# @bps_rd_max: total bytes read burst +# @bps_rd_max_length: length of the bps_read_max burst period, in secon= ds +# It must only be set if @bps_read_max is set as = well. +# @bps_wr: limit write bytes per second +# @bps_wr_max: total bytes write burst +# @bps_wr_max_length: length of the bps_write_max burst period, in secon= ds +# 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' } } + 'data': { '*iops' : 'int', '*iops_max' : 'int', + '*iops_max_length' : 'int', '*iops_rd' : 'int', + '*iops_rd_max' : 'int', '*iops_rd_max_length' : 'int', + '*iops_wr' : 'int', '*iops_wr_max' : 'int', + '*iops_wr_max_length' : 'int', '*bps' : 'int', + '*bps_max' : 'int', '*bps_max_length' : 'int', + '*bps_rd' : 'int', '*bps_rd_max' : 'int', + '*bps_rd_max_length' : 'int', '*bps_wr' : 'int', + '*bps_wr_max' : 'int', '*bps_wr_max_length' : 'int', + '*iops_size' : 'int' } } =20 ## # @block-stream: 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