summaryrefslogtreecommitdiffstats
path: root/include/qemu
diff options
context:
space:
mode:
authorStefan Hajnoczi2020-02-14 18:17:11 +0100
committerStefan Hajnoczi2020-02-22 09:26:47 +0100
commit4749079ce033a94784cbe20a661abeac598ff057 (patch)
tree048fc56ddd9de5bb9fd76bdc7ecb261492495213 /include/qemu
parentqemu/queue.h: add QLIST_SAFE_REMOVE() (diff)
downloadqemu-4749079ce033a94784cbe20a661abeac598ff057.tar.gz
qemu-4749079ce033a94784cbe20a661abeac598ff057.tar.xz
qemu-4749079ce033a94784cbe20a661abeac598ff057.zip
aio-posix: make AioHandler deletion O(1)
It is not necessary to scan all AioHandlers for deletion. Keep a list of deleted handlers instead of scanning the full list of all handlers. The AioHandler->deleted field can be dropped. Let's check if the handler has been inserted into the deleted list instead. Add a new QLIST_IS_INSERTED() API for this check. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Sergio Lopez <slp@redhat.com> Message-id: 20200214171712.541358-5-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/queue.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index 60e794a4e3..294db54eb1 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -158,6 +158,9 @@ struct { \
} \
} while (/*CONSTCOND*/0)
+/* Is elm in a list? */
+#define QLIST_IS_INSERTED(elm, field) ((elm)->field.le_prev != NULL)
+
#define QLIST_FOREACH(var, head, field) \
for ((var) = ((head)->lh_first); \
(var); \