fsdev-throttle-qmp: qmp interface for fsdev io throttling
Subsystems (2)
v4 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 (4):
fsdev-throttle-qmp: factor out throttle code to reuse code
fsdev-throttle-qmp: move struct ThrottleLimits to new file
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 | 94 +--------------- 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 | 83 +++++++++++++-- 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 | 89 ++++++++++++++++ qmp.c | 13 +++ util/throttle.c | 231 ++++++++++++++++++++++++++-------------- 21 files changed, 635 insertions(+), 356 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
Signature · 1 line
1.8.3.1
PATCH v4 1/4 fsdev-throttle-qmp: factor out throttle code to reuse code
This patch factor out throttle parameter parse code to 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
@@ -113,6 +113,7 @@ typedef struct uWireSlave uWireSlave;typedef struct VirtIODevice VirtIODevice ;typedef struct Visitor Visitor ;typedef struct node_info NodeInfo ; +typedef struct ThrottleConfig ThrottleConfig ;typedef void SaveStateHandler (QEMUFile *f,void *opaque);typedef int LoadStateHandler (QEMUFile *f,void *opaque,int version_id);
util/throttle.c +68 -0
77 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH v4 1/4] fsdev-throttle-qmp: factor out throttle code to reuse code
Quoted 1 line · xiezhide
This patch factor out throttle parameter parse code to common function
s/factor/factors/
Actually, when I write commit messages, I like to use the imperative mood, with an implicit "Apply this patch in order to" unspoken prefix. Starting with an explicit "This patch does" is more of a descriptive mood. So I might have written:
Factor out the throttle parameter parsing code to a new common function which will be used by block and fsdev.
Quoted 17 lines
which will be used by block and fsdev.
rename functionthrottle_parse_optionstothrottle_parse_groupto resolve function name conflictSigned-off-by xiezhide <[email protected]>--- 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(-)+++
b/include/qemu/throttle-options.h
include/qemu/throttle-options.h line 114
Quoted 4 lines
include/qemu/throttle-options.h +1
-0@@ -111,4 +111,6 @@ .help = "when limiting by iops max size of an I/O in bytes",\ } +void throttle_parse_options (ThrottleConfig *,QemuOpts *);
It's okay to use parameter names in function declarations.
include/qemu/typedefs.h typedef struct uWireSlave uWireSlave; · line 116
Quoted 6 lines
include/qemu/typedefs.h +2
-0+++ b/include/qemu/typedefs.h@@ -113,6 +113,7 @@ typedef struct uWireSlave uWireSlave;typedef struct VirtIODevice VirtIODevice ;typedef struct Visitor Visitor ;typedef struct node_info NodeInfo ; +typedef struct ThrottleConfig ThrottleConfig ;
Please keep this in the right sorted location, right after SSIBus.
[Hmm, we already have an inconsistency on whether we are sorting by en_US rules, which are case-insensitive and therefore has 'struct node_info' in the wrong location, or by C rules which sort lowercase later and therefore has 'struct uWireSlave' in the wrong position. For that matter, why are we renaming 'struct node_info NodeInfo', and why does uWireSlave violate our naming conventions? But those are independent cleanups, and not necessarily something for you to worry about]
With the sorting fixed,
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v4 1/4] fsdev-throttle-qmp: factor out throttle code to reuse code
-----Original Message-----
From: Eric Blake [mailto:[email protected]]
Sent: 2018年11月16日 4:56
To: xiezhide <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; zengcanfu 00215970 <[email protected]>; Jinxuefeng <[email protected]>; Chenhui (Felix, Euler) <[email protected]>
Subject: Re: [PATCH v4 1/4] fsdev-throttle-qmp: factor out throttle code to reuse code
Quoted 1 line · xiezhide
This patch factor out throttle parameter parse code to common function
s/factor/factors/
Actually, when I write commit messages, I like to use the imperative mood, with an implicit "Apply this patch in order to" unspoken prefix. Starting with an explicit "This patch does" is more of a descriptive mood. So I might have written:
Factor out the throttle parameter parsing code to a new common function which will be used by block and fsdev.
Very helpful, thanks
Quoted 17 lines
which will be used by block and fsdev.
rename functionthrottle_parse_optionstothrottle_parse_groupto resolve function name conflictSigned-off-by xiezhide <[email protected]>--- 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(-)+++
b/include/qemu/throttle-options.h
include/qemu/throttle-options.h line 114
Quoted 4 lines
include/qemu/throttle-options.h +1
-0@@ -111,4 +111,6 @@ .help = "when limiting by iops max size of an I/O in bytes",\ } +void throttle_parse_options (ThrottleConfig *,QemuOpts *);
It's okay to use parameter names in function declarations.
include/qemu/typedefs.h typedef struct uWireSlave uWireSlave; · line 116
Quoted 6 lines
include/qemu/typedefs.h +2
-0+++ b/include/qemu/typedefs.h@@ -113,6 +113,7 @@ typedef struct uWireSlave uWireSlave;typedef struct VirtIODevice VirtIODevice ;typedef struct Visitor Visitor ;typedef struct node_info NodeInfo ; +typedef struct ThrottleConfig ThrottleConfig ;
Please keep this in the right sorted location, right after SSIBus.
[Hmm, we already have an inconsistency on whether we are sorting by en_US rules, which are case-insensitive and therefore has 'struct node_info' in the wrong location, or by C rules which sort lowercase later and therefore has 'struct uWireSlave' in the wrong position. For that matter, why are we renaming 'struct node_info NodeInfo', and why does uWireSlave violate our naming conventions? But those are independent cleanups, and not necessarily something for you to worry about]
With the sorting fixed,
-----Fix it now
Thanks
Kidd
PATCH v4 2/4 fsdev-throttle-qmp: move struct ThrottleLimits to new file
In reply to xiezhidethis patch move ThrottleLimits to new file and rename struct field with common format
--- Makefile | 9 +++ Makefile.objs | 4 ++ blockdev.c | 51 +--------------- qapi/block-core.json | 122 +------------------------------------ qapi/qapi-schema.json | 1 + qapi/tlimits.json | 89 +++++++++++++++++++++++++++ util/throttle.c | 163 +++++++++++++++++++++++++------------------------- 7 files changed, 188 insertions(+), 251 deletions(-) create mode 100644 qapi/tlimits.json
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
@@ -598,6 +602,7 @@ qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json $(SRC_PATH)/qapi/common.json \ $(SRC_PATH)/qapi/tpm.json \ $(SRC_PATH)/qapi/trace.json \ $(SRC_PATH)/qapi/transaction.json \ + $(SRC_PATH)/qapi/tlimits.json \ $(SRC_PATH)/qapi/ui.json qapi/qapi-builtin-types.c qapi/qapi-builtin-types.h \
@@ -618,6 +623,7 @@ qapi/qapi-types-sockets.c qapi/qapi-types-sockets.h \ qapi/qapi-types-tpm.c qapi/qapi-types-tpm.h \ qapi/qapi-types-trace.c qapi/qapi-types-trace.h \ qapi/qapi-types-transaction.c qapi/qapi-types-transaction.h \ +qapi/qapi-types-tlimits.c qapi/qapi-types-tlimits.h \ qapi/qapi-types-ui.c qapi/qapi-types-ui.h \ qapi/qapi-builtin-visit.c qapi/qapi-builtin-visit.h \ qapi/qapi-visit.c qapi/qapi-visit.h \
@@ -637,6 +643,7 @@ qapi/qapi-visit-sockets.c qapi/qapi-visit-sockets.h \ qapi/qapi-visit-tpm.c qapi/qapi-visit-tpm.h \ qapi/qapi-visit-trace.c qapi/qapi-visit-trace.h \ qapi/qapi-visit-transaction.c qapi/qapi-visit-transaction.h \ +qapi/qapi-visit-tlimits.c qapi/qapi-visit-tlimits.h \ qapi/qapi-visit-ui.c qapi/qapi-visit-ui.h \ qapi/qapi-commands.h qapi/qapi-commands.c \ qapi/qapi-commands-block-core.c qapi/qapi-commands-block-core.h \
@@ -655,6 +662,7 @@ qapi/qapi-commands-sockets.c qapi/qapi-commands-sockets.h \ qapi/qapi-commands-tpm.c qapi/qapi-commands-tpm.h \ qapi/qapi-commands-trace.c qapi/qapi-commands-trace.h \ qapi/qapi-commands-transaction.c qapi/qapi-commands-transaction.h \ +qapi/qapi-commands-tlimits.c qapi/qapi-commands-tlimits.h \ qapi/qapi-commands-ui.c qapi/qapi-commands-ui.h \ qapi/qapi-events.c qapi/qapi-events.h \ qapi/qapi-events-block-core.c qapi/qapi-events-block-core.h \
@@ -673,6 +681,7 @@ qapi/qapi-events-sockets.c qapi/qapi-events-sockets.h \ qapi/qapi-events-tpm.c qapi/qapi-events-tpm.h \ qapi/qapi-events-trace.c qapi/qapi-events-trace.h \ qapi/qapi-events-transaction.c qapi/qapi-events-transaction.h \ +qapi/qapi-events-tlimits.c qapi/qapi-events-tlimits.h \ qapi/qapi-events-ui.c qapi/qapi-events-ui.h \ qapi/qapi-introspect.h qapi/qapi-introspect.c \ qapi/qapi-doc.texi: \
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
blockdev.c +1 -50
57 lines not on this page · raw message
qapi/block-core.json +3 -119
139 lines not on this page · raw message
qapi/qapi-schema.json +1 -0
@@ -94,3 +94,4 @@ { 'include': 'trace.json' } { 'include': 'introspect.json' } { 'include': 'misc.json' } +{ 'include': 'tlimits.json' }
qapi/tlimits.json new file +89 -0
89 lines not on this page · raw message
util/throttle.c +81 -82
224 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH v4 2/4] fsdev-throttle-qmp: move struct ThrottleLimits to new file
Quoted 2 lines · xiezhide
this patch move ThrottleLimits to new file and rename struct field with common format
As written, you need s/move/moves/ and s/rename/renames/ to match the singular actor 'this patch'. Or, if you stick with my preference for imperative sense, s/this patch move/Move/
s/to new/to a new/
Makefile GENERATED_FILES += qapi/qapi-types-sockets.h qapi/qapi-types-sockets.c · line 109
Quoted 10 lines
Signed-off-by xiezhide <[email protected]>---
+++ b/Makefile
Makefile +1
-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
tlimits comes before tpm, not after transaction. (Multiple times in this file)
Makefile.objs util-obj-y += qapi/qapi-types-sockets.o · line 23
Quoted 6 lines
Makefile.objs +2
-0+++ b/Makefile.objs@@ -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
Here too.
Quoted 15 lines
(quoted diff) +0
-13{ 'struct': 'BlockIOThrottle', - 'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int', - 'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int', - '*bps_max': 'int', '*bps_rd_max': 'int', - '*bps_wr_max': 'int', '*iops_max': 'int', - '*iops_rd_max': 'int', '*iops_wr_max': 'int', - '*bps_max_length': 'int', '*bps_rd_max_length': 'int', - '*bps_wr_max_length': 'int', '*iops_max_length': 'int', - '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int', - '*iops_size': 'int', '*group': 'str' } } - -{ 'struct': 'ThrottleLimits', - 'data': { '*iops-total' : 'int', '*iops-total-max' : 'int', - '*iops-total-max-length' : 'int', '*iops-read' : 'int',
Review util-obj-y += qapi/qapi-types-sockets.o
Quoted 10 lines
(quoted diff) +2
-8- '*iops-read-max' : 'int', '*iops-read-max-length' : 'int', - '*iops-write' : 'int', '*iops-write-max' : 'int', - '*iops-write-max-length' : 'int', '*bps-total' : 'int', - '*bps-total-max' : 'int', '*bps-total-max-length' : 'int', - '*bps-read' : 'int', '*bps-read-max' : 'int', - '*bps-read-max-length' : 'int', '*bps-write' : 'int', - '*bps-write-max' : 'int', '*bps-write-max-length' : 'int', - '*iops-size' : 'int' } } + 'base': 'ThrottleLimits', + 'data': { '*device': 'str', '*id': 'str', '*group': 'str' } }
The old code has QMP using 'bps_wr' for BlockIOThrottle, but 'bps-write' for ThrottleLimits. The new code...
qapi/tlimits.json line 89
Quoted 12 lines
+++
b/qapi/tlimits.jsonqapi/tlimits.json new file +10
-0+{ 'struct': 'ThrottleLimits', + 'data': { '*bps': 'int', '*bps_rd': 'int', + '*bps_wr': 'int', '*iops': 'int', '*iops_rd': 'int', '*iops_wr': 'int', + '*bps_max': 'int', '*bps_rd_max': 'int', + '*bps_wr_max': 'int', '*iops_max': 'int', + '*iops_rd_max': 'int', '*iops_wr_max': 'int', + '*bps_max_length': 'int', '*bps_rd_max_length': 'int', + '*bps_wr_max_length': 'int', '*iops_max_length': 'int', + '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int', + '*iops_size': 'int' } }
...is sticking with the BlockIOThrottle naming. I don't see any use of ThrottleLimits in QAPI code (quick check: grep bps-wr qapi/qapi-introspect.c comes up empty), so we SHOULD be okay with regards to back-compat. But I'd still split this patch into multiple pieces: 1. Rename the ThrottleLimits member names (and give justification why such rename doesn't break back-compat). 2. Rewrite BlockIOThrottle with ThrottleLimits as its base class. 3. Move ThrottleLimits into a new file for future reuse. (Maybe 2 and 3 can be squashed into a single patch)
util/throttle.c void throttle_account(ThrottleState *ts, bool is_write, uint64_t size) · line 500
Quoted 12 lines
util/throttle.c +2
-2@@ -496,98 +496,97 @@ void throttle_account(ThrottleState *ts, bool is_write, 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 = arg->bps_total; +if (arg->has_bps) { + cfg->buckets[THROTTLE_BPS_TOTAL ].avg = arg->bps;
Otherwise, the churn from renaming members (part 1) makes it hard to see if the code was properly moved into a new file.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v4 2/4] fsdev-throttle-qmp: move struct ThrottleLimits to new file
Quoted 12 lines · Eric Blake
Quoted 2 lines · xiezhide
this patch move ThrottleLimits to new file and rename struct field with common format
As written, you need s/move/moves/ and s/rename/renames/ to match the singular actor 'this patch'. Or, if you stick with my preference for imperative sense, s/this patch move/Move/
s/to new/to a new/
Quoted 3 lines
Signed-off-by xiezhide <[email protected]>---
Quoted 9 lines
Quoted 7 lines
+++ b/Makefile
(quoted diff) +0
-0@@ -106,6 +106,7 @@ GENERATED_FILES += qapi/qapi-types-sockets.h
qapi/qapi-types-sockets.c
GENERATED_FILES+=qapi/qapi-types-tpm.hqapi/qapi-types-tpm.cGENERATED_FILES+=qapi/qapi-types-trace.hqapi/qapi-types-trace.cGENERATED_FILES+=qapi/qapi-types-transaction.hqapi/qapi-types-transaction.c+GENERATED_FILES +=qapi/qapi-types-tlimits.hqapi/qapi-types-tlimits.ctlimits comes before tpm, not after transaction. (Multiple times in this file)
Or, just apply your patch after mine[1], for a much simpler task of inserting 'tlimits' in the right place within QAPI_MODULES.
[1] https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg03070.html
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v4 2/4] fsdev-throttle-qmp: move struct ThrottleLimits to new file
-----Original Message-----
From: Eric Blake [mailto:[email protected]]
Sent: 2018年11月16日 6:03
To: xiezhide <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; zengcanfu 00215970 <[email protected]>; [email protected]; [email protected]; Jinxuefeng <[email protected]>; Chenhui (Felix, Euler) <[email protected]>
Subject: Re: [Qemu-devel] [PATCH v4 2/4] fsdev-throttle-qmp: move struct ThrottleLimits to new file
Quoted 14 lines · Eric Blake
Quoted 2 lines · xiezhide
this patch move ThrottleLimits to new file and rename struct field with common format
As written, you need s/move/moves/ and s/rename/renames/ to match the singular actor 'this patch'. Or, if you stick with my preference for imperative sense, s/this patch move/Move/
s/to new/to a new/
Quoted 3 lines
Signed-off-by xiezhide <[email protected]>---
Quoted 12 lines
Review
Quoted 9 lines
+++ b/Makefile
(quoted diff) +0
-0@@ -106,6 +106,7 @@ GENERATED_FILES += qapi/qapi-types-sockets.h
qapi/qapi-types-sockets.c
GENERATED_FILES+=qapi/qapi-types-tpm.hqapi/qapi-types-tpm.cGENERATED_FILES+=qapi/qapi-types-trace.hqapi/qapi-types-trace.cGENERATED_FILES+=qapi/qapi-types-transaction.hqapi/qapi-types-transaction.c(quoted diff) +2
-0+GENERATED_FILES += qapi/qapi-types-tlimits.h +qapi/qapi-types-tlimits.ctlimits comes before tpm, not after transaction. (Multiple times in this file)
Or, just apply your patch after mine[1], for a much simpler task of inserting 'tlimits' in the right place within QAPI_MODULES.
[1] https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg03070.html
Great, it makes the task very simple. thanks
Thanks
Kidd
Re: [Qemu-devel] [PATCH v4 2/4] fsdev-throttle-qmp: move struct ThrottleLimits to new file
In reply to Eric Blake-----Original Message-----
From: Eric Blake [mailto:[email protected]]
Sent: 2018年11月16日 5:41
To: xiezhide <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; zengcanfu 00215970 <[email protected]>; Jinxuefeng <[email protected]>; Chenhui (Felix, Euler) <[email protected]>
Subject: Re: [PATCH v4 2/4] fsdev-throttle-qmp: move struct ThrottleLimits to new file
Quoted 2 lines · xiezhide
this patch move ThrottleLimits to new file and rename struct field with common format
As written, you need s/move/moves/ and s/rename/renames/ to match the singular actor 'this patch'. Or, if you stick with my preference for imperative sense, s/this patch move/Move/
s/to new/to a new/
Review
Quoted 12 lines
Signed-off-by xiezhide <[email protected]>---
+++ b/Makefile
Makefile +0
-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(quoted diff) +2
-0+GENERATED_FILES += qapi/qapi-types-tlimits.h +qapi/qapi-types-tlimits.c
tlimits comes before tpm, not after transaction. (Multiple times in this file)
Makefile.objs util-obj-y += qapi/qapi-types-sockets.o · line 23
Quoted 6 lines
+++ b/Makefile.objs
Makefile.objs +1
-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
Here too.
Quoted 15 lines
(quoted diff) +0
-13{ 'struct': 'BlockIOThrottle', - 'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int', - 'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int', - '*bps_max': 'int', '*bps_rd_max': 'int', - '*bps_wr_max': 'int', '*iops_max': 'int', - '*iops_rd_max': 'int', '*iops_wr_max': 'int', - '*bps_max_length': 'int', '*bps_rd_max_length': 'int', - '*bps_wr_max_length': 'int', '*iops_max_length': 'int', - '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int', - '*iops_size': 'int', '*group': 'str' } } - -{ 'struct': 'ThrottleLimits', - 'data': { '*iops-total' : 'int', '*iops-total-max' : 'int', - '*iops-total-max-length' : 'int', '*iops-read' : 'int',
Review util-obj-y += qapi/qapi-types-sockets.o
Quoted 10 lines
(quoted diff) +2
-8- '*iops-read-max' : 'int', '*iops-read-max-length' : 'int', - '*iops-write' : 'int', '*iops-write-max' : 'int', - '*iops-write-max-length' : 'int', '*bps-total' : 'int', - '*bps-total-max' : 'int', '*bps-total-max-length' : 'int', - '*bps-read' : 'int', '*bps-read-max' : 'int', - '*bps-read-max-length' : 'int', '*bps-write' : 'int', - '*bps-write-max' : 'int', '*bps-write-max-length' : 'int', - '*iops-size' : 'int' } } + 'base': 'ThrottleLimits', + 'data': { '*device': 'str', '*id': 'str', '*group': 'str' } }
The old code has QMP using 'bps_wr' for BlockIOThrottle, but 'bps-write' for ThrottleLimits. The new code...
qapi/tlimits.json line 89
Quoted 12 lines
+++
b/qapi/tlimits.jsonqapi/tlimits.json new file +10
-0+{ 'struct': 'ThrottleLimits', + 'data': { '*bps': 'int', '*bps_rd': 'int', + '*bps_wr': 'int', '*iops': 'int', '*iops_rd': 'int', '*iops_wr': 'int', + '*bps_max': 'int', '*bps_rd_max': 'int', + '*bps_wr_max': 'int', '*iops_max': 'int', + '*iops_rd_max': 'int', '*iops_wr_max': 'int', + '*bps_max_length': 'int', '*bps_rd_max_length': 'int', + '*bps_wr_max_length': 'int', '*iops_max_length': 'int', + '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int', + '*iops_size': 'int' } }
...is sticking with the BlockIOThrottle naming. I don't see any use of ThrottleLimits in QAPI code (quick check: grep bps-wr qapi/qapi-introspect.c comes up empty), so we SHOULD be okay with regards to back-compat. But I'd still split this patch into multiple
pieces: 1. Rename the ThrottleLimits member names (and give justification why such rename doesn't break back-compat). 2. Rewrite BlockIOThrottle with ThrottleLimits as its base class. 3. Move ThrottleLimits into a new file for future reuse. (Maybe 2 and 3 can be squashed into a single patch)
util/throttle.c void throttle_account(ThrottleState *ts, bool is_write, uint64_t size) · line 500
Quoted 12 lines
util/throttle.c index e7db2ad..b421e33 renamed from util/throttle.c +0
-0100644
util/throttle.c +2
-2@@ -496,98 +496,97 @@ void throttle_account(ThrottleState *ts, bool is_write, 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 = arg->bps_total; +if (arg->has_bps) { + cfg->buckets[THROTTLE_BPS_TOTAL ].avg = arg->bps;
Otherwise, the churn from renaming members (part 1) makes it hard to see if the code was properly moved into a new file.
Split this patch to three patches in v5
Thanks
Kidd
Re: [Qemu-devel] [PATCH v4 2/4] fsdev-throttle-qmp: move struct ThrottleLimits to new file
Quoted 1 line · xiezhide
Here's a couple of meta observations:
Quoted 3 lines
Quoted 3 lines
Signed-off-by xiezhide <[email protected]>
Your sign-off line ...[1]
Quoted 8 lines
util/throttle.c void throttle_account(ThrottleState *ts, bool is_write, uint64_t size) · line 500
Quoted 4 lines
util/throttle.c +2
-2-if (arg->has_bps_total) { - cfg->buckets[THROTTLE_BPS_TOTAL ].avg = arg->bps_total; +if (arg->has_bps) { + cfg->buckets[THROTTLE_BPS_TOTAL ].avg = arg->bps;Otherwise, the churn from renaming members (part 1) makes it hard to see if the code was properly moved into a new file.
Split this patch to three patches in v5
Your mailer's quoting style makes it very hard to read your replies. You are including both a line that I originally wrote and your reply with no difference in quoting levels between the two, which makes it look like you are writing both the question and the answer. It is MUCH easier to read mails where quoted material is prefixed by some form of quoting (and '>' is probably the easiest form).
Quoted 3 lines
Thanks
Kidd
[1] ...does not match your informal signature. That's not necessarily a problem, but the project does prefer that Signed-off-by lines use a preferred legal name rather than merely a nickname or username. It is acceptable for a sign off to include multiple variations of your name (I've seen people use UTF-8 characters to represent their name natively, followed by a Latinized transcription of the name they use in English), as well as signatures that use just a UTF-8 form or just a Latinized form; at the same time, I won't reject your patch as written, because if you look hard enough in git history, you'll find other commit authors that got away with a username or nickname. If you prefer to be addressed by 'Kidd' when speaking in English, then including that as part of your S-o-b lines will help other reviewers know the best name to use for mentioning you by name.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
PATCH v4 3/4 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 | 9 +++++ Makefile.objs | 4 ++ 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, 259 insertions(+), 8 deletions(-) create mode 100644 qapi/fsdev.json
Makefile +9 -0
@@ -107,6 +107,7 @@ 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-fsdev.h qapi/qapi-types-fsdev.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
@@ -127,6 +128,7 @@ 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-fsdev.h qapi/qapi-visit-fsdev.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
@@ -146,6 +148,7 @@ 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-fsdev.h qapi/qapi-commands-fsdev.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
@@ -165,6 +168,7 @@ 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-fsdev.h qapi/qapi-events-fsdev.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
@@ -603,6 +607,7 @@ qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json $(SRC_PATH)/qapi/common.json \ $(SRC_PATH)/qapi/trace.json \ $(SRC_PATH)/qapi/transaction.json \ $(SRC_PATH)/qapi/tlimits.json \ + $(SRC_PATH)/qapi/fsdev.json \ $(SRC_PATH)/qapi/ui.json qapi/qapi-builtin-types.c qapi/qapi-builtin-types.h \
@@ -624,6 +629,7 @@ 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-fsdev.c qapi/qapi-types-fsdev.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 \
@@ -644,6 +650,7 @@ 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-fsdev.c qapi/qapi-visit-fsdev.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 \
@@ -663,6 +670,7 @@ 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-fsdev.c qapi/qapi-commands-fsdev.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 \
@@ -682,6 +690,7 @@ 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-fsdev.c qapi/qapi-events-fsdev.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
@@ -21,6 +21,7 @@ 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-fsdev.o util-obj-y += qapi/qapi-types-ui.o util-obj-y += qapi/qapi-builtin-visit.o util-obj-y += qapi/qapi-visit.o
@@ -41,6 +42,7 @@ 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-fsdev.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
@@ -60,6 +62,7 @@ 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-visit-fsdev.o util-obj-y += qapi/qapi-events-ui.o util-obj-y += qapi/qapi-introspect.o
@@ -158,6 +161,7 @@ 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-fsdev.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': 'introspect.json' } { 'include': 'misc.json' } { 'include': 'tlimits.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 v4 4/4 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 | 83 +++++++++++++++++++++++++++++++++++++++++++++++----- hmp.h | 4 +++ qapi/tlimits.json | 2 +- 5 files changed, 110 insertions(+), 9 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 +75 -8
109 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);
qapi/tlimits.json +1 -1
@@ -74,7 +74,7 @@ # # @iops_size: an I/O size in bytes (Since 1.7) # -# Since: 4.0 +# Since: 2.11 # ## { 'struct': 'ThrottleLimits',
Signature · 1 line
1.8.3.1