aboutsummaryrefslogtreecommitdiff
path: root/aio.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-10-04 19:53:50 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2012-10-04 19:53:50 -0500
commit05d4f2f2ca6053bfea2e97cf324901ca18e49c76 (patch)
treeeeac556997cb7a8d45472919fe9b59a41ba9ed71 /aio.c
parent97f3461555b1f5d8d4e6cfc839efe215098d786d (diff)
parent90f0b71153c6a85d03967244b9889f892841d835 (diff)
Merge remote-tracking branch 'kwolf/for-anthony' into staging
* kwolf/for-anthony: (30 commits) qemu-iotests: add tests for streaming error handling qemu-iotests: map underscore to dash in QMP argument names blkdebug: process all set_state rules in the old state stream: add on-error argument block: introduce block job error iostatus: reorganize io error code iostatus: change is_read to a bool iostatus: move BlockdevOnError declaration to QAPI iostatus: rename BlockErrorAction, BlockQMPEventAction qemu-iotests: add test for pausing a streaming operation qmp: add block-job-pause and block-job-resume block: add support for job pause/resume qmp: add 'busy' member to BlockJobInfo block: add block_job_query block: move job APIs to separate files block: fix documentation of block_job_cancel_sync qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE qemu-iotests: add initial tests for live block commit QAPI: add command for live block commit, 'block-commit' block: helper function, to find the base image of a chain ...
Diffstat (limited to 'aio.c')
-rw-r--r--aio.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/aio.c b/aio.c
index 0a9eb10c76..c738a4e15d 100644
--- a/aio.c
+++ b/aio.c
@@ -119,7 +119,7 @@ bool qemu_aio_wait(void)
return true;
}
- walking_handlers = 1;
+ walking_handlers++;
FD_ZERO(&rdfds);
FD_ZERO(&wrfds);
@@ -147,7 +147,7 @@ bool qemu_aio_wait(void)
}
}
- walking_handlers = 0;
+ walking_handlers--;
/* No AIO operations? Get us out of here */
if (!busy) {
@@ -159,14 +159,14 @@ bool qemu_aio_wait(void)
/* if we have any readable fds, dispatch event */
if (ret > 0) {
- walking_handlers = 1;
-
/* we have to walk very carefully in case
* qemu_aio_set_fd_handler is called while we're walking */
node = QLIST_FIRST(&aio_handlers);
while (node) {
AioHandler *tmp;
+ walking_handlers++;
+
if (!node->deleted &&
FD_ISSET(node->fd, &rdfds) &&
node->io_read) {
@@ -181,13 +181,13 @@ bool qemu_aio_wait(void)
tmp = node;
node = QLIST_NEXT(node, node);
- if (tmp->deleted) {
+ walking_handlers--;
+
+ if (!walking_handlers && tmp->deleted) {
QLIST_REMOVE(tmp, node);
g_free(tmp);
}
}
-
- walking_handlers = 0;
}
return true;