Today, all callers of qemu_aio_set_fd_handler() pass a valid io_flush function. However, the function allows the handler to be omitted and the behavior is a bit strange.
It will still add the file descriptor to the GSource but it will not consider the source to be "busy". This could lead to aio_flush() returning prematurely. Since we never rely on this behavior today, it doesn't matter but the next patch will start relying on an absent io_flush function to assume the handler is always busy. Cc: Paolo Bonzini <bonz...@redhat.com> Cc: Mike Roth <mdr...@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aligu...@us.ibm.com> --- aio-posix.c | 4 ++-- aio-win32.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aio-posix.c b/aio-posix.c index b68eccd..a2349f6 100644 --- a/aio-posix.c +++ b/aio-posix.c @@ -208,8 +208,8 @@ bool aio_poll(AioContext *ctx, bool blocking) * Otherwise, if there are no AIO requests, qemu_aio_wait() would * wait indefinitely. */ - if (!node->deleted && node->io_flush) { - if (node->io_flush(node->opaque) == 0) { + if (!node->deleted) { + if (node->io_flush && node->io_flush(node->opaque) == 0) { continue; } busy = true; diff --git a/aio-win32.c b/aio-win32.c index 38723bf..b02fd40 100644 --- a/aio-win32.c +++ b/aio-win32.c @@ -154,8 +154,8 @@ bool aio_poll(AioContext *ctx, bool blocking) * Otherwise, if there are no AIO requests, qemu_aio_wait() would * wait indefinitely. */ - if (!node->deleted && node->io_flush) { - if (node->io_flush(node->e) == 0) { + if (!node->deleted) { + if (node->io_flush && node->io_flush(node->e) == 0) { continue; } busy = true; -- 1.8.0