add throttle block driver filter
v9 cover add throttle block driver filter
This series adds a throttle block driver filter. Currently throttling is done at the BlockBackend level. Using block driver interfaces we can move the throttling to any point in the BDS graph using a throttle node which uses the existing throttling code. This allows for potentially more complex configurations (throttling at any point in the graph, chained filters)
v9:
fix suggestions by stefanha in patch 4
add 'throttle_group_can_be_deleted' function in patch 4
v8:
fix suggestions by berto
v7:
remove anonymous groups
error on missing throttle-group option on block/throttle.c change switch case format in block/throttle-groups.c (berto)
v6:
don't allow named group limit configuration in block/throttle.c; allow either
-drive driver=throttle,file.filename=foo.qcow2, \
limits.iops-total=...
or
-drive driver=throttle,file.filename=foo.qcow2,throttle-group=barfixes suggested by berto
v5:
fix crash in 'add aio_context field in ThrottleGroupMember' fix suggestions in block/throttle.c
v4:
fix suggestions in block/throttle.c
fix suggestions in block/throttle_groups.c
add doc note in BlockDevOptionsThrottle
v3:
fix style error in 'add aio_context field in ThrottleGroupMember'
v2:
change QOM throttle group object name
print valid ranges for uint on error
move frees in throttle_group_obj_finalize()
split throttle_group_{set,get}()
add throttle_recurse_is_first_non_filter()
Manos Pitsidianakis (6):
block: move ThrottleGroup membership to ThrottleGroupMember
block: add aio_context field in ThrottleGroupMember
block: tidy ThrottleGroupMember initializations
block: convert ThrottleGroup to object with QOM
block: add throttle block filter driver
qemu-iotests: add 184 for throttle filter driver
qapi/block-core.json | 66 +++- include/block/throttle-groups.h | 52 ++- include/qemu/throttle-options.h | 60 +++- include/qemu/throttle.h | 3 + include/sysemu/block-backend.h | 20 +- block/block-backend.c | 62 ++-- block/qapi.c | 8 +- block/throttle-groups.c | 748 ++++++++++++++++++++++++++++++---------- block/throttle.c | 250 ++++++++++++++ blockdev.c | 4 +- tests/test-throttle.c | 111 +++--- util/throttle.c | 151 ++++++++ block/Makefile.objs | 1 + tests/qemu-iotests/184 | 205 +++++++++++ tests/qemu-iotests/184.out | 300 ++++++++++++++++ tests/qemu-iotests/group | 1 + 16 files changed, 1721 insertions(+), 321 deletions(-) create mode 100644 block/throttle.c create mode 100755 tests/qemu-iotests/184 create mode 100644 tests/qemu-iotests/184.out
Signature · 1 line
2.11.0
PATCH v9 1/6 block: move ThrottleGroup membership to ThrottleGroupMember
This commit eliminates the 1:1 relationship between BlockBackend and throttle group state. Users will be able to create multiple throttle nodes, each with its own throttle group state, in the future. The throttle group state cannot be per-BlockBackend anymore, it must be per-throttle node. This is done by gathering ThrottleGroup membership details from BlockBackendPublic into ThrottleGroupMember and refactoring existing code to use the structure.
--- include/block/throttle-groups.h | 39 +++++- include/sysemu/block-backend.h | 20 +-- block/block-backend.c | 66 +++++---- block/qapi.c | 8 +- block/throttle-groups.c | 288 ++++++++++++++++++++-------------------- blockdev.c | 4 +- tests/test-throttle.c | 53 ++++---- 7 files changed, 252 insertions(+), 226 deletions(-)
include/block/throttle-groups.h +32 -7
@@ -28,19 +28,44 @@#include "qemu/throttle.h" #include "block/block_int.h" -const char *throttle_group_get_name (BlockBackend *blk); +/* The ThrottleGroupMember structure indicates membership in a ThrottleGroup +* and holds related data. +*/ + +typedef struct ThrottleGroupMember { +/* throttled_reqs_lock protects the CoQueues for throttled requests. */ +CoMutex throttled_reqs_lock; +CoQueue throttled_reqs[2 ]; + +/* Nonzero if the I/O limits are currently being ignored; generally +* it is zero. Accessed with atomic operations. +*/ +unsigned int io_limits_disabled; + +/* The following fields are protected by the ThrottleGroup lock. +* See the ThrottleGroup documentation for details. +* throttle_state tells us if I/O limits are configured. */ +ThrottleState *throttle_state; +ThrottleTimers throttle_timers; +unsigned pending_reqs[2 ]; +QLIST_ENTRY (ThrottleGroupMember) round_robin; + +}ThrottleGroupMember ; + +const char *throttle_group_get_name (ThrottleGroupMember *tgm);ThrottleState *throttle_group_incref (const char *name);void throttle_group_unref (ThrottleState *ts); -void throttle_group_config (BlockBackend *blk,ThrottleConfig *cfg); -void throttle_group_get_config (BlockBackend *blk,ThrottleConfig *cfg); +void throttle_group_config (ThrottleGroupMember *tgm,ThrottleConfig *cfg); +void throttle_group_get_config (ThrottleGroupMember *tgm,ThrottleConfig *cfg); -void throttle_group_register_blk (BlockBackend *blk,const char *groupname); -void throttle_group_unregister_blk (BlockBackend *blk); -void throttle_group_restart_blk (BlockBackend *blk); +void throttle_group_register_tgm (ThrottleGroupMember *tgm, +const char *groupname); +void throttle_group_unregister_tgm (ThrottleGroupMember *tgm); +void throttle_group_restart_tgm (ThrottleGroupMember *tgm); -void coroutine_fn throttle_group_co_io_limits_intercept(BlockBackend *blk, +void coroutine_fn throttle_group_co_io_limits_intercept(ThrottleGroupMember *tgm,unsigned int bytes,bool is_write);
include/sysemu/block-backend.h +3 -17
@@ -70,24 +70,10 @@ typedef struct BlockDevOps {/* This struct is embedded in (the private) BlockBackend struct and contains * fields that must be public. This is in particular for QLIST_ENTRY() and -* friends so that BlockBackends can be kept in lists outside block-backend.c */ +* friends so that BlockBackends can be kept in lists outside block-backend.c +* */ typedef struct BlockBackendPublic { -/* throttled_reqs_lock protects the CoQueues for throttled requests. */ -CoMutex throttled_reqs_lock; -CoQueue throttled_reqs[2 ]; - -/* Nonzero if the I/O limits are currently being ignored; generally -* it is zero. Accessed with atomic operations. -*/ -unsigned int io_limits_disabled; - -/* The following fields are protected by the ThrottleGroup lock. -* See the ThrottleGroup documentation for details. -* throttle_state tells us if I/O limits are configured. */ -ThrottleState *throttle_state; -ThrottleTimers throttle_timers; -unsigned pending_reqs[2 ]; -QLIST_ENTRY (BlockBackendPublic) round_robin; +ThrottleGroupMember throttle_group_member; }BlockBackendPublic ;BlockBackend *blk_new (uint64_t perm,uint64_t shared_perm);
block/block-backend.c +37 -29
153 lines not on this page · raw message
block/qapi.c +5 -3
@@ -66,10 +66,11 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, info->detect_zeroes = bs->detect_zeroes; -if (blk &&blk_get_public (blk)->throttle_state) { +if (blk &&blk_get_public (blk)->throttle_group_member.throttle_state) {ThrottleConfig cfg; +BlockBackendPublic *blkp =blk_get_public (blk); -throttle_group_get_config (blk, &cfg); +throttle_group_get_config (&blkp->throttle_group_member, &cfg); info->bps = cfg.buckets[THROTTLE_BPS_TOTAL ].avg; info->bps_rd = cfg.buckets[THROTTLE_BPS_READ ].avg;
@@ -117,7 +118,8 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, info->iops_size = cfg.op_size; info->has_group = true; - info->group =g_strdup (throttle_group_get_name (blk)); + info->group = +g_strdup (throttle_group_get_name (&blkp->throttle_group_member)); } info->write_threshold =bdrv_write_threshold_get (bs);
block/throttle-groups.c +144 -144
564 lines not on this page · raw message
blockdev.c +2 -2
@@ -2688,7 +2688,7 @@ void qmp_block_set_io_throttle(BlockIOThrottle *arg, Error **errp) if (throttle_enabled(&cfg)) { /* Enable I/O limits if they're not enabled yet, otherwise * just update the throttling group. */ - if (!blk_get_public(blk)->throttle_state) { + if (!blk_get_public(blk)->throttle_group_member.throttle_state) { blk_io_limits_enable(blk, arg->has_group ? arg->group : arg->has_device ? arg->device :
@@ -2698,7 +2698,7 @@ void qmp_block_set_io_throttle(BlockIOThrottle *arg, Error **errp) }/* Set the new throttling configuration */ blk_set_io_limits (blk, &cfg); - }else if (blk_get_public (blk)->throttle_state) { + }else if (blk_get_public (blk)->throttle_group_member.throttle_state) {/* If all throttling settings are set to 0, disable I/O limits */ blk_io_limits_disable (blk); }
tests/test-throttle.c +29 -24
85 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v9 2/6 block: add aio_context field in ThrottleGroupMember
In reply to Manos Pitsidianakistimer_cb() needs to know about the current Aio context of the throttle request that is woken up. In order to make ThrottleGroupMember backend agnostic, this information is stored in an aio_context field instead of accessing it from BlockBackend.
--- include/block/throttle-groups.h | 7 ++++- block/block-backend.c | 15 ++++------ block/throttle-groups.c | 38 ++++++++++++++++--------- tests/test-throttle.c | 63 +++++++++++++++++++++-------------------- 4 files changed, 69 insertions(+), 54 deletions(-)
include/block/throttle-groups.h +6 -1
@@ -33,6 +33,7 @@*/ typedef struct ThrottleGroupMember { + AioContext *aio_context; /* throttled_reqs_lock protects the CoQueues for throttled requests. */ CoMutex throttled_reqs_lock; CoQueue throttled_reqs[2];
@@ -61,12 +62,16 @@ void throttle_group_config(ThrottleGroupMember *tgm, ThrottleConfig *cfg);void throttle_group_get_config (ThrottleGroupMember *tgm,ThrottleConfig *cfg);void throttle_group_register_tgm (ThrottleGroupMember *tgm, -const char *groupname); +const char *groupname, +AioContext *ctx);void throttle_group_unregister_tgm (ThrottleGroupMember *tgm);void throttle_group_restart_tgm (ThrottleGroupMember *tgm); void coroutine_fn throttle_group_co_io_limits_intercept(ThrottleGroupMember *tgm,unsigned int bytes,bool is_write); +void throttle_group_attach_aio_context (ThrottleGroupMember *tgm, +AioContext *new_context); +void throttle_group_detach_aio_context (ThrottleGroupMember *tgm);#endif
block/block-backend.c +6 -9
@@ -1726,18 +1726,14 @@ static AioContext *blk_aiocb_get_aio_context(BlockAIOCB *acb)void blk_set_aio_context (BlockBackend *blk,AioContext *new_context) {BlockDriverState *bs =blk_bs (blk); -ThrottleTimers *tt; +ThrottleGroupMember *tgm = &blk->public.throttle_group_member;if (bs) { -if (blk->public.throttle_group_member.throttle_state) { - tt = &blk->public.throttle_group_member.throttle_timers; -throttle_timers_detach_aio_context (tt); +if (tgm->throttle_state) { +throttle_group_detach_aio_context (tgm); +throttle_group_attach_aio_context (tgm, new_context); }bdrv_set_aio_context (bs, new_context); -if (blk->public.throttle_group_member.throttle_state) { - tt = &blk->public.throttle_group_member.throttle_timers; -throttle_timers_attach_aio_context (tt, new_context); - } } }
@@ -1970,7 +1966,8 @@ void blk_io_limits_disable(BlockBackend *blk)void blk_io_limits_enable (BlockBackend *blk,const char *group) {assert (!blk->public.throttle_group_member.throttle_state); -throttle_group_register_tgm (&blk->public.throttle_group_member, group); +throttle_group_register_tgm (&blk->public.throttle_group_member, + group,blk_get_aio_context (blk)); }void blk_io_limits_update_group (BlockBackend *blk,const char *group)
block/throttle-groups.c +24 -14
@@ -391,9 +391,6 @@ static void coroutine_fn throttle_group_restart_queue_entry(void *opaque)static void throttle_group_restart_queue (ThrottleGroupMember *tgm,bool is_write) { -BlockBackendPublic *blkp =container_of (tgm, BlockBackendPublic, - throttle_group_member); -BlockBackend *blk =blk_by_public (blkp);Coroutine *co;RestartData rd = { .tgm = tgm,
@@ -401,7 +398,7 @@ static void throttle_group_restart_queue(ThrottleGroupMember *tgm, bool is_write }; co =qemu_coroutine_create (throttle_group_restart_queue_entry, &rd); -aio_co_enter (blk_get_aio_context (blk), co); +aio_co_enter (tgm->aio_context, co); }void throttle_group_restart_tgm (ThrottleGroupMember *tgm)
@@ -449,13 +446,11 @@ void throttle_group_get_config(ThrottleGroupMember *tgm, ThrottleConfig *cfg)/* ThrottleTimers callback. This wakes up a request that was waiting * because it had been throttled. * -* @blk: the BlockBackend whose request had been throttled +* @tgm: the ThrottleGroupMember whose request had been throttled * @is_write: the type of operation (read/write) */ -static void timer_cb (BlockBackend *blk,bool is_write) +static void timer_cb (ThrottleGroupMember *tgm,bool is_write) { -BlockBackendPublic *blkp =blk_get_public (blk); -ThrottleGroupMember *tgm = &blkp->throttle_group_member;ThrottleState *ts = tgm->throttle_state;ThrottleGroup *tg =container_of (ts, ThrottleGroup, ts);
@@ -484,18 +479,18 @@ static void write_timer_cb(void *opaque)* * @tgm: the ThrottleGroupMember to insert * @groupname: the name of the group +* @ctx: the AioContext to use */ void throttle_group_register_tgm (ThrottleGroupMember *tgm, -const char *groupname) +const char *groupname, +AioContext *ctx) {int i; -BlockBackendPublic *blkp =container_of (tgm, BlockBackendPublic, - throttle_group_member); -BlockBackend *blk =blk_by_public (blkp);ThrottleState *ts =throttle_group_incref (groupname);ThrottleGroup *tg =container_of (ts, ThrottleGroup, ts); tgm->throttle_state = ts; + tgm->aio_context = ctx;qemu_mutex_lock (&tg->lock);/* If the ThrottleGroup is new set this ThrottleGroupMember as the token */
@@ -508,11 +503,11 @@ void throttle_group_register_tgm(ThrottleGroupMember *tgm,QLIST_INSERT_HEAD (&tg->head, tgm, round_robin);throttle_timers_init (&tgm->throttle_timers, -blk_get_aio_context (blk), + tgm->aio_context, tg->clock_type, read_timer_cb, write_timer_cb, - blk); + tgm);qemu_mutex_unlock (&tg->lock); }
@@ -559,6 +554,21 @@ void throttle_group_unregister_tgm(ThrottleGroupMember *tgm) tgm->throttle_state =NULL ; } +void throttle_group_attach_aio_context (ThrottleGroupMember *tgm, +AioContext *new_context) +{ +ThrottleTimers *tt = &tgm->throttle_timers; +throttle_timers_attach_aio_context (tt, new_context); + tgm->aio_context = new_context; +} + +void throttle_group_detach_aio_context (ThrottleGroupMember *tgm) +{ +ThrottleTimers *tt = &tgm->throttle_timers; +throttle_timers_detach_aio_context (tt); + tgm->aio_context =NULL ; +} +static void throttle_groups_init (void ) {qemu_mutex_init (&throttle_groups_lock);
tests/test-throttle.c +33 -30
160 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v9 3/6 block: tidy ThrottleGroupMember initializations
In reply to Manos PitsidianakisMove the CoMutex and CoQueue inits inside throttle_group_register_tgm() which is called whenever a ThrottleGroupMember is initialized. There's no need for them to be separate.
--- block/block-backend.c | 3 --- block/throttle-groups.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
block/block-backend.c +0 -3
@@ -252,9 +252,6 @@ BlockBackend *blk_new(uint64_t perm, uint64_t shared_perm) blk->shared_perm = shared_perm;blk_set_enable_write_cache (blk, true); -qemu_co_mutex_init (&blk->public.throttle_group_member.throttled_reqs_lock); -qemu_co_queue_init (&blk->public.throttle_group_member.throttled_reqs[0 ]); -qemu_co_queue_init (&blk->public.throttle_group_member.throttled_reqs[1 ]);block_acct_init (&blk->stats);notifier_list_init (&blk->remove_bs_notifiers);
block/throttle-groups.c +3 -0
@@ -508,6 +508,9 @@ void throttle_group_register_tgm(ThrottleGroupMember *tgm, read_timer_cb, write_timer_cb, tgm); +qemu_co_mutex_init (&tgm->throttled_reqs_lock); +qemu_co_queue_init (&tgm->throttled_reqs[0 ]); +qemu_co_queue_init (&tgm->throttled_reqs[1 ]);qemu_mutex_unlock (&tg->lock); }
Signature · 1 line
2.11.0
PATCH v9 4/6 block: convert ThrottleGroup to object with QOM
In reply to Manos PitsidianakisThrottleGroup is converted to an object. This will allow the future throttle block filter drive easy creation and configuration of throttle groups in QMP and cli.
A new QAPI struct, ThrottleLimits, is introduced to provide a shared struct for all throttle configuration needs in QMP.
ThrottleGroups can be created via CLI as
-object throttle-group,id=foo,x-iops-total=100,x-..
where x-* are individual limit properties. Since we can't add non-scalar properties in -object this interface must be used instead. However, setting these properties must be disabled after initialization because certain combinations of limits are forbidden and thus configuration changes should be done in one transaction. The individual properties will go away when support for non-scalar values in CLI is implemented and thus are marked as experimental.
ThrottleGroup also has a limits property that uses the ThrottleLimits struct. It can be used to create ThrottleGroups or set the configuration in existing groups as follows:
{ "execute": "object-add",
"arguments": {
"qom-type": "throttle-group",
"id": "foo",
"props" : {
"limits": {
"iops-total": 100
}
}
}
}
{ "execute" : "qom-set",
"arguments" : {
"path" : "foo",
"property" : "limits",
"value" : {
"iops-total" : 99
}
}
}This also means a group's configuration can be fetched with qom-get.
--- qapi/block-core.json | 48 +++++ include/block/throttle-groups.h | 3 + include/qemu/throttle-options.h | 59 ++++-- include/qemu/throttle.h | 3 + block/throttle-groups.c | 422 ++++++++++++++++++++++++++++++++++++---- tests/test-throttle.c | 1 + util/throttle.c | 151 ++++++++++++++ 7 files changed, 627 insertions(+), 60 deletions(-)
qapi/block-core.json +48 -0
@@ -1905,6 +1905,54 @@ '*iops_size': 'int', '*group': 'str' } } ## +# @ThrottleLimits: +# +# Limit parameters for throttling. +# Since some limit combinations are illegal, limits should always be set in one +# transaction. All fields are optional. When setting limits, if a field is +# missing the current value is not changed. +# +# @iops-total: limit total I/O operations per second +# @iops-total-max: I/O operations burst +# @iops-total-max-length: length of the iops-total-max burst period, in 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 +# +# 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' } } + +## # @block-stream: # # Copy data from a backing file into a block device.
include/block/throttle-groups.h +3 -0
@@ -53,6 +53,9 @@ typedef struct ThrottleGroupMember { } ThrottleGroupMember; +#define TYPE_THROTTLE_GROUP "throttle-group" +#define THROTTLE_GROUP (obj) OBJECT_CHECK(ThrottleGroup, (obj), TYPE_THROTTLE_GROUP) +const char *throttle_group_get_name (ThrottleGroupMember *tgm);ThrottleState *throttle_group_incref (const char *name);
include/qemu/throttle-options.h +40 -19
121 lines not on this page · raw message
include/qemu/throttle.h +3 -0
@@ -152,5 +152,8 @@ bool throttle_schedule_timer(ThrottleState *ts, bool is_write);void throttle_account (ThrottleState *ts,bool is_write,uint64_t size); +void throttle_limits_to_config (ThrottleLimits *arg,ThrottleConfig *cfg, +Error **errp); +void throttle_config_to_limits (ThrottleConfig *cfg,ThrottleLimits *var);#endif
block/throttle-groups.c +381 -41
490 lines not on this page · raw message
tests/test-throttle.c +1 -0
@@ -662,6 +662,7 @@ int main(int argc, char **argv)qemu_init_main_loop (&error_fatal); ctx =qemu_get_aio_context ();bdrv_init (); +module_call_init (MODULE_INIT_QOM );do {}while (g_main_context_iteration (NULL , false));
util/throttle.c +151 -0
154 lines not on this page · raw message
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v9 4/6] block: convert ThrottleGroup to object with QOM
Quoted 3 lines · Manos Pitsidianakis
ThrottleGroup is converted to an object. This will allow the future throttle block filter drive easy creation and configuration of throttle groups in QMP and cli.
Berto
Re: [Qemu-devel] [PATCH v9 4/6] block: convert ThrottleGroup to object with QOM
In reply to Manos PitsidianakisQuoted 45 lines · Manos Pitsidianakis
ThrottleGroup is converted to an object. This will allow the future throttle block filter drive easy creation and configuration of throttle groups in QMP and cli.
A new QAPI struct, ThrottleLimits, is introduced to provide a shared struct for all throttle configuration needs in QMP.
ThrottleGroups can be created via CLI as
-object throttle-group,id=foo,x-iops-total=100,x-..where x-* are individual limit properties. Since we can't add non-scalar properties in -object this interface must be used instead. However, setting these properties must be disabled after initialization because certain combinations of limits are forbidden and thus configuration changes should be done in one transaction. The individual properties will go away when support for non-scalar values in CLI is implemented and thus are marked as experimental.
ThrottleGroup also has a
limitsproperty that uses the ThrottleLimits struct. It can be used to create ThrottleGroups or set the configuration in existing groups as follows:{ "execute": "object-add",
"arguments": { "qom-type": "throttle-group", "id": "foo", "props" : { "limits": { "iops-total": 100 } } } } { "execute" : "qom-set", "arguments" : { "path" : "foo", "property" : "limits", "value" : { "iops-total" : 99 } } }This also means a group's configuration can be fetched with qom-get.
Signed-off-by Manos Pitsidianakis <[email protected]>
Quoted 9 lines
--- qapi/block-core.json | 48 +++++ include/block/throttle-groups.h | 3 + include/qemu/throttle-options.h | 59 ++++-- include/qemu/throttle.h | 3 + block/throttle-groups.c | 422 ++++++++++++++++++++++++++++++++++++---- tests/test-throttle.c | 1 + util/throttle.c | 151 ++++++++++++++ 7 files changed, 627 insertions(+), 60 deletions(-)
Re: [Qemu-devel] [PATCH v9 4/6] block: convert ThrottleGroup to object with QOM
In reply to Manos PitsidianakisAm 25.08.2017 um 15:20 hat Manos Pitsidianakis geschrieben:
Quoted 48 lines
ThrottleGroup is converted to an object. This will allow the future throttle block filter drive easy creation and configuration of throttle groups in QMP and cli.
A new QAPI struct, ThrottleLimits, is introduced to provide a shared struct for all throttle configuration needs in QMP.
ThrottleGroups can be created via CLI as
-object throttle-group,id=foo,x-iops-total=100,x-..where x-* are individual limit properties. Since we can't add non-scalar properties in -object this interface must be used instead. However, setting these properties must be disabled after initialization because certain combinations of limits are forbidden and thus configuration changes should be done in one transaction. The individual properties will go away when support for non-scalar values in CLI is implemented and thus are marked as experimental.
ThrottleGroup also has a
limitsproperty that uses the ThrottleLimits struct. It can be used to create ThrottleGroups or set the configuration in existing groups as follows:{ "execute": "object-add",
"arguments": { "qom-type": "throttle-group", "id": "foo", "props" : { "limits": { "iops-total": 100 } } } } { "execute" : "qom-set", "arguments" : { "path" : "foo", "property" : "limits", "value" : { "iops-total" : 99 } } }This also means a group's configuration can be fetched with qom-get.
Signed-off-by Manos Pitsidianakis <[email protected]>block/throttle-groups.c +2
-0+static bool throttle_group_can_be_deleted (UserCreatable *uc,Error **errp) +{
block/throttle-groups.c void throttle_group_detach_aio_context(ThrottleGroupMember *tgm) · line 880
Quoted 10 lines
block/throttle-groups.c +10
-0+return OBJECT (uc)->ref ==1 ; +} + +static void throttle_group_obj_class_init (ObjectClass *klass,void *class_data) +{ +size_t i =0 ; +UserCreatableClass *ucc =USER_CREATABLE_CLASS (klass); + + ucc->complete = throttle_group_obj_complete; + ucc->can_be_deleted = throttle_group_can_be_deleted;
block/throttle-groups.c: In function 'throttle_group_obj_class_init':block/throttle-groups.c:880:25: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
ucc->can_be_deleted = throttle_group_can_be_deleted;
This is from a semantic conflict with commit 3beacfb9 ('qom: Remove unused errp parameter from can_be_deleted()'). If the rest of the series is okay, I'll just remove the **errp parameter while applying.
Kevin
PATCH v9 5/6 block: add throttle block filter driver
In reply to Manos Pitsidianakisblock/throttle.c uses existing I/O throttle infrastructure inside a block filter driver. I/O operations are intercepted in the filter's read/write coroutines, and referred to block/throttle-groups.c
The driver can be used with the syntax
-drive driver=throttle,file.filename=foo.qcow2,throttle-group=bar
which registers the throttle filter node with the ThrottleGroup 'bar'. The given group must be created beforehand with object-add or -object.
--- qapi/block-core.json | 18 ++- include/block/throttle-groups.h | 5 + include/qemu/throttle-options.h | 1 + block/throttle-groups.c | 15 ++- block/throttle.c | 250 ++++++++++++++++++++++++++++++++++++++++ block/Makefile.objs | 1 + 6 files changed, 288 insertions(+), 2 deletions(-) create mode 100644 block/throttle.c
qapi/block-core.json +17 -1
@@ -2222,6 +2222,7 @@ # Drivers that are supported in block device operations. # # @vxhs: Since 2.10 +# @throttle: Since 2.11 # # Since: 2.9 ##
@@ -2231,7 +2232,7 @@ 'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh', - 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] } + 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] } ## # @BlockdevOptionsFile:
@@ -3095,6 +3096,20 @@ '*tls-creds': 'str' } } ## +# @BlockdevOptionsThrottle: +# +# Driver specific block device options for the throttle driver +# +# @throttle-group: the name of the throttle-group object to use. It +# must already exist. +# @file: reference to or definition of the data source block device +# Since: 2.11 +## +{ 'struct': 'BlockdevOptionsThrottle', + 'data': { 'throttle-group': 'str', + 'file' : 'BlockdevRef' + } } +## # @BlockdevOptions: # # Options for creating a block device. Many options are available for all
@@ -3155,6 +3170,7 @@ 'replication':'BlockdevOptionsReplication', 'sheepdog': 'BlockdevOptionsSheepdog', 'ssh': 'BlockdevOptionsSsh', + 'throttle': 'BlockdevOptionsThrottle', 'vdi': 'BlockdevOptionsGenericFormat', 'vhdx': 'BlockdevOptionsGenericFormat', 'vmdk': 'BlockdevOptionsGenericCOWFormat',
include/block/throttle-groups.h +5 -0
@@ -76,5 +76,10 @@ void coroutine_fn throttle_group_co_io_limits_intercept(ThrottleGroupMember *tgmvoid throttle_group_attach_aio_context (ThrottleGroupMember *tgm,AioContext *new_context);void throttle_group_detach_aio_context (ThrottleGroupMember *tgm); +/* +* throttle_group_exists() must be called under the global +* mutex. +*/ +bool throttle_group_exists (const char *name);#endif
include/qemu/throttle-options.h +1 -0
@@ -29,6 +29,7 @@#define QEMU_OPT_BPS_WRITE_MAX "bps-write-max"#define QEMU_OPT_BPS_WRITE_MAX_LENGTH "bps-write-max-length"#define QEMU_OPT_IOPS_SIZE "iops-size" +#define QEMU_OPT_THROTTLE_GROUP_NAME "throttle-group"#define THROTTLE_OPT_PREFIX "throttling."#define THROTTLE_OPTS \
block/throttle-groups.c +14 -1
@@ -101,6 +101,14 @@ static ThrottleGroup *throttle_group_by_name(const char *name)return NULL ; } +/* This function reads throttle_groups and must be called under the global +* mutex. +*/ +bool throttle_group_exists (const char *name) +{ +return throttle_group_by_name (name) !=NULL ; +} +/* Increments the reference count of a ThrottleGroup given its name. * * If no ThrottleGroup is found with the given name a new one is
@@ -543,6 +551,11 @@ void throttle_group_unregister_tgm(ThrottleGroupMember *tgm)ThrottleGroupMember *token;int i; +if (!ts) { +/* Discard already unregistered tgm */ +return ; + } +assert (tgm->pending_reqs[0 ] ==0 && tgm->pending_reqs[1 ] ==0 );assert (qemu_co_queue_empty (&tgm->throttled_reqs[0 ]));assert (qemu_co_queue_empty (&tgm->throttled_reqs[1 ]));
@@ -709,7 +722,7 @@ static void throttle_group_obj_complete(UserCreatable *obj, Error **errp)assert (tg->name);/* error if name is duplicate */ -if (throttle_group_by_name (tg->name) !=NULL ) { +if (throttle_group_exists (tg->name)) {error_setg (errp,"A group with this name already exists" );return ; }
block/throttle.c new file +250 -0
250 lines not on this page · raw message
block/Makefile.objs +1 -0
@@ -25,6 +25,7 @@ block-obj-y += accounting.o dirty-bitmap.o block-obj-y += write-threshold.o block-obj-y += backup.o block-obj-$(CONFIG_REPLICATION) += replication.o +block-obj-y += throttle.o block-obj-y += crypto.o
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v9 5/6] block: add throttle block filter driver
Quoted 9 lines · Manos Pitsidianakis
block/throttle.c new file +9
-0+static int throttle_configure_tgm (BlockDriverState *bs, +ThrottleGroupMember *tgm, +QDict *options,Error **errp) +{ +int ret; +const char *group_name; +Error *local_err =NULL ; +QemuOpts *opts =qemu_opts_create (&throttle_opts,NULL ,0 , &error_abort); +
block/throttle.c line 56
Quoted 10 lines
block/throttle.c new file +10
-0+qemu_opts_absorb_qdict (opts, options, &local_err); +if (local_err) { +error_propagate (errp, local_err); + ret = -EINVAL ; + goto fin; + } + + group_name =qemu_opt_get (opts,QEMU_OPT_THROTTLE_GROUP_NAME ); +if (!group_name) { +error_setg (errp,"Please specify a throttle group." );
error_setg() messages do not end with punctuation:
error_setg(errp, "Please specify a throttle group");
This is not worth respinning for though.
block/throttle.c line 60
Quoted 4 lines
block/throttle.c new file +4
-0+ ret = -EINVAL ; + goto fin; + }else if (!throttle_group_exists (group_name)) { +error_setg (errp,"Throttle group '%s' does not exist." , group_name);
Same here.
Anyway:
PATCH v9 6/6 qemu-iotests: add 184 for throttle filter driver
In reply to Manos Pitsidianakis--- tests/qemu-iotests/184 | 205 +++++++++++++++++++++++++++++++ tests/qemu-iotests/184.out | 300 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 506 insertions(+) create mode 100755 tests/qemu-iotests/184 create mode 100644 tests/qemu-iotests/184.out
tests/qemu-iotests/184 new file +205 -0
@@ -0,0 +1,205 @@ +#!/bin/bash +# +# Test I/O throttle block filter driver interface +# +# Copyright (C) 2017 Manos Pitsidianakis +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# creator +owner="Manos Pitsidianakis" + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + +function do_run_qemu() +{ + echo Testing: "$@" | _filter_imgfmt + $QEMU -nographic -qmp-pretty stdio -serial none "$@" + echo +} + +function run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\ + | _filter_qemu_io | _filter_generated_node_ids +} + +_make_test_img 64M +test_throttle=$($QEMU_IMG --help|grep throttle) +[ "$test_throttle" = "" ] && _supported_fmt throttle + +echo +echo "== checking interface ==" + +run_qemu <<EOF +{ "execute": "qmp_capabilities" } +{ "execute": "blockdev-add", + "arguments": { + "driver": "$IMGFMT", + "node-name": "disk0", + "file": { + "driver": "file", + "filename": "$TEST_IMG" + } + } +} +{ "execute": "object-add", + "arguments": { + "qom-type": "throttle-group", + "id": "group0", + "props": { + "limits" : { + "iops-total": 1000 + } + } + } +} +{ "execute": "blockdev-add", + "arguments": { + "driver": "throttle", + "node-name": "throttle0", + "throttle-group": "group0", + "file": "disk0" + } +} +{ "execute": "query-named-block-nodes" } +{ "execute": "query-block" } +{ "execute": "quit" } +EOF + +echo +echo "== property changes in ThrottleGroup ==" + +run_qemu <<EOF +{ "execute": "qmp_capabilities" } +{ "execute": "object-add", + "arguments": { + "qom-type": "throttle-group", + "id": "group0", + "props" : { + "limits": { + "iops-total": 1000 + } + } + } +} +{ "execute" : "qom-get", + "arguments" : { + "path" : "group0", + "property" : "limits" + } +} +{ "execute" : "qom-set", + "arguments" : { + "path" : "group0", + "property" : "limits", + "value" : { + "iops-total" : 0 + } + } +} +{ "execute" : "qom-get", + "arguments" : { + "path" : "group0", + "property" : "limits" + } +} +{ "execute": "quit" } +EOF + +echo +echo "== object creation/set errors ==" + +run_qemu <<EOF +{ "execute": "qmp_capabilities" } +{ "execute": "object-add", + "arguments": { + "qom-type": "throttle-group", + "id": "group0", + "props" : { + "limits": { + "iops-total": 1000 + } + } + } +} +{ "execute" : "qom-set", + "arguments" : { + "path" : "group0", + "property" : "x-iops-total", + "value" : 0 + } +} +{ "execute" : "qom-set", + "arguments" : { + "path" : "group0", + "property" : "limits", + "value" : { + "iops-total" : 10, + "iops-read" : 10 + } + } +} +{ "execute": "quit" } +EOF + +echo +echo "== don't specify group ==" + +run_qemu <<EOF +{ "execute": "qmp_capabilities" } +{ "execute": "blockdev-add", + "arguments": { + "driver": "$IMGFMT", + "node-name": "disk0", + "file": { + "driver": "file", + "filename": "$TEST_IMG" + } + } +} +{ "execute": "blockdev-add", + "arguments": { + "driver": "throttle", + "node-name": "throttle0", + "file": "disk0" + } +} +{ "execute": "quit" } +EOF + +echo +# success, all done +echo "*** done" +rm -f $seq.full +status=0
tests/qemu-iotests/184.out new file +300 -0
300 lines not on this page · raw message
tests/qemu-iotests/group +1 -0
@@ -180,6 +180,7 @@ 181 rw auto migration 182 rw auto quick 183 rw auto migration +184 rw auto quick 185 rw auto 186 rw auto 187 rw auto
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v9 6/6] qemu-iotests: add 184 for throttle filter driver
Quoted 9 lines · Manos Pitsidianakis
Reviewed-by Alberto Garcia <[email protected]>Signed-off-by Manos Pitsidianakis <[email protected]>--- tests/qemu-iotests/184 | 205 +++++++++++++++++++++++++++++++ tests/qemu-iotests/184.out | 300 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 506 insertions(+) create mode 100755 tests/qemu-iotests/184 create mode 100644 tests/qemu-iotests/184.out
Re: [Qemu-devel] [PATCH v9 6/6] qemu-iotests: add 184 for throttle filter driver
In reply to Manos PitsidianakisAm 25.08.2017 um 15:20 hat Manos Pitsidianakis geschrieben:
Quoted 2 lines
Reviewed-by Alberto Garcia <[email protected]>Signed-off-by Manos Pitsidianakis <[email protected]>
Does this test actually (still) pass for you? I can't see that it's related to any recent change in master, but this is the diff that I get.
I can update the reference output while applying, but obviously if it's currently passing for you, it will fail after I "fix" it.
Kevin
184 [18:07:39] [18:07:39] - output mismatch (see 184.out.bad)
184.out.bad 2017-09-05 18:07:39.707341854 +0200 renamed from home/kwolf/source/qemu/tests/qemu-iotests/184.out 2017-09-05 18:07:30.751340633 +0200 +3 -1
@@ -30,8 +30,10 @@ "image": { "virtual-size": 67108864, "filename": "json:{\"throttle-group\": \"group0\", \"driver\": \"throttle\", \"file\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}}", + "cluster-size": 65536, "format": "throttle", - "actual-size": 200704 + "actual-size": 200704, + "dirty-flag": false }, "iops_wr": 0, "ro": false,
Re: [Qemu-devel] [Qemu-block] [PATCH v9 6/6] qemu-iotests: add 184 for throttle filter driver
Am 05.09.2017 um 18:16 hat Kevin Wolf geschrieben:
Quoted 9 lines
Am 25.08.2017 um 15:20 hat Manos Pitsidianakis geschrieben:
Quoted 2 lines
Reviewed-by Alberto Garcia <[email protected]>Signed-off-by Manos Pitsidianakis <[email protected]>Does this test actually (still) pass for you? I can't see that it's related to any recent change in master, but this is the diff that I get.
I can update the reference output while applying, but obviously if it's currently passing for you, it will fail after I "fix" it.
For the record, we discussed this on IRC. The test works correctly on master, but on my block branch there is a conflict with "block: pass bdrv_* methods to bs->file by default in block filters".
The correct action is to merge this throttle driver series after the conflicting patch because throttle doesn't implement .bdrv_get_info and needs the forwarding that the other patch implements.
I updated the test output accordingly and applied the series to my block branch.
Kevin
Re: [Qemu-devel] [Qemu-block] [PATCH v9 6/6] qemu-iotests: add 184 for throttle filter driver
Quoted 15 lines · Kevin Wolf
Am 05.09.2017 um 18:16 hat Kevin Wolf geschrieben:
Quoted 9 lines
Am 25.08.2017 um 15:20 hat Manos Pitsidianakis geschrieben:
Quoted 2 lines
Reviewed-by Alberto Garcia <[email protected]>Signed-off-by Manos Pitsidianakis <[email protected]>Does this test actually (still) pass for you? I can't see that it's related to any recent change in master, but this is the diff that I get.
I can update the reference output while applying, but obviously if it's currently passing for you, it will fail after I "fix" it.
For the record, we discussed this on IRC. The test works correctly on master, but on my block branch there is a conflict with "block: pass bdrv_* methods to
bs->fileby default in block filters".
Quoted 6 lines
The correct action is to merge this throttle driver series after the conflicting patch because throttle doesn't implement .bdrv_get_info and needs the forwarding that the other patch implements.
I updated the test output accordingly and applied the series to my block branch.
Could you also squash this in to 5/6? (as long as we're intentionally basing throttle on top of defaults, then we should use the right default instead of duplicating things)
block/throttle.c +0 -0
@@ -197,19 +197,6 @@ static bool
throttle_recurse_is_first_non_filter(BlockDriverState *bs,
return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate);
}
-static int64_t coroutine_fn throttle_co_get_block_status(BlockDriverState *bs,
- int64_tsector_num,
- int nb_sectors,
- int *pnum,
-
BlockDriverState **file)
-{
- assert(bs->file && bs->file->bs); - *pnum = nb_sectors; - *file = bs->file->bs; - return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID |
- (sector_num << BDRV_SECTOR_BITS);
-}
-
static BlockDriver bdrv_throttle = {
.format_name = "throttle",
.protocol_name = "throttle",
@@ -237,7 +224,7 @@ static BlockDriver bdrv_throttle = {
.bdrv_reopen_prepare = throttle_reopen_prepare,
.bdrv_reopen_commit = throttle_reopen_commit,
.bdrv_reopen_abort = throttle_reopen_abort,
- .bdrv_co_get_block_status = throttle_co_get_block_status,
+ .bdrv_co_get_block_status =bdrv_co_get_block_status_from_file,
.is_filter = true,
};
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [Qemu-block] [PATCH v9 6/6] qemu-iotests: add 184 for throttle filter driver
Quoted 20 lines · Eric Blake
Quoted 19 lines · Kevin Wolf
Am 05.09.2017 um 18:16 hat Kevin Wolf geschrieben:
Quoted 9 lines
Am 25.08.2017 um 15:20 hat Manos Pitsidianakis geschrieben:
Quoted 2 lines
Reviewed-by Alberto Garcia <[email protected]>Signed-off-by Manos Pitsidianakis <[email protected]>Does this test actually (still) pass for you? I can't see that it's related to any recent change in master, but this is the diff that I get.
I can update the reference output while applying, but obviously if it's currently passing for you, it will fail after I "fix" it.
For the record, we discussed this on IRC. The test works correctly on master, but on my block branch there is a conflict with "block: pass bdrv_* methods to
bs->fileby default in block filters".The correct action is to merge this throttle driver series after the conflicting patch because throttle doesn't implement .bdrv_get_info and needs the forwarding that the other patch implements.
Quoted 6 lines
Quoted 2 lines
I updated the test output accordingly and applied the series to my block branch.
Could you also squash this in to 5/6? (as long as we're intentionally basing throttle on top of defaults, then we should use the right default instead of duplicating things)
Yes, this change makes sense, if it's no trouble with Kevin.
Quoted 45 lines
block/throttle.c +0
-5@@ -197,19 +197,6 @@ static boolthrottle_recurse_is_first_non_filter (BlockDriverState *bs, return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate); } -static int64_t coroutine_fn throttle_co_get_block_status(BlockDriverState *bs, - int64_t sector_num, - int nb_sectors, - int *pnum, -BlockDriverState **file)
block/throttle.c +0
-8-{ -assert (bs->file && bs->file->bs); - *pnum = nb_sectors; - *file = bs->file->bs; -return BDRV_BLOCK_RAW |BDRV_BLOCK_OFFSET_VALID | - (sector_num <<BDRV_SECTOR_BITS ); -} -static BlockDriver
bdrv_throttle= {.format_name = "throttle", .protocol_name = "throttle",block/throttle.c +1
-1@@ -237,7 +224,7 @@ static BlockDriver bdrv_throttle = { .bdrv_reopen_prepare = throttle_reopen_prepare, .bdrv_reopen_commit = throttle_reopen_commit, .bdrv_reopen_abort = throttle_reopen_abort, - .bdrv_co_get_block_status = throttle_co_get_block_status, + .bdrv_co_get_block_status = bdrv_co_get_block_status_from_file, .is_filter = true,};
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [Qemu-block] [PATCH v9 6/6] qemu-iotests: add 184 for throttle filter driver
Am 06.09.2017 um 10:26 hat Manos Pitsidianakis geschrieben:
Quoted 21 lines · Eric Blake
Quoted 20 lines · Kevin Wolf
Quoted 19 lines
Am 05.09.2017 um 18:16 hat Kevin Wolf geschrieben:
Quoted 9 lines
Am 25.08.2017 um 15:20 hat Manos Pitsidianakis geschrieben:
Quoted 2 lines
Reviewed-by Alberto Garcia <[email protected]>Signed-off-by Manos Pitsidianakis <[email protected]>Does this test actually (still) pass for you? I can't see that it's related to any recent change in master, but this is the diff that I get.
I can update the reference output while applying, but obviously if it's currently passing for you, it will fail after I "fix" it.
For the record, we discussed this on IRC. The test works correctly on master, but on my block branch there is a conflict with "block: pass bdrv_* methods to
bs->fileby default in block filters".The correct action is to merge this throttle driver series after the conflicting patch because throttle doesn't implement .bdrv_get_info and needs the forwarding that the other patch implements.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I updated the test output accordingly and applied the series to my block branch.
Could you also squash this in to 5/6? (as long as we're intentionally basing throttle on top of defaults, then we should use the right default instead of duplicating things)
Yes, this change makes sense, if it's no trouble with Kevin.
Already done, I was just waiting for your opinion. :-)
Kevin
Quoted 66 lines · Manos Pitsidianakis
This series adds a throttle block driver filter. Currently throttling is done at the BlockBackend level. Using block driver interfaces we can move the throttling to any point in the BDS graph using a throttle node which uses the existing throttling code. This allows for potentially more complex configurations (throttling at any point in the graph, chained filters)
v9:
fix suggestions by stefanha in patch 4
add 'throttle_group_can_be_deleted' function in patch 4v8:
fix suggestions by bertov7:
remove anonymous groups
error on missing throttle-group option onblock/throttle.cchange switch case format inblock/throttle-groups.c(berto)v6:
don't allow named group limit configuration inblock/throttle.c; allow either-drive driver=throttle,file.filename=foo.qcow2, \ limits.iops-total=... or -drive driver=throttle,file.filename=foo.qcow2,throttle-group=barfixes suggested by berto
v5:
fix crash in 'addaio_contextfield in ThrottleGroupMember' fix suggestions inblock/throttle.cv4:
fix suggestions inblock/throttle.c
fix suggestions inblock/throttle_groups.c
add doc note in BlockDevOptionsThrottlev3:
fix style error in 'addaio_contextfield in ThrottleGroupMember'v2:
change QOM throttle group object name
print valid ranges for uint on error
move frees inthrottle_group_obj_finalize()
split throttle_group_{set,get}()
addthrottle_recurse_is_first_non_filter()Manos Pitsidianakis (6):
block: move ThrottleGroup membership to ThrottleGroupMember
block: addaio_contextfield in ThrottleGroupMember
block: tidy ThrottleGroupMember initializations
block: convert ThrottleGroup to object with QOM
block: add throttle block filter driver
qemu-iotests: add 184 for throttle filter driverqapi/block-core.json | 66 +++- include/block/throttle-groups.h | 52 ++- include/qemu/throttle-options.h | 60 +++- include/qemu/throttle.h | 3 + include/sysemu/block-backend.h | 20 +- block/block-backend.c | 62 ++-- block/qapi.c | 8 +- block/throttle-groups.c | 748 ++++++++++++++++++++++++++++++---------- block/throttle.c | 250 ++++++++++++++ blockdev.c | 4 +- tests/test-throttle.c | 111 +++--- util/throttle.c | 151 ++++++++
Quoted 12 lines
block/Makefile.objs | 1 + tests/qemu-iotests/184 | 205 +++++++++++ tests/qemu-iotests/184.out | 300 ++++++++++++++++ tests/qemu-iotests/group | 1 + 16 files changed, 1721 insertions(+), 321 deletions(-) create mode 100644 block/throttle.c create mode 100755 tests/qemu-iotests/184 create mode 100644 tests/qemu-iotests/184.outSignature · 1 line
2.11.0