fsdev-throttle-qmp: qmp interface for fsdev io throttling
Subsystems (2)
v5 cover fsdev-throttle-qmp: qmp interface for fsdev io throttling
This patches provide qmp interface to query/set io throttle parameters of a fsdev. Some of patches also refactor the code and structure that was present in block and fsdev files.
xiezhide (6):
fsdev-throttle-qmp: factor out throttle code to reuse code
fsdev-throttle-qmp: Rename the ThrottleLimits member names
fsdev-throttle-qmp: Rewrite BlockIOThrottle with ThrottleLimits as its
base class
fsdev-throttle-qmp: Move ThrottleLimits into a new file for future
reuse
fsdev-throttle-qmp: qmp interface for fsdev io throttling
fsdev-throttle-qmp: hmp interface for fsdev io throttling
Makefile | 18 ++++ Makefile.objs | 8 ++ block/throttle.c | 6 +- blockdev.c | 45 +------- fsdev/qemu-fsdev-dummy.c | 11 ++ fsdev/qemu-fsdev-throttle.c | 142 +++++++++++++++--------- fsdev/qemu-fsdev-throttle.h | 6 +- fsdev/qemu-fsdev.c | 29 +++++ hmp-commands-info.hx | 15 +++ hmp-commands.hx | 15 +++ hmp.c | 81 ++++++++++++-- hmp.h | 4 + include/qemu/throttle-options.h | 2 + include/qemu/throttle.h | 4 +- include/qemu/typedefs.h | 1 + qapi/block-core.json | 122 +-------------------- qapi/fsdev.json | 96 +++++++++++++++++ qapi/qapi-schema.json | 2 + qapi/tlimits.json | 53 +++++++++ qmp.c | 13 +++ util/throttle.c | 231 ++++++++++++++++++++++++++-------------- 21 files changed, 598 insertions(+), 306 deletions(-) create mode 100644 qapi/fsdev.json create mode 100644 qapi/tlimits.json
v0 -> v1:
Addressed comments from Eric Blake and Greg Kurz.
Fix patch corrupt issue due to email client change the patch format with copy-to-paster Break patch to patches
v1 -> v2:
Addressed comments from Greg Kurz.
send patch with outlook,patch corrupted, resend with git send-email
v2 -> v3:
Addressed comments from Eric Blake.
split patch1 into two patches
v3 -> v4:
Fix issue cause test failed on centos and fedora
v4 -> v5:
Addressed comments from Eric Blake.
split patch3 into three patches
Signature · 1 line
1.8.3.1
PATCH v5 1/6 fsdev-throttle-qmp: factor out throttle code to reuse code
Factor out throttle parameter parsing code to a new common function which will be used by block and fsdev. Rename function throttle_parse_options to throttle_parse_group to resolve function name conflict
--- block/throttle.c | 6 ++-- blockdev.c | 43 +------------------------- fsdev/qemu-fsdev-throttle.c | 44 ++------------------------ include/qemu/throttle-options.h | 2 ++ include/qemu/throttle.h | 4 +-- include/qemu/typedefs.h | 1 + util/throttle.c | 68 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 79 insertions(+), 89 deletions(-)
block/throttle.c +3 -3
@@ -41,7 +41,7 @@ static QemuOptsList throttle_opts = {* @group and must be freed by the caller. * If there's an error then @group remains unmodified. */ -static int throttle_parse_options (QDict *options,char **group,Error **errp) +static int throttle_parse_group (QDict *options,char **group,Error **errp) {int ret;const char *group_name;
@@ -90,7 +90,7 @@ static int throttle_open(BlockDriverState *bs, QDict *options, bs->supported_zero_flags = bs->file->bs->supported_zero_flags |BDRV_REQ_WRITE_UNCHANGED ; - ret =throttle_parse_options (options, &group, errp); + ret =throttle_parse_group (options, &group, errp);if (ret ==0 ) {/* Register membership to group with name group_name */ throttle_group_register_tgm (tgm, group,bdrv_get_aio_context (bs));
@@ -179,7 +179,7 @@ static int throttle_reopen_prepare(BDRVReopenState *reopen_state,assert (reopen_state !=NULL );assert (reopen_state->bs !=NULL ); - ret =throttle_parse_options (reopen_state->options, &group, errp); + ret =throttle_parse_group (reopen_state->options, &group, errp); reopen_state->opaque = group;return ret; }
blockdev.c +1 -42
49 lines not on this page · raw message
fsdev/qemu-fsdev-throttle.c +2 -42
56 lines not on this page · raw message
include/qemu/throttle-options.h +2 -0
@@ -111,4 +111,6 @@ .help = "when limiting by iops max size of an I/O in bytes",\ } +void throttle_parse_options (ThrottleConfig *,QemuOpts *); +#endif
include/qemu/throttle.h +2 -2
@@ -90,10 +90,10 @@ typedef struct LeakyBucket {* However it allows to keep the code clean and the bucket field is reset to * zero at the right time. */ -typedef struct ThrottleConfig { +struct ThrottleConfig {LeakyBucket buckets[BUCKETS_COUNT ];/* leaky buckets */ uint64_t op_size;/* size of an operation in bytes */ -}ThrottleConfig ; +}; typedef struct ThrottleState { ThrottleConfig cfg; /* configuration */
include/qemu/typedefs.h +1 -0
@@ -109,6 +109,7 @@ typedef struct SerialState SerialState;typedef struct SHPCDevice SHPCDevice ;typedef struct SMBusDevice SMBusDevice ;typedef struct SSIBus SSIBus ; +typedef struct ThrottleConfig ThrottleConfig ;typedef struct uWireSlave uWireSlave ;typedef struct VirtIODevice VirtIODevice ;typedef struct Visitor Visitor ;
util/throttle.c +68 -0
77 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v5 2/6 fsdev-throttle-qmp: Rename the ThrottleLimits member names
In reply to xiezhideRename the ThrottleLimits member names and modify related code
--- qapi/block-core.json | 70 +++++++++++----------- util/throttle.c | 163 +++++++++++++++++++++++++-------------------------- 2 files changed, 116 insertions(+), 117 deletions(-)
qapi/block-core.json +35 -35
@@ -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 seconds -# It must only be set if @iops-total-max is set as 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 seconds -# 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 seconds -# It must only be set if @iops-write-max is set as 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 seconds. -# 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 seconds -# 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 seconds -# 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 bytes +# @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 as 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 seconds +# 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 seconds +# It must only be set if @iops_write_max is set as 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 seconds +# 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 seconds +# 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 bytes # # 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' } } ## # @block-stream:
util/throttle.c +81 -82
224 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v5 3/6 fsdev-throttle-qmp: Rewrite BlockIOThrottle with ThrottleLimits as its base class
In reply to xiezhideRewrite BlockIOThrottle with ThrottleLimits as its base class and modify related code
--- blockdev.c | 2 ++ qapi/block-core.json | 73 ++-------------------------------------------------- 2 files changed, 4 insertions(+), 71 deletions(-)
blockdev.c +2 -0
@@ -2752,6 +2752,8 @@ void qmp_block_set_io_throttle(BlockIOThrottle *arg, Error **errp) cfg.op_size = arg->iops_size; } +throttle_limits_to_config (qapi_BlockIOThrottle_base (arg), &cfg, errp); +if (!throttle_is_valid (&cfg, errp)) { goto out; }
qapi/block-core.json +2 -71
84 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v5 4/6 fsdev-throttle-qmp: Move ThrottleLimits into a new file for future reuse
In reply to xiezhideMove ThrottleLimits into a new file for future reuse.
--- Makefile | 9 +++++++++ Makefile.objs | 4 ++++ qapi/block-core.json | 49 +---------------------------------------------- qapi/qapi-schema.json | 1 + qapi/tlimits.json | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+), 48 deletions(-) create mode 100644 qapi/tlimits.json
Makefile +9 -0
@@ -106,6 +106,7 @@ GENERATED_FILES += qapi/qapi-types-sockets.h qapi/qapi-types-sockets.c GENERATED_FILES += qapi/qapi-types-tpm.h qapi/qapi-types-tpm.c GENERATED_FILES += qapi/qapi-types-trace.h qapi/qapi-types-trace.c GENERATED_FILES += qapi/qapi-types-transaction.h qapi/qapi-types-transaction.c +GENERATED_FILES += qapi/qapi-types-tlimits.h qapi/qapi-types-tlimits.c GENERATED_FILES += qapi/qapi-types-ui.h qapi/qapi-types-ui.c GENERATED_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c GENERATED_FILES += qapi/qapi-visit.h qapi/qapi-visit.c
@@ -125,6 +126,7 @@ GENERATED_FILES += qapi/qapi-visit-sockets.h qapi/qapi-visit-sockets.c GENERATED_FILES += qapi/qapi-visit-tpm.h qapi/qapi-visit-tpm.c GENERATED_FILES += qapi/qapi-visit-trace.h qapi/qapi-visit-trace.c GENERATED_FILES += qapi/qapi-visit-transaction.h qapi/qapi-visit-transaction.c +GENERATED_FILES += qapi/qapi-visit-tlimits.h qapi/qapi-visit-tlimits.c GENERATED_FILES += qapi/qapi-visit-ui.h qapi/qapi-visit-ui.c GENERATED_FILES += qapi/qapi-commands.h qapi/qapi-commands.c GENERATED_FILES += qapi/qapi-commands-block-core.h qapi/qapi-commands-block-core.c
@@ -143,6 +145,7 @@ GENERATED_FILES += qapi/qapi-commands-sockets.h qapi/qapi-commands-sockets.c GENERATED_FILES += qapi/qapi-commands-tpm.h qapi/qapi-commands-tpm.c GENERATED_FILES += qapi/qapi-commands-trace.h qapi/qapi-commands-trace.c GENERATED_FILES += qapi/qapi-commands-transaction.h qapi/qapi-commands-transaction.c +GENERATED_FILES += qapi/qapi-commands-tlimits.h qapi/qapi-commands-tlimits.c GENERATED_FILES += qapi/qapi-commands-ui.h qapi/qapi-commands-ui.c GENERATED_FILES += qapi/qapi-events.h qapi/qapi-events.c GENERATED_FILES += qapi/qapi-events-block-core.h qapi/qapi-events-block-core.c
@@ -161,6 +164,7 @@ GENERATED_FILES += qapi/qapi-events-sockets.h qapi/qapi-events-sockets.c GENERATED_FILES += qapi/qapi-events-tpm.h qapi/qapi-events-tpm.c GENERATED_FILES += qapi/qapi-events-trace.h qapi/qapi-events-trace.c GENERATED_FILES += qapi/qapi-events-transaction.h qapi/qapi-events-transaction.c +GENERATED_FILES += qapi/qapi-events-tlimits.h qapi/qapi-events-tlimits.c GENERATED_FILES += qapi/qapi-events-ui.h qapi/qapi-events-ui.c GENERATED_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h GENERATED_FILES += qapi/qapi-doc.texi
@@ -596,6 +600,7 @@ qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json $(SRC_PATH)/qapi/common.json \ $(SRC_PATH)/qapi/run-state.json \ $(SRC_PATH)/qapi/sockets.json \ $(SRC_PATH)/qapi/tpm.json \ + $(SRC_PATH)/qapi/tlimits.json \ $(SRC_PATH)/qapi/trace.json \ $(SRC_PATH)/qapi/transaction.json \ $(SRC_PATH)/qapi/ui.json
@@ -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: \
Makefile.objs +4 -0
@@ -20,6 +20,7 @@ util-obj-y += qapi/qapi-types-sockets.o util-obj-y += qapi/qapi-types-tpm.o util-obj-y += qapi/qapi-types-trace.o util-obj-y += qapi/qapi-types-transaction.o +util-obj-y += qapi/qapi-types-tlimits.o util-obj-y += qapi/qapi-types-ui.o util-obj-y += qapi/qapi-builtin-visit.o util-obj-y += qapi/qapi-visit.o
@@ -39,6 +40,7 @@ util-obj-y += qapi/qapi-visit-sockets.o util-obj-y += qapi/qapi-visit-tpm.o util-obj-y += qapi/qapi-visit-trace.o util-obj-y += qapi/qapi-visit-transaction.o +util-obj-y += qapi/qapi-visit-tlimits.o util-obj-y += qapi/qapi-visit-ui.o util-obj-y += qapi/qapi-events.o util-obj-y += qapi/qapi-events-block-core.o
@@ -57,6 +59,7 @@ util-obj-y += qapi/qapi-events-sockets.o util-obj-y += qapi/qapi-events-tpm.o util-obj-y += qapi/qapi-events-trace.o util-obj-y += qapi/qapi-events-transaction.o +util-obj-y += qapi/qapi-events-tlimits.o util-obj-y += qapi/qapi-events-ui.o util-obj-y += qapi/qapi-introspect.o
@@ -154,6 +157,7 @@ common-obj-y += qapi/qapi-commands-sockets.o common-obj-y += qapi/qapi-commands-tpm.o common-obj-y += qapi/qapi-commands-trace.o common-obj-y += qapi/qapi-commands-transaction.o +common-obj-y += qapi/qapi-commands-tlimits.o common-obj-y += qapi/qapi-commands-ui.o common-obj-y += qapi/qapi-introspect.o common-obj-y += qmp.o hmp.o
qapi/block-core.json +1 -48
61 lines not on this page · raw message
qapi/qapi-schema.json +1 -0
@@ -90,6 +90,7 @@ { 'include': 'tpm.json' } { 'include': 'ui.json' } { 'include': 'migration.json' } +{ 'include': 'tlimits.json' } { 'include': 'transaction.json' } { 'include': 'trace.json' } { 'include': 'introspect.json' }
qapi/tlimits.json new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v5 5/6 fsdev-throttle-qmp: qmp interface for fsdev io throttling
In reply to xiezhideprovides two interfaces:
1. set the IO limits for the required fsdev device
2. query info of all the fsdev devices.
--- Makefile | 27 ++++++++----- Makefile.objs | 12 ++++-- fsdev/qemu-fsdev-dummy.c | 11 +++++ fsdev/qemu-fsdev-throttle.c | 98 ++++++++++++++++++++++++++++++++++++++++++--- fsdev/qemu-fsdev-throttle.h | 6 ++- fsdev/qemu-fsdev.c | 29 ++++++++++++++ qapi/fsdev.json | 96 ++++++++++++++++++++++++++++++++++++++++++++ qapi/qapi-schema.json | 1 + qmp.c | 13 ++++++ 9 files changed, 272 insertions(+), 21 deletions(-) create mode 100644 qapi/fsdev.json
Makefile +18 -9
@@ -95,6 +95,7 @@ GENERATED_FILES += qapi/qapi-types-block.h qapi/qapi-types-block.c GENERATED_FILES += qapi/qapi-types-char.h qapi/qapi-types-char.c GENERATED_FILES += qapi/qapi-types-common.h qapi/qapi-types-common.c GENERATED_FILES += qapi/qapi-types-crypto.h qapi/qapi-types-crypto.c +GENERATED_FILES += qapi/qapi-types-fsdev.h qapi/qapi-types-fsdev.c GENERATED_FILES += qapi/qapi-types-introspect.h qapi/qapi-types-introspect.c GENERATED_FILES += qapi/qapi-types-job.h qapi/qapi-types-job.c GENERATED_FILES += qapi/qapi-types-migration.h qapi/qapi-types-migration.c
@@ -103,10 +104,10 @@ GENERATED_FILES += qapi/qapi-types-net.h qapi/qapi-types-net.c GENERATED_FILES += qapi/qapi-types-rocker.h qapi/qapi-types-rocker.c GENERATED_FILES += qapi/qapi-types-run-state.h qapi/qapi-types-run-state.c GENERATED_FILES += qapi/qapi-types-sockets.h qapi/qapi-types-sockets.c +GENERATED_FILES += qapi/qapi-types-tlimits.h qapi/qapi-types-tlimits.c GENERATED_FILES += qapi/qapi-types-tpm.h qapi/qapi-types-tpm.c GENERATED_FILES += qapi/qapi-types-trace.h qapi/qapi-types-trace.c GENERATED_FILES += qapi/qapi-types-transaction.h qapi/qapi-types-transaction.c -GENERATED_FILES += qapi/qapi-types-tlimits.h qapi/qapi-types-tlimits.c GENERATED_FILES += qapi/qapi-types-ui.h qapi/qapi-types-ui.c GENERATED_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c GENERATED_FILES += qapi/qapi-visit.h qapi/qapi-visit.c
@@ -115,6 +116,7 @@ GENERATED_FILES += qapi/qapi-visit-block.h qapi/qapi-visit-block.c GENERATED_FILES += qapi/qapi-visit-char.h qapi/qapi-visit-char.c GENERATED_FILES += qapi/qapi-visit-common.h qapi/qapi-visit-common.c GENERATED_FILES += qapi/qapi-visit-crypto.h qapi/qapi-visit-crypto.c +GENERATED_FILES += qapi/qapi-visit-fsdev.h qapi/qapi-visit-fsdev.c GENERATED_FILES += qapi/qapi-visit-introspect.h qapi/qapi-visit-introspect.c GENERATED_FILES += qapi/qapi-visit-job.h qapi/qapi-visit-job.c GENERATED_FILES += qapi/qapi-visit-migration.h qapi/qapi-visit-migration.c
@@ -123,10 +125,10 @@ GENERATED_FILES += qapi/qapi-visit-net.h qapi/qapi-visit-net.c GENERATED_FILES += qapi/qapi-visit-rocker.h qapi/qapi-visit-rocker.c GENERATED_FILES += qapi/qapi-visit-run-state.h qapi/qapi-visit-run-state.c GENERATED_FILES += qapi/qapi-visit-sockets.h qapi/qapi-visit-sockets.c +GENERATED_FILES += qapi/qapi-visit-tlimits.h qapi/qapi-visit-tlimits.c GENERATED_FILES += qapi/qapi-visit-tpm.h qapi/qapi-visit-tpm.c GENERATED_FILES += qapi/qapi-visit-trace.h qapi/qapi-visit-trace.c GENERATED_FILES += qapi/qapi-visit-transaction.h qapi/qapi-visit-transaction.c -GENERATED_FILES += qapi/qapi-visit-tlimits.h qapi/qapi-visit-tlimits.c GENERATED_FILES += qapi/qapi-visit-ui.h qapi/qapi-visit-ui.c GENERATED_FILES += qapi/qapi-commands.h qapi/qapi-commands.c GENERATED_FILES += qapi/qapi-commands-block-core.h qapi/qapi-commands-block-core.c
@@ -134,6 +136,7 @@ GENERATED_FILES += qapi/qapi-commands-block.h qapi/qapi-commands-block.c GENERATED_FILES += qapi/qapi-commands-char.h qapi/qapi-commands-char.c GENERATED_FILES += qapi/qapi-commands-common.h qapi/qapi-commands-common.c GENERATED_FILES += qapi/qapi-commands-crypto.h qapi/qapi-commands-crypto.c +GENERATED_FILES += qapi/qapi-commands-fsdev.h qapi/qapi-commands-fsdev.c GENERATED_FILES += qapi/qapi-commands-introspect.h qapi/qapi-commands-introspect.c GENERATED_FILES += qapi/qapi-commands-job.h qapi/qapi-commands-job.c GENERATED_FILES += qapi/qapi-commands-migration.h qapi/qapi-commands-migration.c
@@ -142,10 +145,10 @@ GENERATED_FILES += qapi/qapi-commands-net.h qapi/qapi-commands-net.c GENERATED_FILES += qapi/qapi-commands-rocker.h qapi/qapi-commands-rocker.c GENERATED_FILES += qapi/qapi-commands-run-state.h qapi/qapi-commands-run-state.c GENERATED_FILES += qapi/qapi-commands-sockets.h qapi/qapi-commands-sockets.c +GENERATED_FILES += qapi/qapi-commands-tlimits.h qapi/qapi-commands-tlimits.c GENERATED_FILES += qapi/qapi-commands-tpm.h qapi/qapi-commands-tpm.c GENERATED_FILES += qapi/qapi-commands-trace.h qapi/qapi-commands-trace.c GENERATED_FILES += qapi/qapi-commands-transaction.h qapi/qapi-commands-transaction.c -GENERATED_FILES += qapi/qapi-commands-tlimits.h qapi/qapi-commands-tlimits.c GENERATED_FILES += qapi/qapi-commands-ui.h qapi/qapi-commands-ui.c GENERATED_FILES += qapi/qapi-events.h qapi/qapi-events.c GENERATED_FILES += qapi/qapi-events-block-core.h qapi/qapi-events-block-core.c
@@ -153,6 +156,7 @@ GENERATED_FILES += qapi/qapi-events-block.h qapi/qapi-events-block.c GENERATED_FILES += qapi/qapi-events-char.h qapi/qapi-events-char.c GENERATED_FILES += qapi/qapi-events-common.h qapi/qapi-events-common.c GENERATED_FILES += qapi/qapi-events-crypto.h qapi/qapi-events-crypto.c +GENERATED_FILES += qapi/qapi-events-fsdev.h qapi/qapi-events-fsdev.c GENERATED_FILES += qapi/qapi-events-introspect.h qapi/qapi-events-introspect.c GENERATED_FILES += qapi/qapi-events-job.h qapi/qapi-events-job.c GENERATED_FILES += qapi/qapi-events-migration.h qapi/qapi-events-migration.c
@@ -161,10 +165,10 @@ GENERATED_FILES += qapi/qapi-events-net.h qapi/qapi-events-net.c GENERATED_FILES += qapi/qapi-events-rocker.h qapi/qapi-events-rocker.c GENERATED_FILES += qapi/qapi-events-run-state.h qapi/qapi-events-run-state.c GENERATED_FILES += qapi/qapi-events-sockets.h qapi/qapi-events-sockets.c +GENERATED_FILES += qapi/qapi-events-tlimits.h qapi/qapi-events-tlimits.c GENERATED_FILES += qapi/qapi-events-tpm.h qapi/qapi-events-tpm.c GENERATED_FILES += qapi/qapi-events-trace.h qapi/qapi-events-trace.c GENERATED_FILES += qapi/qapi-events-transaction.h qapi/qapi-events-transaction.c -GENERATED_FILES += qapi/qapi-events-tlimits.h qapi/qapi-events-tlimits.c GENERATED_FILES += qapi/qapi-events-ui.h qapi/qapi-events-ui.c GENERATED_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h GENERATED_FILES += qapi/qapi-doc.texi
@@ -591,6 +595,7 @@ qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json $(SRC_PATH)/qapi/common.json \ $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \ $(SRC_PATH)/qapi/char.json \ $(SRC_PATH)/qapi/crypto.json \ + $(SRC_PATH)/qapi/fsdev.json \ $(SRC_PATH)/qapi/introspect.json \ $(SRC_PATH)/qapi/job.json \ $(SRC_PATH)/qapi/migration.json \
@@ -599,8 +604,8 @@ qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json $(SRC_PATH)/qapi/common.json \ $(SRC_PATH)/qapi/rocker.json \ $(SRC_PATH)/qapi/run-state.json \ $(SRC_PATH)/qapi/sockets.json \ - $(SRC_PATH)/qapi/tpm.json \ $(SRC_PATH)/qapi/tlimits.json \ + $(SRC_PATH)/qapi/tpm.json \ $(SRC_PATH)/qapi/trace.json \ $(SRC_PATH)/qapi/transaction.json \ $(SRC_PATH)/qapi/ui.json
@@ -612,6 +617,7 @@ qapi/qapi-types-block.c qapi/qapi-types-block.h \ qapi/qapi-types-char.c qapi/qapi-types-char.h \ qapi/qapi-types-common.c qapi/qapi-types-common.h \ qapi/qapi-types-crypto.c qapi/qapi-types-crypto.h \ +qapi/qapi-types-fsdev.c qapi/qapi-types-fsdev.h \ qapi/qapi-types-introspect.c qapi/qapi-types-introspect.h \ qapi/qapi-types-job.c qapi/qapi-types-job.h \ qapi/qapi-types-migration.c qapi/qapi-types-migration.h \
@@ -620,10 +626,10 @@ qapi/qapi-types-net.c qapi/qapi-types-net.h \ qapi/qapi-types-rocker.c qapi/qapi-types-rocker.h \ qapi/qapi-types-run-state.c qapi/qapi-types-run-state.h \ qapi/qapi-types-sockets.c qapi/qapi-types-sockets.h \ +qapi/qapi-types-tlimits.c qapi/qapi-types-tlimits.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 \
@@ -632,6 +638,7 @@ qapi/qapi-visit-block.c qapi/qapi-visit-block.h \ qapi/qapi-visit-char.c qapi/qapi-visit-char.h \ qapi/qapi-visit-common.c qapi/qapi-visit-common.h \ qapi/qapi-visit-crypto.c qapi/qapi-visit-crypto.h \ +qapi/qapi-visit-fsdev.c qapi/qapi-visit-fsdev.h \ qapi/qapi-visit-introspect.c qapi/qapi-visit-introspect.h \ qapi/qapi-visit-job.c qapi/qapi-visit-job.h \ qapi/qapi-visit-migration.c qapi/qapi-visit-migration.h \
@@ -640,10 +647,10 @@ qapi/qapi-visit-net.c qapi/qapi-visit-net.h \ qapi/qapi-visit-rocker.c qapi/qapi-visit-rocker.h \ qapi/qapi-visit-run-state.c qapi/qapi-visit-run-state.h \ qapi/qapi-visit-sockets.c qapi/qapi-visit-sockets.h \ +qapi/qapi-visit-tlimits.c qapi/qapi-visit-tlimits.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 \
@@ -651,6 +658,7 @@ qapi/qapi-commands-block.c qapi/qapi-commands-block.h \ qapi/qapi-commands-char.c qapi/qapi-commands-char.h \ qapi/qapi-commands-common.c qapi/qapi-commands-common.h \ qapi/qapi-commands-crypto.c qapi/qapi-commands-crypto.h \ +qapi/qapi-commands-fsdev.c qapi/qapi-commands-fsdev.h \ qapi/qapi-commands-introspect.c qapi/qapi-commands-introspect.h \ qapi/qapi-commands-job.c qapi/qapi-commands-job.h \ qapi/qapi-commands-migration.c qapi/qapi-commands-migration.h \
@@ -659,10 +667,10 @@ qapi/qapi-commands-net.c qapi/qapi-commands-net.h \ qapi/qapi-commands-rocker.c qapi/qapi-commands-rocker.h \ qapi/qapi-commands-run-state.c qapi/qapi-commands-run-state.h \ qapi/qapi-commands-sockets.c qapi/qapi-commands-sockets.h \ +qapi/qapi-commands-tlimits.c qapi/qapi-commands-tlimits.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 \
@@ -670,6 +678,7 @@ qapi/qapi-events-block.c qapi/qapi-events-block.h \ qapi/qapi-events-char.c qapi/qapi-events-char.h \ qapi/qapi-events-common.c qapi/qapi-events-common.h \ qapi/qapi-events-crypto.c qapi/qapi-events-crypto.h \ +qapi/qapi-events-fsdev.c qapi/qapi-events-fsdev.h \ qapi/qapi-events-introspect.c qapi/qapi-events-introspect.h \ qapi/qapi-events-job.c qapi/qapi-events-job.h \ qapi/qapi-events-migration.c qapi/qapi-events-migration.h \
@@ -678,10 +687,10 @@ qapi/qapi-events-net.c qapi/qapi-events-net.h \ qapi/qapi-events-rocker.c qapi/qapi-events-rocker.h \ qapi/qapi-events-run-state.c qapi/qapi-events-run-state.h \ qapi/qapi-events-sockets.c qapi/qapi-events-sockets.h \ +qapi/qapi-events-tlimits.c qapi/qapi-events-tlimits.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: \
Makefile.objs +8 -4
@@ -9,6 +9,7 @@ util-obj-y += qapi/qapi-types-block.o util-obj-y += qapi/qapi-types-char.o util-obj-y += qapi/qapi-types-common.o util-obj-y += qapi/qapi-types-crypto.o +util-obj-y += qapi/qapi-types-fsdev.o util-obj-y += qapi/qapi-types-introspect.o util-obj-y += qapi/qapi-types-job.o util-obj-y += qapi/qapi-types-migration.o
@@ -17,10 +18,10 @@ util-obj-y += qapi/qapi-types-net.o util-obj-y += qapi/qapi-types-rocker.o util-obj-y += qapi/qapi-types-run-state.o util-obj-y += qapi/qapi-types-sockets.o +util-obj-y += qapi/qapi-types-tlimits.o util-obj-y += qapi/qapi-types-tpm.o util-obj-y += qapi/qapi-types-trace.o util-obj-y += qapi/qapi-types-transaction.o -util-obj-y += qapi/qapi-types-tlimits.o util-obj-y += qapi/qapi-types-ui.o util-obj-y += qapi/qapi-builtin-visit.o util-obj-y += qapi/qapi-visit.o
@@ -29,6 +30,7 @@ util-obj-y += qapi/qapi-visit-block.o util-obj-y += qapi/qapi-visit-char.o util-obj-y += qapi/qapi-visit-common.o util-obj-y += qapi/qapi-visit-crypto.o +util-obj-y += qapi/qapi-visit-fsdev.o util-obj-y += qapi/qapi-visit-introspect.o util-obj-y += qapi/qapi-visit-job.o util-obj-y += qapi/qapi-visit-migration.o
@@ -37,10 +39,10 @@ util-obj-y += qapi/qapi-visit-net.o util-obj-y += qapi/qapi-visit-rocker.o util-obj-y += qapi/qapi-visit-run-state.o util-obj-y += qapi/qapi-visit-sockets.o +util-obj-y += qapi/qapi-visit-tlimits.o util-obj-y += qapi/qapi-visit-tpm.o util-obj-y += qapi/qapi-visit-trace.o util-obj-y += qapi/qapi-visit-transaction.o -util-obj-y += qapi/qapi-visit-tlimits.o util-obj-y += qapi/qapi-visit-ui.o util-obj-y += qapi/qapi-events.o util-obj-y += qapi/qapi-events-block-core.o
@@ -48,6 +50,7 @@ util-obj-y += qapi/qapi-events-block.o util-obj-y += qapi/qapi-events-char.o util-obj-y += qapi/qapi-events-common.o util-obj-y += qapi/qapi-events-crypto.o +util-obj-y += qapi/qapi-events-fsdev.o util-obj-y += qapi/qapi-events-introspect.o util-obj-y += qapi/qapi-events-job.o util-obj-y += qapi/qapi-events-migration.o
@@ -56,10 +59,10 @@ util-obj-y += qapi/qapi-events-net.o util-obj-y += qapi/qapi-events-rocker.o util-obj-y += qapi/qapi-events-run-state.o util-obj-y += qapi/qapi-events-sockets.o +util-obj-y += qapi/qapi-events-tlimits.o util-obj-y += qapi/qapi-events-tpm.o util-obj-y += qapi/qapi-events-trace.o util-obj-y += qapi/qapi-events-transaction.o -util-obj-y += qapi/qapi-events-tlimits.o util-obj-y += qapi/qapi-events-ui.o util-obj-y += qapi/qapi-introspect.o
@@ -146,6 +149,7 @@ common-obj-y += qapi/qapi-commands-block.o common-obj-y += qapi/qapi-commands-char.o common-obj-y += qapi/qapi-commands-common.o common-obj-y += qapi/qapi-commands-crypto.o +common-obj-y += qapi/qapi-commands-fsdev.o common-obj-y += qapi/qapi-commands-introspect.o common-obj-y += qapi/qapi-commands-job.o common-obj-y += qapi/qapi-commands-migration.o
@@ -154,10 +158,10 @@ common-obj-y += qapi/qapi-commands-net.o common-obj-y += qapi/qapi-commands-rocker.o common-obj-y += qapi/qapi-commands-run-state.o common-obj-y += qapi/qapi-commands-sockets.o +common-obj-y += qapi/qapi-commands-tlimits.o common-obj-y += qapi/qapi-commands-tpm.o common-obj-y += qapi/qapi-commands-trace.o common-obj-y += qapi/qapi-commands-transaction.o -common-obj-y += qapi/qapi-commands-tlimits.o common-obj-y += qapi/qapi-commands-ui.o common-obj-y += qapi/qapi-introspect.o common-obj-y += qmp.o hmp.o
fsdev/qemu-fsdev-dummy.c +11 -0
@@ -14,8 +14,19 @@#include "qemu-fsdev.h" #include "qemu/config-file.h" #include "qemu/module.h" +#include "qapi/qapi-commands-fsdev.h" int qemu_fsdev_add (QemuOpts *opts,Error **errp) {return 0 ; } + +void qmp_fsdev_set_io_throttle (FsdevIOThrottle *arg,Error **errp) +{ +return ; +} + +FsdevIOThrottleList *qmp_query_fsdev_io_throttle (Error **errp) +{ +return NULL ; +}
fsdev/qemu-fsdev-throttle.c +92 -6
123 lines not on this page · raw message
fsdev/qemu-fsdev-throttle.h +4 -2
@@ -15,15 +15,15 @@#ifndef _FSDEV_THROTTLE_H#define _FSDEV_THROTTLE_H -#include "block/aio.h" -#include "qemu/main-loop.h" #include "qemu/coroutine.h" #include "qemu/throttle.h" +#include "qapi/qapi-types-fsdev.h" typedef struct FsThrottle {ThrottleState ts;ThrottleTimers tt;ThrottleConfig cfg; +AioContext *ctx;CoQueue throttled_reqs[2 ]; }FsThrottle ;
@@ -35,4 +35,6 @@ void coroutine_fn fsdev_co_throttle_request(FsThrottle *, bool , struct iovec *, int);void fsdev_throttle_cleanup (FsThrottle *); +void fsdev_set_io_throttle (FsdevIOThrottle *,FsThrottle *,Error **errp); +void fsdev_get_io_throttle (FsThrottle *,FsdevIOThrottle **iothp,char *);#endif /* _FSDEV_THROTTLE_H */
fsdev/qemu-fsdev.c +29 -0
@@ -17,6 +17,7 @@#include "qemu/config-file.h" #include "qemu/error-report.h" #include "qemu/option.h" +#include "qapi/qapi-commands-fsdev.h" static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries =QTAILQ_HEAD_INITIALIZER (fsdriver_entries);
@@ -99,3 +100,31 @@ FsDriverEntry *get_fsdev_fsentry(char *id) }return NULL ; } + +void qmp_fsdev_set_io_throttle (FsdevIOThrottle *arg,Error **errp) +{ +FsDriverEntry *fse; + + fse =get_fsdev_fsentry (arg->has_id ? arg->id :NULL ); +if (!fse) { +error_setg (errp,"Not a valid fsdev device" ); +return ; + } + +fsdev_set_io_throttle (arg, &fse->fst, errp); +} + +FsdevIOThrottleList *qmp_query_fsdev_io_throttle (Error **errp) +{ +FsdevIOThrottleList *head =NULL , *p_next; +struct FsDriverListEntry *fsle; + + QTAILQ_FOREACH(fsle, &fsdriver_entries, next) { + p_next =g_new0 (FsdevIOThrottleList,1 ); +fsdev_get_io_throttle (&fsle->fse.fst, &p_next->value, + fsle->fse.fsdev_id); + p_next->next = head; + head = p_next; + } +return head; +}
qapi/fsdev.json new file +96 -0
96 lines not on this page · raw message
qapi/qapi-schema.json +1 -0
@@ -95,3 +95,4 @@ { 'include': 'trace.json' } { 'include': 'introspect.json' } { 'include': 'misc.json' } +{ 'include': 'fsdev.json' }
qmp.c +13 -0
@@ -32,6 +32,7 @@#include "qom/qom-qobject.h" #include "qapi/error.h" #include "qapi/qapi-commands-block-core.h" +#include "qapi/qapi-commands-fsdev.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qdict.h"
@@ -737,3 +738,15 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)return mem_info; } + +#if defined(_WIN64) || defined(_WIN32) || defined(__FreeBSD__) +void qmp_fsdev_set_io_throttle (FsdevIOThrottle *arg,Error **errp) +{ +return ; +} + +FsdevIOThrottleList *qmp_query_fsdev_io_throttle (Error **errp) +{ +return NULL ; +} +#endif
Signature · 1 line
1.8.3.1
PATCH v5 6/6 fsdev-throttle-qmp: hmp interface for fsdev io throttling
In reply to xiezhideintroduces io throttling hmp interfaces for the fsdev devices
--- hmp-commands-info.hx | 15 ++++++++++ hmp-commands.hx | 15 ++++++++++ hmp.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++------ hmp.h | 4 +++ 4 files changed, 107 insertions(+), 8 deletions(-)
hmp-commands-info.hx +15 -0
@@ -100,6 +100,21 @@ STEXI Show progress of ongoing block device operations. ETEXI +#if defined(CONFIG_VIRTFS) + { + .name = "fsdev_iothrottle", + .args_type = "", + .params = "", + .help = "show fsdev iothrottle information", + .cmd = hmp_info_fsdev_iothrottle, + }, +#endif +STEXI +@item info fsdev_iothrottle +@findex fsdev_iothrottle +Show fsdev device throttle info. +ETEXI + { .name = "registers", .args_type = "cpustate_all:-a",
hmp-commands.hx +15 -0
@@ -1716,6 +1716,21 @@ Change I/O throttle limits for a block drive to @var{bps} @var{bps_rd} @var{bps_ @var{device} can be a block device name, a qdev ID or a QOM path. ETEXI +#if defined(CONFIG_VIRTFS) + { + .name = "fsdev_set_io_throttle", + .args_type = "device:B,bps:l,bps_rd:l,bps_wr:l,iops:l,iops_rd:l,iops_wr:l", + .params = "device bps bps_rd bps_wr iops iops_rd iops_wr", + .help = "change I/O throttle limits for a fs devices", + .cmd = hmp_fsdev_set_io_throttle, + }, +#endif +STEXI +@item fsdev_set_io_throttle @var{device} @var{bps} @var{bps_rd} @var{bps_wr} @var{iops} @var{iops_rd} @var{iops_wr} +@findex fsdev_set_io_throttle +Change I/O throttle limits for a fs devices to @var{bps} @var{bps_rd} @var{bps_wr} @var{iops} @var{iops_rd} @var{iops_wr} +ETEXI + { .name = "set_password", .args_type = "protocol:s,password:s,connected:s?",
hmp.c +73 -8
107 lines not on this page · raw message
hmp.h +4 -0
@@ -91,6 +91,10 @@ void hmp_block_job_cancel(Monitor *mon, const QDict *qdict);void hmp_block_job_pause (Monitor *mon,const QDict *qdict);void hmp_block_job_resume (Monitor *mon,const QDict *qdict);void hmp_block_job_complete (Monitor *mon,const QDict *qdict); +#ifdef CONFIG_VIRTFS +void hmp_fsdev_set_io_throttle (Monitor *mon,const QDict *qdict); +void hmp_info_fsdev_iothrottle (Monitor *mon,const QDict *qdict); +#endif void hmp_migrate (Monitor *mon,const QDict *qdict);void hmp_device_add (Monitor *mon,const QDict *qdict);void hmp_device_del (Monitor *mon,const QDict *qdict);
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH v5 1/6] fsdev-throttle-qmp: factor out throttle code to reuse code
In reply to xiezhideQuoted 8 lines · On Fri, 16 Nov 2018 15:59:16 +0800 xiezhide <[email protected]> wrote:
Factor out throttle parameter parsing code to a new common function which will be used by block and fsdev. Rename function
throttle_parse_optionstothrottle_parse_groupto resolve function name conflictReviewed-by Eric Blake <[email protected]>Signed-off-by xiezhide <[email protected]>---
And, since I guess this will likely go through someone else's tree, for the fsdev changes:
Quoted 279 lines
block/throttle.c | 6 ++-- blockdev.c | 43 +------------------------- fsdev/qemu-fsdev-throttle.c | 44 ++------------------------ include/qemu/throttle-options.h | 2 ++ include/qemu/throttle.h | 4 +-- include/qemu/typedefs.h | 1 + util/throttle.c | 68 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 79 insertions(+), 89 deletions(-)block/throttle.c +3
-3@@ -41,7 +41,7 @@ static QemuOptsList throttle_opts = {* @group and must be freed by the caller. * If there's an error then @group remains unmodified. */ -static int throttle_parse_options (QDict *options,char **group,Error **errp) +static int throttle_parse_group (QDict *options,char **group,Error **errp) {int ret;const char *group_name;@@ -90,7 +90,7 @@ static int throttle_open(BlockDriverState *bs, QDict *options, bs->supported_zero_flags = bs->file->bs->supported_zero_flags |BDRV_REQ_WRITE_UNCHANGED ; - ret =throttle_parse_options (options, &group, errp); + ret =throttle_parse_group (options, &group, errp);if (ret ==0 ) {/* Register membership to group with name group_name */ throttle_group_register_tgm (tgm, group,bdrv_get_aio_context (bs));@@ -179,7 +179,7 @@ static int throttle_reopen_prepare(BDRVReopenState *reopen_state,assert (reopen_state !=NULL );assert (reopen_state->bs !=NULL ); - ret =throttle_parse_options (reopen_state->options, &group, errp); + ret =throttle_parse_group (reopen_state->options, &group, errp); reopen_state->opaque = group;return ret; }blockdev.c +1
-42@@ -400,48 +400,7 @@ static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags, }if (throttle_cfg) { -throttle_config_init (throttle_cfg); - throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].avg = -qemu_opt_get_number (opts,"throttling.bps-total" ,0 ); - throttle_cfg->buckets[THROTTLE_BPS_READ ].avg = -qemu_opt_get_number (opts,"throttling.bps-read" ,0 ); - throttle_cfg->buckets[THROTTLE_BPS_WRITE ].avg = -qemu_opt_get_number (opts,"throttling.bps-write" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].avg = -qemu_opt_get_number (opts,"throttling.iops-total" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_READ ].avg = -qemu_opt_get_number (opts,"throttling.iops-read" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_WRITE ].avg = -qemu_opt_get_number (opts,"throttling.iops-write" ,0 ); - - throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].max = -qemu_opt_get_number (opts,"throttling.bps-total-max" ,0 ); - throttle_cfg->buckets[THROTTLE_BPS_READ ].max = -qemu_opt_get_number (opts,"throttling.bps-read-max" ,0 ); - throttle_cfg->buckets[THROTTLE_BPS_WRITE ].max = -qemu_opt_get_number (opts,"throttling.bps-write-max" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].max = -qemu_opt_get_number (opts,"throttling.iops-total-max" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_READ ].max = -qemu_opt_get_number (opts,"throttling.iops-read-max" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_WRITE ].max = -qemu_opt_get_number (opts,"throttling.iops-write-max" ,0 ); - - throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].burst_length = -qemu_opt_get_number (opts,"throttling.bps-total-max-length" ,1 ); - throttle_cfg->buckets[THROTTLE_BPS_READ ].burst_length = -qemu_opt_get_number (opts,"throttling.bps-read-max-length" ,1 ); - throttle_cfg->buckets[THROTTLE_BPS_WRITE ].burst_length = -qemu_opt_get_number (opts,"throttling.bps-write-max-length" ,1 ); - throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].burst_length = -qemu_opt_get_number (opts,"throttling.iops-total-max-length" ,1 ); - throttle_cfg->buckets[THROTTLE_OPS_READ ].burst_length = -qemu_opt_get_number (opts,"throttling.iops-read-max-length" ,1 ); - throttle_cfg->buckets[THROTTLE_OPS_WRITE ].burst_length = -qemu_opt_get_number (opts,"throttling.iops-write-max-length" ,1 ); - - throttle_cfg->op_size = -qemu_opt_get_number (opts,"throttling.iops-size" ,0 ); +throttle_parse_options (throttle_cfg, opts);if (!throttle_is_valid (throttle_cfg, errp)) {return ;fsdev/qemu-fsdev-throttle.c +2
-42@@ -17,6 +17,7 @@#include "qemu-fsdev-throttle.h" #include "qemu/iov.h" #include "qemu/option.h" +#include "qemu/throttle-options.h" static void fsdev_throttle_read_timer_cb (void *opaque) {@@ -32,48 +33,7 @@ static void fsdev_throttle_write_timer_cb(void *opaque)void fsdev_throttle_parse_opts (QemuOpts *opts,FsThrottle *fst,Error **errp) { -throttle_config_init (&fst->cfg); - fst->cfg.buckets[THROTTLE_BPS_TOTAL ].avg = -qemu_opt_get_number (opts,"throttling.bps-total" ,0 ); - fst->cfg.buckets[THROTTLE_BPS_READ ].avg = -qemu_opt_get_number (opts,"throttling.bps-read" ,0 ); - fst->cfg.buckets[THROTTLE_BPS_WRITE ].avg = -qemu_opt_get_number (opts,"throttling.bps-write" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_TOTAL ].avg = -qemu_opt_get_number (opts,"throttling.iops-total" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_READ ].avg = -qemu_opt_get_number (opts,"throttling.iops-read" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_WRITE ].avg = -qemu_opt_get_number (opts,"throttling.iops-write" ,0 ); - - fst->cfg.buckets[THROTTLE_BPS_TOTAL ].max = -qemu_opt_get_number (opts,"throttling.bps-total-max" ,0 ); - fst->cfg.buckets[THROTTLE_BPS_READ ].max = -qemu_opt_get_number (opts,"throttling.bps-read-max" ,0 ); - fst->cfg.buckets[THROTTLE_BPS_WRITE ].max = -qemu_opt_get_number (opts,"throttling.bps-write-max" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_TOTAL ].max = -qemu_opt_get_number (opts,"throttling.iops-total-max" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_READ ].max = -qemu_opt_get_number (opts,"throttling.iops-read-max" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_WRITE ].max = -qemu_opt_get_number (opts,"throttling.iops-write-max" ,0 ); - - fst->cfg.buckets[THROTTLE_BPS_TOTAL ].burst_length = -qemu_opt_get_number (opts,"throttling.bps-total-max-length" ,1 ); - fst->cfg.buckets[THROTTLE_BPS_READ ].burst_length = -qemu_opt_get_number (opts,"throttling.bps-read-max-length" ,1 ); - fst->cfg.buckets[THROTTLE_BPS_WRITE ].burst_length = -qemu_opt_get_number (opts,"throttling.bps-write-max-length" ,1 ); - fst->cfg.buckets[THROTTLE_OPS_TOTAL ].burst_length = -qemu_opt_get_number (opts,"throttling.iops-total-max-length" ,1 ); - fst->cfg.buckets[THROTTLE_OPS_READ ].burst_length = -qemu_opt_get_number (opts,"throttling.iops-read-max-length" ,1 ); - fst->cfg.buckets[THROTTLE_OPS_WRITE ].burst_length = -qemu_opt_get_number (opts,"throttling.iops-write-max-length" ,1 ); - fst->cfg.op_size = -qemu_opt_get_number (opts,"throttling.iops-size" ,0 ); - +throttle_parse_options (&fst->cfg, opts);throttle_is_valid (&fst->cfg, errp); }include/qemu/throttle-options.h +2
-0@@ -111,4 +111,6 @@ .help = "when limiting by iops max size of an I/O in bytes",\ } +void throttle_parse_options (ThrottleConfig *,QemuOpts *); +#endif include/qemu/throttle.h +2
-2@@ -90,10 +90,10 @@ typedef struct LeakyBucket {* However it allows to keep the code clean and the bucket field is reset to * zero at the right time. */ -typedef struct ThrottleConfig { +struct ThrottleConfig {LeakyBucket buckets[BUCKETS_COUNT ];/* leaky buckets */ uint64_t op_size;/* size of an operation in bytes */ -}ThrottleConfig ; +}; typedef struct ThrottleState { ThrottleConfig cfg; /* configuration */include/qemu/typedefs.h +1
-0@@ -109,6 +109,7 @@ typedef struct SerialState SerialState;typedef struct SHPCDevice SHPCDevice ;typedef struct SMBusDevice SMBusDevice ;typedef struct SSIBus SSIBus ; +typedef struct ThrottleConfig ThrottleConfig ;typedef struct uWireSlave uWireSlave ;typedef struct VirtIODevice VirtIODevice ;typedef struct Visitor Visitor ;util/throttle.c +68
-0@@ -27,6 +27,8 @@#include "qemu/throttle.h" #include "qemu/timer.h" #include "block/aio.h" +#include "qemu/option.h" +#include "qemu/throttle-options.h" /* This function make a bucket leak * @@ -636,3 +638,69 @@ void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var) var->has_iops_write_max_length = true; var->has_iops_size = true; } + +/* parse the throttle options +* +* @opts: qemu options +* @throttle_cfg: throttle configuration +*/ +void throttle_parse_options (ThrottleConfig *throttle_cfg,QemuOpts *opts) +{ +throttle_config_init (throttle_cfg); + throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_BPS_TOTAL, 0); + throttle_cfg->buckets[THROTTLE_BPS_READ ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_BPS_READ, 0); + throttle_cfg->buckets[THROTTLE_BPS_WRITE ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_BPS_WRITE, 0); + throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_IOPS_TOTAL, 0); + throttle_cfg->buckets[THROTTLE_OPS_READ ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_IOPS_READ, 0); + throttle_cfg->buckets[THROTTLE_OPS_WRITE ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_IOPS_WRITE, 0); + throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_BPS_TOTAL_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_BPS_READ ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_BPS_READ_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_BPS_WRITE ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_BPS_WRITE_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_IOPS_TOTAL_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_OPS_READ ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_IOPS_READ_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_OPS_WRITE ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_IOPS_WRITE_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_BPS_TOTAL_MAX_LENGTH ,1 ); + throttle_cfg->buckets[THROTTLE_BPS_READ ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_BPS_READ_MAX_LENGTH ,1 ); + throttle_cfg->buckets[THROTTLE_BPS_WRITE ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_BPS_WRITE_MAX_LENGTH ,1 ); + throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_IOPS_TOTAL_MAX_LENGTH ,1 ); + throttle_cfg->buckets[THROTTLE_OPS_READ ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_IOPS_READ_MAX_LENGTH ,1 ); + throttle_cfg->buckets[THROTTLE_OPS_WRITE ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_IOPS_WRITE_MAX_LENGTH ,1 ); + throttle_cfg->op_size = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX QEMU_OPT_IOPS_SIZE, 0); +}
Re: [Qemu-devel] [PATCH v5 1/6] fsdev-throttle-qmp: factor out throttle code to reuse code
Quoted 21 lines
-----Original Message-----
From: Greg Kurz [mailto:[email protected]]
Sent: Thursday, November 22, 2018 10:46 PM
To: xiezhide <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; zengcanfu 00215970 <[email protected]>; Jinxuefeng <[email protected]>; Chenhui (Felix, Euler) <[email protected]>
Subject: Re: [PATCH v5 1/6] fsdev-throttle-qmp: factor out throttle code to reuse codeQuoted 5 lines · On Fri, 16 Nov 2018 15:59:16 +0800 xiezhide <[email protected]> wrote:
Factor out throttle parameter parsing code to a new common function which will be used by block and fsdev.
Rename functionthrottle_parse_optionstothrottle_parse_groupto resolve function name conflict
Quoted 8 lines
Quoted 3 lines
Reviewed-by Eric Blake <[email protected]>Signed-off-by xiezhide <[email protected]>---
Reviewed-by Greg Kurz <[email protected]>And, since I guess this will likely go through someone else's tree, for the fsdev changes:
Yes,Pradeep Jagadeesh<[email protected]> had done some work for this, and I take it over now
Quoted 301 lines
Acked-by Greg Kurz <[email protected]>Quoted 7 lines
block/throttle.c | 6 ++-- blockdev.c | 43 +------------------------- fsdev/qemu-fsdev-throttle.c | 44 ++------------------------ include/qemu/throttle-options.h | 2 ++ include/qemu/throttle.h | 4 +-- include/qemu/typedefs.h | 1 + util/throttle.c | 68+++++++++++++++++++++++++++++++++++++++++
block/throttle.c static int throttle_open(BlockDriverState *bs, QDict
Quoted 18 lines
7 files changed, 79 insertions(+), 89 deletions(-)block/throttle.c index renamed from block/throttle.c +0
-0636c976..bd23c58 100644
block/throttle.c +2
-1@@ -41,7 +41,7 @@ static QemuOptsList throttle_opts = {* @group and must be freed by the caller. * If there's an error then @group remains unmodified. */ -static int throttle_parse_options (QDict *options,char **group,Error **errp) +static int throttle_parse_group (QDict *options,char **group,Error +**errp) {int ret;const char *group_name;@@ -90,7 +90,7 @@ static int throttle_open(BlockDriverState *bs, QDict*options,
Quoted 9 lines
block/throttle.c +1
-1bs->supported_zero_flags = bs->file->bs->supported_zero_flags |BDRV_REQ_WRITE_UNCHANGED ; - ret =throttle_parse_options (options, &group, errp); + ret =throttle_parse_group (options, &group, errp);if (ret ==0 ) {/* Register membership to group with name group_name */ throttle_group_register_tgm(tgm, group,
bdrv_get_aio_context(bs)); @@ -179,7 +179,7 @@ static intthrottle_reopen_prepare(BDRVReopenState
*reopen_state,blockdev.c static void
Quoted 13 lines
assert(reopen_state != NULL); assert(reopen_state->bs != NULL);block/throttle.c +1
-1- ret =throttle_parse_options (reopen_state->options, &group, errp); + ret =throttle_parse_group (reopen_state->options, &group, errp); reopen_state->opaque = group;return ret; }blockdev.c +0
-0@@ -400,48 +400,7 @@ static voidextract_common_blockdev_options(QemuOpts *opts, int
*bdrv_flags,Quoted 22 lines
blockdev.c +0
-19}if (throttle_cfg) { -throttle_config_init (throttle_cfg); - throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].avg = -qemu_opt_get_number (opts,"throttling.bps-total" ,0 ); - throttle_cfg->buckets[THROTTLE_BPS_READ ].avg = -qemu_opt_get_number (opts,"throttling.bps-read" ,0 ); - throttle_cfg->buckets[THROTTLE_BPS_WRITE ].avg = -qemu_opt_get_number (opts,"throttling.bps-write" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].avg = -qemu_opt_get_number (opts,"throttling.iops-total" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_READ ].avg = -qemu_opt_get_number (opts,"throttling.iops-read" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_WRITE ].avg = -qemu_opt_get_number (opts,"throttling.iops-write" ,0 ); - - throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].max = -qemu_opt_get_number (opts,"throttling.bps-total-max" ,0 ); - throttle_cfg->buckets[THROTTLE_BPS_READ ].max = -qemu_opt_get_number (opts,"throttling.bps-read-max" ,0 ); - throttle_cfg->buckets[THROTTLE_BPS_WRITE].max =blockdev.c static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags,
Quoted 10 lines
blockdev.c +0
-10-qemu_opt_get_number (opts,"throttling.bps-write-max" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].max = -qemu_opt_get_number (opts,"throttling.iops-total-max" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_READ ].max = -qemu_opt_get_number (opts,"throttling.iops-read-max" ,0 ); - throttle_cfg->buckets[THROTTLE_OPS_WRITE ].max = -qemu_opt_get_number (opts,"throttling.iops-write-max" ,0 ); - - throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].burst_length = - qemu_opt_get_number(opts,"throttling.bps-total-max-length", 1);
blockdev.c static void · line 433
Quoted 2 lines
blockdev.c +0
-2- throttle_cfg->buckets[THROTTLE_BPS_READ ].burst_length = - qemu_opt_get_number(opts,"throttling.bps-read-max-length", 1);
blockdev.c static void · line 435
Quoted 2 lines
blockdev.c +0
-2- throttle_cfg->buckets[THROTTLE_BPS_WRITE ].burst_length = - qemu_opt_get_number(opts,"throttling.bps-write-max-length", 1);
blockdev.c static void · line 437
Quoted 2 lines
blockdev.c +0
-2- throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].burst_length = - qemu_opt_get_number(opts,"throttling.iops-total-max-length", 1);
blockdev.c static void · line 439
Quoted 2 lines
blockdev.c +0
-2- throttle_cfg->buckets[THROTTLE_OPS_READ ].burst_length = - qemu_opt_get_number(opts,"throttling.iops-read-max-length", 1);
blockdev.c static void · line 441
Quoted 2 lines
blockdev.c +0
-2- throttle_cfg->buckets[THROTTLE_OPS_WRITE ].burst_length = - qemu_opt_get_number(opts,"throttling.iops-write-max-length", 1);
Quoted 41 lines
blockdev.c +1
-3- - throttle_cfg->op_size = -qemu_opt_get_number (opts,"throttling.iops-size" ,0 ); +throttle_parse_options (throttle_cfg, opts);if (!throttle_is_valid (throttle_cfg, errp)) {return ;fsdev/qemu-fsdev-throttle.c +2
-0@@ -17,6 +17,7 @@#include "qemu-fsdev-throttle.h" #include "qemu/iov.h" #include "qemu/option.h" +#include "qemu/throttle-options.h" static void fsdev_throttle_read_timer_cb(void *opaque) { @@ -32,48 +33,7 @@ static void fsdev_throttle_write_timer_cb(void *opaque) void fsdev_throttle_parse_opts(QemuOpts *opts, FsThrottle *fst, Error**errp) {
fsdev/qemu-fsdev-throttle.c +0
-19-throttle_config_init (&fst->cfg); - fst->cfg.buckets[THROTTLE_BPS_TOTAL ].avg = -qemu_opt_get_number (opts,"throttling.bps-total" ,0 ); - fst->cfg.buckets[THROTTLE_BPS_READ ].avg = -qemu_opt_get_number (opts,"throttling.bps-read" ,0 ); - fst->cfg.buckets[THROTTLE_BPS_WRITE ].avg = -qemu_opt_get_number (opts,"throttling.bps-write" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_TOTAL ].avg = -qemu_opt_get_number (opts,"throttling.iops-total" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_READ ].avg = -qemu_opt_get_number (opts,"throttling.iops-read" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_WRITE ].avg = -qemu_opt_get_number (opts,"throttling.iops-write" ,0 ); - - fst->cfg.buckets[THROTTLE_BPS_TOTAL ].max = -qemu_opt_get_number (opts,"throttling.bps-total-max" ,0 ); - fst->cfg.buckets[THROTTLE_BPS_READ ].max = -qemu_opt_get_number (opts,"throttling.bps-read-max" ,0 ); - fst->cfg.buckets[THROTTLE_BPS_WRITE].max =fsdev/qemu-fsdev-throttle.c static void fsdev_throttle_write_timer_cb(void *opaque)
Quoted 10 lines
fsdev/qemu-fsdev-throttle.c +0
-10-qemu_opt_get_number (opts,"throttling.bps-write-max" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_TOTAL ].max = -qemu_opt_get_number (opts,"throttling.iops-total-max" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_READ ].max = -qemu_opt_get_number (opts,"throttling.iops-read-max" ,0 ); - fst->cfg.buckets[THROTTLE_OPS_WRITE ].max = -qemu_opt_get_number (opts,"throttling.iops-write-max" ,0 ); - - fst->cfg.buckets[THROTTLE_BPS_TOTAL ].burst_length = - qemu_opt_get_number(opts, "throttling.bps-total-max-length",1);
fsdev/qemu-fsdev-throttle.c
Quoted 2 lines
fsdev/qemu-fsdev-throttle.c +0
-2- fst->cfg.buckets[THROTTLE_BPS_READ ].burst_length = - qemu_opt_get_number(opts, "throttling.bps-read-max-length",1);
fsdev/qemu-fsdev-throttle.c
Quoted 2 lines
fsdev/qemu-fsdev-throttle.c +0
-2- fst->cfg.buckets[THROTTLE_BPS_WRITE ].burst_length = - qemu_opt_get_number(opts, "throttling.bps-write-max-length",1);
fsdev/qemu-fsdev-throttle.c
Quoted 2 lines
fsdev/qemu-fsdev-throttle.c +0
-2- fst->cfg.buckets[THROTTLE_OPS_TOTAL ].burst_length = - qemu_opt_get_number(opts, "throttling.iops-total-max-length",1);
fsdev/qemu-fsdev-throttle.c
Quoted 2 lines
fsdev/qemu-fsdev-throttle.c +0
-2- fst->cfg.buckets[THROTTLE_OPS_READ ].burst_length = - qemu_opt_get_number(opts, "throttling.iops-read-max-length",1);
fsdev/qemu-fsdev-throttle.c
Quoted 2 lines
fsdev/qemu-fsdev-throttle.c +0
-2- fst->cfg.buckets[THROTTLE_OPS_WRITE ].burst_length = - qemu_opt_get_number(opts, "throttling.iops-write-max-length",1);
util/throttle.c void throttle_config_to_limits(ThrottleConfig *cfg,
Quoted 57 lines
fsdev/qemu-fsdev-throttle.c +1
-3- fst->cfg.op_size = -qemu_opt_get_number (opts,"throttling.iops-size" ,0 ); - +throttle_parse_options (&fst->cfg, opts);throttle_is_valid (&fst->cfg, errp); }(quoted diff) +0
-0
b/include/qemu/throttle-options.hindex 3528a8f..944a08c 100644include/qemu/throttle-options.h +2
-0@@ -111,4 +111,6 @@ .help = "when limiting by iops max size of an I/O in bytes",\ } +void throttle_parse_options (ThrottleConfig *,QemuOpts *); +#endif include/qemu/throttle.h index renamed from include/qemu/throttle.h +0
-0abeb886..f379d91 100644
include/qemu/throttle.h +2
-2@@ -90,10 +90,10 @@ typedef struct LeakyBucket {* However it allows to keep the code clean and the bucket field is reset to * zero at the right time. */ -typedef struct ThrottleConfig { +struct ThrottleConfig {LeakyBucket buckets[BUCKETS_COUNT ];/* leaky buckets */ uint64_t op_size;/* size of an operation in bytes */ -}ThrottleConfig ; +}; typedef struct ThrottleState { ThrottleConfig cfg; /* configuration */include/qemu/typedefs.h index renamed from include/qemu/typedefs.h +0
-03ec0e13..0d75edc 100644
include/qemu/typedefs.h +1
-0@@ -109,6 +109,7 @@ typedef struct SerialState SerialState; typedefstruct SHPCDevice SHPCDevice;typedef struct SMBusDevice SMBusDevice ;typedef struct SSIBus SSIBus ; +typedef struct ThrottleConfig ThrottleConfig ; typedef struct uWireSlave uWireSlave; typedef struct VirtIODeviceVirtIODevice; typedef struct Visitor Visitor; diff --git
a/util/throttle.cb/util/throttle.cindex b38e742..e7db2ad 100644util/throttle.c +2
-0@@ -27,6 +27,8 @@#include "qemu/throttle.h" #include "qemu/timer.h" #include "block/aio.h" +#include "qemu/option.h" +#include "qemu/throttle-options.h" /* This function make a bucket leak * @@ -636,3 +638,69 @@ void throttle_config_to_limits(ThrottleConfig *cfg,ThrottleLimits *var)
Quoted 40 lines
util/throttle.c +37
-0var->has_iops_write_max_length = true; var->has_iops_size = true; } + +/* parse the throttle options +* +* @opts: qemu options +* @throttle_cfg: throttle configuration */ void +throttle_parse_options (ThrottleConfig *throttle_cfg,QemuOpts *opts) +{ +throttle_config_init (throttle_cfg); + throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_BPS_TOTAL, 0); + throttle_cfg->buckets[THROTTLE_BPS_READ ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_BPS_READ, 0); + throttle_cfg->buckets[THROTTLE_BPS_WRITE ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_BPS_WRITE, 0); + throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_IOPS_TOTAL, 0); + throttle_cfg->buckets[THROTTLE_OPS_READ ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_IOPS_READ, 0); + throttle_cfg->buckets[THROTTLE_OPS_WRITE ].avg = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX + QEMU_OPT_IOPS_WRITE, 0); + throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_BPS_TOTAL_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_BPS_READ ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_BPS_READ_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_BPS_WRITE ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_BPS_WRITE_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIXutil/throttle.c void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var)
Quoted 10 lines
util/throttle.c +10
-0+ QEMU_OPT_IOPS_TOTAL_MAX, 0); + throttle_cfg->buckets[THROTTLE_OPS_READ ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_IOPS_READ_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_OPS_WRITE ].max = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX +QEMU_OPT_IOPS_WRITE_MAX ,0 ); + throttle_cfg->buckets[THROTTLE_BPS_TOTAL ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX + QEMU_OPT_BPS_TOTAL_MAX_LENGTH,1);
util/throttle.c void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var)
Quoted 3 lines
util/throttle.c +3
-0+ throttle_cfg->buckets[THROTTLE_BPS_READ ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX + QEMU_OPT_BPS_READ_MAX_LENGTH,1);
util/throttle.c void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var)
Quoted 3 lines
util/throttle.c +3
-0+ throttle_cfg->buckets[THROTTLE_BPS_WRITE ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX + QEMU_OPT_BPS_WRITE_MAX_LENGTH,1);
util/throttle.c void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var)
Quoted 3 lines
util/throttle.c +3
-0+ throttle_cfg->buckets[THROTTLE_OPS_TOTAL ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX + QEMU_OPT_IOPS_TOTAL_MAX_LENGTH,1);
util/throttle.c void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var)
Quoted 3 lines
util/throttle.c +3
-0+ throttle_cfg->buckets[THROTTLE_OPS_READ ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX + QEMU_OPT_IOPS_READ_MAX_LENGTH,1);
util/throttle.c void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var)
Quoted 3 lines
util/throttle.c +3
-0+ throttle_cfg->buckets[THROTTLE_OPS_WRITE ].burst_length = + qemu_opt_get_number(opts, THROTTLE_OPT_PREFIX + QEMU_OPT_IOPS_WRITE_MAX_LENGTH,1);
Quoted 3 lines
util/throttle.c +3
-0+ throttle_cfg->op_size = +qemu_opt_get_number (opts,THROTTLE_OPT_PREFIX +QEMU_OPT_IOPS_SIZE, 0); }
Re: [Qemu-devel] [PATCH v5 2/6] fsdev-throttle-qmp: Rename the ThrottleLimits member names
In reply to xiezhideQuoted 80 lines · xiezhide
Rename the ThrottleLimits member names and modify related code
Signed-off-by xiezhide <[email protected]>--- qapi/block-core.json | 70 +++++++++++----------- util/throttle.c | 163 +++++++++++++++++++++++++-------------------------- 2 files changed, 116 insertions(+), 117 deletions(-)qapi/block-core.json +25
-35@@ -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 seconds -# It must only be set if @iops-total-max is set as 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 seconds -# 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 seconds -# It must only be set if @iops-write-max is set as 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 seconds. -# 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 seconds -# 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 seconds -# 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 bytes +# @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 as 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 seconds +# 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 seconds +# It must only be set if @iops_write_max is set as 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 seconds +# 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 seconds +# 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 bytes # # 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' } }
qapi/block-core.json line 2281
Quoted 10 lines
qapi/block-core.json +10
-0+ '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' } }
Compatibility break. Why is that okay?
Even if it is, you still run afoul of docs/devel/qapi-code-gen.txt:
Command names, and member names within a type, should be all lower case with words separated by a hyphen. However, some existing older commands and complex types use underscore; when extending such expressions, consistency is preferred over blindly avoiding underscore.
The exception doesn't apply here.
Quoted 3 lines
qapi/block-core.json +0
-0## # @block-stream:
[...]
Re: [Qemu-devel] [PATCH v5 2/6] fsdev-throttle-qmp: Rename the ThrottleLimits member names
Quoted 30 lines · Markus Armbruster
Quoted 17 lines · xiezhide
Rename the ThrottleLimits member names and modify related code
Signed-off-by xiezhide <[email protected]>--- qapi/block-core.json | 70 +++++++++++----------- util/throttle.c | 163 +++++++++++++++++++++++++-------------------------- 2 files changed, 116 insertions(+), 117 deletions(-)qapi/block-core.json +0
-1## { 'struct': 'ThrottleLimits', - 'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',qapi/block-core.json line 2281
Quoted 10 lines
qapi/block-core.json +10
-0+ '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' } }
Quoted 1 line
Compatibility break. Why is that okay?
Grepping qapi/qapi-introspection.c shows 0 hits for either ThrottleLimits or for iops-total, so there are no QMP commands affected. There might, however, be command line and/or QOM paths affected, which is harder to audit since those don't affect instrospection.
Quoted 10 lines
Even if it is, you still run afoul of
docs/devel/qapi-code-gen.txt:Command names, and member names within a type, should be all lower case with words separated by a hyphen. However, some existing older commands and complex types use underscore; when extending such expressions, consistency is preferred over blindly avoiding underscore.
The exception doesn't apply here.
Ah, but it does, because we are refactoring code to share a common QAPI struct in a later patch, where we need this exact naming to avoid breaking that command.
So the REAL problem with this commit is that the commit message does not give enough details, either why this is safe (because it does not impact existing QMP commands) or needed (because we will be using it to rewrite an existing QMP command that needs this spelling).
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v5 2/6] fsdev-throttle-qmp: Rename the ThrottleLimits member names
In reply to Markus ArmbrusterQuoted 128 lines
Subject: Re: [Qemu-devel] [PATCH v5 2/6] fsdev-throttle-qmp: Rename the ThrottleLimits member names
Quoted 6 lines · xiezhide
Rename the ThrottleLimits member names and modify related code
Signed-off-by xiezhide <[email protected]>--- qapi/block-core.json | 70 +++++++++++----------- util/throttle.c | 163+++++++++++++++++++++++++--------------------------
qapi/block-core.json
Quoted 13 lines
2 files changed, 116 insertions(+), 117 deletions(-)qapi/block-core.json index renamed from qapi/block-core.json +0
-0d4fe710..4ffaaea 100644
qapi/block-core.json +0
-0@@ -2240,45 +2240,45 @@ # transaction. All fields are optional. When setting limits, if afield is # missing the current value is not changed.
#qapi/block-core.json +0
-3-# @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, inseconds
Quoted 1 line
-# It must only be set if @iops-total-max is set
as well.
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +0
-3-# @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, inseconds
Quoted 1 line
-# It must only be set if @iops-read-max is set
as well.
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +0
-3-# @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, inseconds
Quoted 1 line
-# It must only be set if @iops-write-max is
set as well.
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +0
-3-# @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, inseconds.
Quoted 1 line
-# It must only be set if @bps-total-max is set
as well.
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +0
-3-# @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, inseconds
Quoted 1 line
-# It must only be set if @bps-read-max is set
as well.
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +0
-3-# @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, inseconds
Quoted 1 line
-# It must only be set if @bps-write-max is set
as well.
Quoted 1 line
-# @iops-size: when limiting by iops max size of an I/O in
bytes
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +3
-0+# @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, inseconds
Quoted 1 line
+# It must only be set if @iops_total_max is
set as well.
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +3
-0+# @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, inseconds
Quoted 1 line
+# It must only be set if @iops_read_max is
set as well.
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +3
-0+# @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, inseconds
Quoted 1 line
+# It must only be set if @iops_write_max is
set as well.
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +3
-0+# @bps: limit total bytes per second +# @bps_max: total bytes burst +# @bps_max_length: length of the bps_total_max burst period, inseconds.
Quoted 1 line
+# It must only be set if @bps_total_max is
set as well.
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +3
-0+# @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, inseconds
Quoted 1 line
+# It must only be set if @bps_read_max is
set as well.
qapi/block-core.json
Quoted 3 lines
qapi/block-core.json +3
-0+# @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, inseconds
Quoted 1 line
+# It must only be set if @bps_write_max is
set as well.
Quoted 1 line
+# @iops_size: when limiting by iops max size of an I/O in
bytes
Quoted 14 lines
#
# Since: 2.11
##
{ 'struct': 'ThrottleLimits',qapi/block-core.json +0
-10- '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' } }qapi/block-core.json line 2281
Quoted 10 lines
qapi/block-core.json +10
-0+ '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' } }Compatibility break. Why is that okay?
Even if it is, you still run afoul of
docs/devel/qapi-code-gen.txt:
Quoted 7 lines
Command names, and member names within a type, should be all lower case with words separated by a hyphen. However, some existing older commands and complex types use underscore; when extending such expressions, consistency is preferred over blindly avoiding underscore.
The exception doesn't apply here.
Why did this changing:
1. ThrottleLimits is just use for block device, this change not break compatibility
2. can share same base struct in json file
3. can reuse same code between block and fsdev device for io throttling
4. can keep the same qmp command style for block and fsdev with less codes
Block:
{ "execute": "block_set_io_throttle",
"arguments": {
"device": "virtio0",
"iops": 100,
"iops_rd": 0,
"iops_wr": 0,
"bps": 0,
"bps_rd": 0,
"bps_wr": 0
}}
Fsdev:
{ "execute": "fsdev-set-io-throttle",
"arguments": {
"id": "extra-9p-kataTest"
"iops": 100,
"iops_rd": 0,
"iops_wr": 0,
"bps": 0,
"bps_rd": 0,
"bps_wr": 0
}}
Thanks
xiezhide
Quoted 5 lines
Quoted 4 lines
##
# @block-stream:[...]
Re: [Qemu-devel] [PATCH v5 2/6] fsdev-throttle-qmp: Rename the ThrottleLimits member names
In reply to Eric BlakeQuoted 56 lines
Subject: Re: [Qemu-devel] [PATCH v5 2/6] fsdev-throttle-qmp: Rename the ThrottleLimits member names
Quoted 8 lines · Markus Armbruster
Quoted 6 lines · xiezhide
Rename the ThrottleLimits member names and modify related code
Signed-off-by xiezhide <[email protected]>--- qapi/block-core.json | 70 +++++++++++----------- util/throttle.c | 163+++++++++++++++++++++++++--------------------------
Quoted 22 lines
Quoted 11 lines
2 files changed, 116 insertions(+), 117 deletions(-)qapi/block-core.json index renamed from qapi/block-core.json +0
-0d4fe710..4ffaaea 100644
qapi/block-core.json +0
-1## { 'struct': 'ThrottleLimits', - 'data': { '*iops-total' : 'int', '*iops-total-max' : 'int',qapi/block-core.json line 2281
Quoted 10 lines
qapi/block-core.json +10
-0+ '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' } }Quoted 1 line
Compatibility break. Why is that okay?
Grepping
qapi/qapi-introspection.cshows 0 hits for either ThrottleLimits or for iops-total, so there are no QMP commands affected.
There might, however, be command line and/or QOM paths affected, which is harder to audit since those don't affect instrospection.Quoted 4 lines
Even if it is, you still run afoul of
docs/devel/qapi-code-gen.txt:Command names, and member names within a type, should be all
lower
Quoted 1 line
case with words separated by a hyphen. However, some existing
older
Quoted 5 lines
commands and complex types use underscore; when extending such expressions, consistency is preferred over blindly avoiding underscore.
The exception doesn't apply here.
Quoted 9 lines
Ah, but it does, because we are refactoring code to share a common QAPI struct in a later patch, where we need this exact naming to avoid breaking that command.
So the REAL problem with this commit is that the commit message does not give enough details, either why this is safe (because it does not impact existing QMP commands) or needed (because we will be using it to rewrite an existing QMP command that needs this spelling).
@Erick, thanks for your simple but exact explaining for purpose of this patch
Thanks
xiezhide
Quoted 4 lines
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v5 2/6] fsdev-throttle-qmp: Rename the ThrottleLimits member names
In reply to Eric BlakeQuoted 31 lines · Eric Blake
Quoted 30 lines · Markus Armbruster
Quoted 27 lines · xiezhide
Rename the ThrottleLimits member names and modify related code
Signed-off-by xiezhide <[email protected]>--- qapi/block-core.json | 70 +++++++++++----------- util/throttle.c | 163 +++++++++++++++++++++++++-------------------------- 2 files changed, 116 insertions(+), 117 deletions(-)qapi/block-core.json +10
-1## { 'struct': 'ThrottleLimits', - 'data': { '*iops-total' : 'int', '*iops-total-max' : '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' } }
Quoted 5 lines
Quoted 1 line
Compatibility break. Why is that okay?
Grepping
qapi/qapi-introspection.cshows 0 hits for either ThrottleLimits or for iops-total, so there are no QMP commands affected.
I see.
Quoted 3 lines
There might, however, be command line and/or QOM paths
affected, which is harder to audit since those don't affect instrospection.
Yet another argument for QAPIfication...
Let's check. git-grep ThrottleLimits finds:
* block/throttle-groups.c: getter and setter for QOM class "throttle-group" property "limits". This class is user-creatable. Therefore, this is an externally visible interface.
The question is whether it's a *stable* interface. The status of QOM properties in that regard is not clear to me. If I remember correctly, we treated it as "just for debugging and such" at least initially. But is that still a defensible position? It ceases to be one as soon as you need QOM properties to do something users ought to be able to do. Like configuring stuff that is meant to be configured. If that's the case, we need to examine the situation, and clarify our ABI promises. Recommend a separate thread.
* util/throttle.c: Functions to convert to and from ThrottleConfig. The conversion to ThrottleConfig uses hardcoded member names in error messages. Relevant only insofar we need to remember to change them when we rename members.
Quoted 10 lines
Quoted 9 lines
Even if it is, you still run afoul of
docs/devel/qapi-code-gen.txt:Command names, and member names within a type, should be all lower case with words separated by a hyphen. However, some existing older commands and complex types use underscore; when extending such expressions, consistency is preferred over blindly avoiding underscore.
The exception doesn't apply here.
Quoted 8 lines
Ah, but it does, because we are refactoring code to share a common QAPI struct in a later patch, where we need this exact naming to avoid breaking that command.
So the REAL problem with this commit is that the commit message does not give enough details, either why this is safe (because it does not impact existing QMP commands) or needed (because we will be using it to rewrite an existing QMP command that needs this spelling).
Yes, the commit message needs to make explain why the change is useful, and why it is safe.
Re: [Qemu-devel] [PATCH v5 2/6] fsdev-throttle-qmp: Rename the ThrottleLimits member names
Quoted 64 lines
Quoted 9 lines · Eric Blake
Quoted 8 lines · Markus Armbruster
Quoted 6 lines · xiezhide
Rename the ThrottleLimits member names and modify related code
Signed-off-by xiezhide <[email protected]>--- qapi/block-core.json | 70 +++++++++++----------- util/throttle.c | 163+++++++++++++++++++++++++--------------------------
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
2 files changed, 116 insertions(+), 117 deletions(-)qapi/block-core.json index renamed from qapi/block-core.json +0
-0d4fe710..4ffaaea 100644
qapi/block-core.json +10
-1## { 'struct': 'ThrottleLimits', - 'data': { '*iops-total' : 'int', '*iops-total-max' : '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' } }Quoted 5 lines
Quoted 1 line
Compatibility break. Why is that okay?
Grepping
qapi/qapi-introspection.cshows 0 hits for either ThrottleLimits or for iops-total, so there are no QMP commands affected.I see.
Quoted 3 lines
There might, however, be command line and/or QOM paths
affected, which is harder to audit since those don't affect instrospection.Yet another argument for QAPIfication...
Let's check. git-grep ThrottleLimits finds:
*
block/throttle-groups.c: getter and setter for QOM class "throttle-group" property "limits". This class is user-creatable. Therefore, this is an externally visible interface.The question is whether it's a *stable* interface. The status of QOM properties in that regard is not clear to me. If I remember correctly, we treated it as "just for debugging and such" at least initially. But is that still a defensible position? It ceases to be one as soon as you need QOM properties to do something users ought to be able to do. Like configuring stuff that is meant to be configured. If that's the case, we need to examine the situation, and clarify our ABI promises. Recommend a separate thread.
Quoted 4 lines
*
util/throttle.c: Functions to convert to and from ThrottleConfig. The conversion to ThrottleConfig uses hardcoded member names in error messages. Relevant only insofar we need to remember to change them when we rename members.
Yes, find few hard coded member names in error message need to change. Will fix it in new version
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines
Even if it is, you still run afoul of
docs/devel/qapi-code-gen.txt:Command names, and member names within a type, should be all
lower
Quoted 1 line
Quoted 1 line
case with words separated by a hyphen. However, some existing
older
Quoted 10 lines
Quoted 5 lines
commands and complex types use underscore; when extending such expressions, consistency is preferred over blindly avoiding underscore.
The exception doesn't apply here.
Ah, but it does, because we are refactoring code to share a common QAPI struct in a later patch, where we need this exact naming to avoid breaking that command.
Quoted 7 lines
Quoted 4 lines
So the REAL problem with this commit is that the commit message does not give enough details, either why this is safe (because it does not impact existing QMP commands) or needed (because we will be using it to rewrite an existing QMP command that needs this spelling).
Yes, the commit message needs to make explain why the change is useful, and why it is safe.
Strongly endorse , will with clear and detail commit message next
Thanks
xiezhide