On Mon, Jun 26, 2017 at 02:36:11PM +0100, Stefan Hajnoczi wrote:
On Fri, Jun 23, 2017 at 03:46:54PM +0300, Manos Pitsidianakis wrote:timer_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.Signed-off-by: Manos Pitsidianakis <el13...@mail.ntua.gr> --- block/block-backend.c | 1 + block/throttle-groups.c | 19 +++++---------- include/qemu/throttle.h | 1 + tests/test-throttle.c | 65 +++++++++++++++++++++++++++---------------------- util/throttle.c | 4 +++ 5 files changed, 48 insertions(+), 42 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 90a7abaa53..1d501ec973 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1928,6 +1928,7 @@ void blk_io_limits_disable(BlockBackend *blk) /* should be called before blk_set_io_limits if a limit is set */ void blk_io_limits_enable(BlockBackend *blk, const char *group) { + blk->public.throttle_group_member.aio_context = blk_get_aio_context(blk); assert(!blk->public.throttle_group_member.throttle_state); throttle_group_register_tgm(&blk->public.throttle_group_member, group);Or throttle_group_register_tgm() could take an AioContext* argument, I think that's a little cleaner than modifying throttle_group_member fields in multiple source files.
Indeed that is cleaner.
diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 5e9d8fb4d6..7883cbb511 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -71,6 +71,7 @@ static QemuMutex throttle_groups_lock; static QTAILQ_HEAD(, ThrottleGroup) throttle_groups = QTAILQ_HEAD_INITIALIZER(throttle_groups); + /* Increments the reference count of a ThrottleGroup given its name. * * If no ThrottleGroup is found with the given name a new one isSpurious whitespace change. Please do not change whitespace in random places.
I noticed it too late unfortunately.
signature.asc
Description: PGP signature