Commit 6b942468 authored by Yaowei Bai's avatar Yaowei Bai Committed by Stefan Hajnoczi
Browse files

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: default avatarYaowei Bai <baiyaowei@cmss.chinamobile.com>
Reviewed-by: default avatarXiubo Li <lixiubo@cmss.chinamobile.com>
Message-id: 1473851019-7005-3-git-send-email-baiyaowei@cmss.chinamobile.com
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent e7e4f9f9
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -431,13 +431,15 @@ bool aio_poll(AioContext *ctx, bool blocking)
    assert(npfd == 0);

    /* fill pollfds */

    if (!aio_epoll_enabled(ctx)) {
        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);
            }
        }
    }

    timeout = blocking ? aio_compute_timeout(ctx) : 0;