diff options
| author | Paolo Bonzini | 2014-12-11 14:52:30 +0100 |
|---|---|---|
| committer | Stefan Hajnoczi | 2014-12-12 17:57:55 +0100 |
| commit | 82595da8dedde128d8004ec47441aeb720c08704 (patch) | |
| tree | 7be4908dfc8a445a28a622ecd514f81ea31619bb /include | |
| parent | linux-aio: drop return code from laio_io_unplug and ioq_submit (diff) | |
| download | qemu-82595da8dedde128d8004ec47441aeb720c08704.tar.gz qemu-82595da8dedde128d8004ec47441aeb720c08704.tar.xz qemu-82595da8dedde128d8004ec47441aeb720c08704.zip | |
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')
| -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 d433b9017c..42bcadfbb1 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); \ |
