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 <address@hidden>
---
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.