throttle-groups: Skip the round-robin if a member is being drained
commit5d8e4ca035f5a21e8634eb63a678bed55a1a94f9
authorAlberto Garcia <berto@igalia.com>
Thu, 2 Aug 2018 14:50:24 +0000 (2 17:50 +0300)
committerKevin Wolf <kwolf@redhat.com>
Wed, 15 Aug 2018 10:50:39 +0000 (15 12:50 +0200)
tree449d58957c53efd81a8e3f760cc63491bfc5f811
parentef7a6a3c2a7725b169d054aa7487f9738bd6c4a6
throttle-groups: Skip the round-robin if a member is being drained

In the throttling code after an I/O request has been completed the
next one is selected from a different member using a round-robin
algorithm. This ensures that all members get a chance to finish their
pending I/O requests.

However, if a group member has its I/O limits disabled (because it's
being drained) then we should always give it priority in order to have
all its pending requests finished as soon as possible.

If we don't do this we could have a member in the process of being
drained waiting for the throttled requests of other members, for which
the I/O limits still apply.

This can have additional consequences: if we're running in qtest mode
(with QEMU_CLOCK_VIRTUAL) then timers can only fire if we advance the
clock manually, so attempting to drain a block device can hang QEMU in
the BDRV_POLL_WHILE() loop at the end of bdrv_do_drained_begin().

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/throttle-groups.c