Il 28/03/2013 22:52, Anthony Liguori ha scritto: > Today, all callers of qemu_aio_set_fd_handler() pass a valid io_flush > function.
Except one: aio_set_event_notifier(ctx, &ctx->notifier, (EventNotifierHandler *) event_notifier_test_and_clear, NULL); This is the EventNotifier that is used by qemu_notify_event. It's quite surprising that this patch works and passes the tests. /me reads cover letter... ah, it is untested. :) But if you can eliminate the sole usage of aio_wait()'s return value (in bdrv_drain_all()), everything would be much simpler. There is a relatively convenient assert(QLIST_EMPTY(&bs->tracked_requests)); that you can use as the exit condition instead. Perhaps it's not trivial to do it efficiently, but it's not a fast path. Paolo > 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.