diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-11-16 17:26:43 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-11-16 17:26:43 +0000 |
commit | afdad8b6840d3ea4bc8b7cd0f1b9f25801748c50 (patch) | |
tree | b8d067eaca77ab95d54e4c433babad2306d64129 | |
parent | 62955e101e4bdc113e3205174567c9c8e12ec1b4 (diff) | |
parent | 341e0b5658681f46680024cdbfc998717d85cc35 (diff) |
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
# gpg: Signature made Thu 16 Nov 2017 16:36:02 GMT
# gpg: using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8
* remotes/stefanha/tags/block-pull-request:
throttle-groups: forget timer and schedule next TGM on detach
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | block/throttle-groups.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 2587f19ca3..f26bcb5eee 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -593,13 +593,25 @@ void throttle_group_attach_aio_context(ThrottleGroupMember *tgm, void throttle_group_detach_aio_context(ThrottleGroupMember *tgm) { + ThrottleGroup *tg = container_of(tgm->throttle_state, ThrottleGroup, ts); ThrottleTimers *tt = &tgm->throttle_timers; + int i; /* Requests must have been drained */ 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])); + /* Kick off next ThrottleGroupMember, if necessary */ + qemu_mutex_lock(&tg->lock); + for (i = 0; i < 2; i++) { + if (timer_pending(tt->timers[i])) { + tg->any_timer_armed[i] = false; + schedule_next_request(tgm, i); + } + } + qemu_mutex_unlock(&tg->lock); + throttle_timers_detach_aio_context(tt); tgm->aio_context = NULL; } |