diff options
author | Yaowei Bai <baiyaowei@cmss.chinamobile.com> | 2016-09-14 07:03:39 -0400 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2016-09-28 11:21:46 +0100 |
commit | 6b9424689a32bb76942ec39f6d5c60b72eb002e0 (patch) | |
tree | d3b4a020db45b5b41f3c00018736bcdf400c5fd3 /aio-posix.c | |
parent | e7e4f9f950253ce5fb03f569868a21d6d7e3f8a2 (diff) | |
download | qemu-6b9424689a32bb76942ec39f6d5c60b72eb002e0.zip qemu-6b9424689a32bb76942ec39f6d5c60b72eb002e0.tar.gz qemu-6b9424689a32bb76942ec39f6d5c60b72eb002e0.tar.bz2 |
aio-posix: avoid unnecessary aio_epoll_enabled() calls
As epoll whether enabled or not is a global setting, we can just
check it only once rather than checking it with every node iteration.
Through this we can avoid a lot of checks when epoll is not enabled.
Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Reviewed-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Message-id: 1473851019-7005-3-git-send-email-baiyaowei@cmss.chinamobile.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'aio-posix.c')
-rw-r--r-- | aio-posix.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/aio-posix.c b/aio-posix.c index 43162a9..4ef34dd 100644 --- a/aio-posix.c +++ b/aio-posix.c @@ -431,11 +431,13 @@ bool aio_poll(AioContext *ctx, bool blocking) assert(npfd == 0); /* fill pollfds */ - QLIST_FOREACH(node, &ctx->aio_handlers, node) { - if (!node->deleted && node->pfd.events - && !aio_epoll_enabled(ctx) - && aio_node_check(ctx, node->is_external)) { - add_pollfd(node); + + if (!aio_epoll_enabled(ctx)) { + QLIST_FOREACH(node, &ctx->aio_handlers, node) { + if (!node->deleted && node->pfd.events + && aio_node_check(ctx, node->is_external)) { + add_pollfd(node); + } } } |