diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2014-12-11 14:52:30 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-12-12 16:57:55 +0000 |
commit | 82595da8dedde128d8004ec47441aeb720c08704 (patch) | |
tree | 7be4908dfc8a445a28a622ecd514f81ea31619bb /include/qemu/queue.h | |
parent | de35464461cd8aa764ce03e8026202fe9861e29d (diff) | |
download | qemu-82595da8dedde128d8004ec47441aeb720c08704.zip qemu-82595da8dedde128d8004ec47441aeb720c08704.tar.gz qemu-82595da8dedde128d8004ec47441aeb720c08704.tar.bz2 |
linux-aio: simplify removal of completed iocbs from the list
There is no need to do another O(n) pass on the list; the iocb to
split the list at is already available through the array we passed to
io_submit.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1418305950-30924-6-git-send-email-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include/qemu/queue.h')
-rw-r--r-- | include/qemu/queue.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/qemu/queue.h b/include/qemu/queue.h index d433b90..42bcadf 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -268,6 +268,17 @@ struct { \ (head)->sqh_last = &(head)->sqh_first; \ } while (/*CONSTCOND*/0) +#define QSIMPLEQ_SPLIT_AFTER(head, elm, field, removed) do { \ + QSIMPLEQ_INIT(removed); \ + if (((removed)->sqh_first = (head)->sqh_first) != NULL) { \ + if (((head)->sqh_first = (elm)->field.sqe_next) == NULL) { \ + (head)->sqh_last = &(head)->sqh_first; \ + } \ + (removed)->sqh_last = &(elm)->field.sqe_next; \ + (elm)->field.sqe_next = NULL; \ + } \ +} while (/*CONSTCOND*/0) + #define QSIMPLEQ_REMOVE(head, elm, type, field) do { \ if ((head)->sqh_first == (elm)) { \ QSIMPLEQ_REMOVE_HEAD((head), field); \ |