OSDN Git Service

block: Allow AIO_WAIT_WHILE with NULL ctx
authorKevin Wolf <kwolf@redhat.com>
Tue, 10 Apr 2018 13:51:52 +0000 (15:51 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 18 Jun 2018 13:03:25 +0000 (15:03 +0200)
commit4d22bbf4ef72583eefdf44db6bf9fc7683fbc4c2
tree1cb73c38dd003a6294b9451fb333f570b8ec6ed0
parent57320ca961c2e8488e1884b4ebbcb929b6901dc6
block: Allow AIO_WAIT_WHILE with NULL ctx

bdrv_drain_all() wants to have a single polling loop for draining the
in-flight requests of all nodes. This means that the AIO_WAIT_WHILE()
condition relies on activity in multiple AioContexts, which is polled
from the mainloop context. We must therefore call AIO_WAIT_WHILE() from
the mainloop thread and use the AioWait notification mechanism.

Just randomly picking the AioContext of any non-mainloop thread would
work, but instead of bothering to find such a context in the caller, we
can just as well accept NULL for ctx.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
include/block/aio-wait.h