aio: simplify qemu_aio_wait
The do...while loop can never loop, because select will just not return 0 when invoked with infinite timeout. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
bcdc18578d
commit
9eb0bfca96
13
aio.c
13
aio.c
|
@ -104,7 +104,11 @@ void qemu_aio_flush(void)
|
||||||
|
|
||||||
bool qemu_aio_wait(void)
|
bool qemu_aio_wait(void)
|
||||||
{
|
{
|
||||||
|
AioHandler *node;
|
||||||
|
fd_set rdfds, wrfds;
|
||||||
|
int max_fd = -1;
|
||||||
int ret;
|
int ret;
|
||||||
|
bool busy;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there are callbacks left that have been queued, we need to call then.
|
* If there are callbacks left that have been queued, we need to call then.
|
||||||
|
@ -115,12 +119,6 @@ bool qemu_aio_wait(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
|
||||||
AioHandler *node;
|
|
||||||
fd_set rdfds, wrfds;
|
|
||||||
bool busy;
|
|
||||||
int max_fd = -1;
|
|
||||||
|
|
||||||
walking_handlers = 1;
|
walking_handlers = 1;
|
||||||
|
|
||||||
FD_ZERO(&rdfds);
|
FD_ZERO(&rdfds);
|
||||||
|
@ -158,8 +156,6 @@ bool qemu_aio_wait(void)
|
||||||
|
|
||||||
/* wait until next event */
|
/* wait until next event */
|
||||||
ret = select(max_fd, &rdfds, &wrfds, NULL, NULL);
|
ret = select(max_fd, &rdfds, &wrfds, NULL, NULL);
|
||||||
if (ret == -1 && errno == EINTR)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* if we have any readable fds, dispatch event */
|
/* if we have any readable fds, dispatch event */
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
|
@ -193,7 +189,6 @@ bool qemu_aio_wait(void)
|
||||||
|
|
||||||
walking_handlers = 0;
|
walking_handlers = 0;
|
||||||
}
|
}
|
||||||
} while (ret == 0);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue