Skip to content
Snippets Groups Projects
Commit 3672fa50 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Stefan Hajnoczi
Browse files

AioContext: run bottom halves after polling


Make the dispatching phase the same before blocking and afterwards.
The next patch will make aio_dispatch public and use it directly
for the GSource case, instead of aio_poll.  aio_poll can then be
simplified heavily.

Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent a398dea3
No related branches found
No related tags found
No related merge requests found
...@@ -264,6 +264,10 @@ bool aio_poll(AioContext *ctx, bool blocking) ...@@ -264,6 +264,10 @@ bool aio_poll(AioContext *ctx, bool blocking)
/* Run dispatch even if there were no readable fds to run timers */ /* Run dispatch even if there were no readable fds to run timers */
aio_set_dispatching(ctx, true); aio_set_dispatching(ctx, true);
if (aio_bh_poll(ctx)) {
progress = true;
}
if (aio_dispatch(ctx)) { if (aio_dispatch(ctx)) {
progress = true; progress = true;
} }
......
...@@ -143,7 +143,7 @@ bool aio_poll(AioContext *ctx, bool blocking) ...@@ -143,7 +143,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
{ {
AioHandler *node; AioHandler *node;
HANDLE events[MAXIMUM_WAIT_OBJECTS + 1]; HANDLE events[MAXIMUM_WAIT_OBJECTS + 1];
bool progress; bool progress, first;
int count; int count;
int timeout; int timeout;
...@@ -177,6 +177,7 @@ bool aio_poll(AioContext *ctx, bool blocking) ...@@ -177,6 +177,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
} }
ctx->walking_handlers--; ctx->walking_handlers--;
first = true;
/* wait until next event */ /* wait until next event */
while (count > 0) { while (count > 0) {
...@@ -186,6 +187,11 @@ bool aio_poll(AioContext *ctx, bool blocking) ...@@ -186,6 +187,11 @@ bool aio_poll(AioContext *ctx, bool blocking)
? qemu_timeout_ns_to_ms(aio_compute_timeout(ctx)) : 0; ? qemu_timeout_ns_to_ms(aio_compute_timeout(ctx)) : 0;
ret = WaitForMultipleObjects(count, events, FALSE, timeout); ret = WaitForMultipleObjects(count, events, FALSE, timeout);
if (first && aio_bh_poll(ctx)) {
progress = true;
}
first = false;
/* if we have any signaled events, dispatch event */ /* if we have any signaled events, dispatch event */
if ((DWORD) (ret - WAIT_OBJECT_0) >= count) { if ((DWORD) (ret - WAIT_OBJECT_0) >= count) {
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment