qemu/util
Stefan Hajnoczi 7719f3c968 block: extract AIO_WAIT_WHILE() from BlockDriverState
BlockDriverState has the BDRV_POLL_WHILE() macro to wait on event loop
activity while a condition evaluates to true.  This is used to implement
synchronous operations where it acts as a condvar between the IOThread
running the operation and the main loop waiting for the operation.  It
can also be called from the thread that owns the AioContext and in that
case it's just a nested event loop.

BlockBackend needs this behavior but doesn't always have a
BlockDriverState it can use.  This patch extracts BDRV_POLL_WHILE() into
the AioWait abstraction, which can be used with AioContext and isn't
tied to BlockDriverState anymore.

This feature could be built directly into AioContext but then all users
would kick the event loop even if they signal different conditions.
Imagine an AioContext with many BlockDriverStates, each time a request
completes any waiter would wake up and re-check their condition.  It's
nicer to keep a separate AioWait object for each condition instead.

Please see "block/aio-wait.h" for details on the API.

The name AIO_WAIT_WHILE() avoids the confusion between AIO_POLL_WHILE()
and AioContext polling.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-03-02 18:39:07 +01:00
..
acl.c
aio-posix.c
aio-wait.c block: extract AIO_WAIT_WHILE() from BlockDriverState 2018-03-02 18:39:07 +01:00
aio-win32.c
aiocb.c
async.c
base64.c
bitmap.c
bitops.c
buffer.c
bufferiszero.c
cacheinfo.c
compatfd.c
coroutine-sigaltstack.c
coroutine-ucontext.c
coroutine-win32.c
crc32c.c
cutils.c
envlist.c
error.c
event_notifier-posix.c
event_notifier-win32.c
fifo8.c
getauxval.c
hbitmap.c
hexdump.c
host-utils.c
id.c
iohandler.c
iov.c
keyval.c
lockcnt.c
log.c
main-loop.c
Makefile.objs block: extract AIO_WAIT_WHILE() from BlockDriverState 2018-03-02 18:39:07 +01:00
memfd.c
mmap-alloc.c
module.c
notify.c
osdep.c
oslib-posix.c mem: add share parameter to memory-backend-ram 2018-02-19 13:03:24 +02:00
oslib-win32.c mem: add share parameter to memory-backend-ram 2018-02-19 13:03:24 +02:00
pagesize.c
path.c
qdist.c
qemu-config.c
qemu-coroutine-io.c
qemu-coroutine-lock.c misc: fix spelling 2018-02-15 09:39:49 +00:00
qemu-coroutine-sleep.c
qemu-coroutine.c
qemu-error.c
qemu-openpty.c
qemu-option.c
qemu-progress.c
qemu-sockets.c
qemu-thread-posix.c
qemu-thread-win32.c
qemu-timer-common.c
qemu-timer.c
qht.c
range.c
rcu.c
readline.c
stats64.c
systemd.c
thread-pool.c
throttle.c
timed-average.c
trace-events
unicode.c
uri.c
uuid.c
vfio-helpers.c block/nvme: fix Coverity reports 2018-03-01 15:21:46 +08:00