diff options
author | Shlomo Pongratz <shlomop@mellanox.com> | 2014-02-06 11:33:17 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-02-07 15:56:07 -0500 |
commit | d7790b928d42597b7da21a4e43080774903e3b5c (patch) | |
tree | f764ae05d916c21bfd06a271b900bfbc9f4316ff /drivers/block/null_blk.c | |
parent | 5cb8850c9c4a7605f74f5c9c7ecadd0b02e87a25 (diff) |
block/null_blk: Fix completion processing from LIFO to FIFO
The completion queue is implemented using lockless list.
The llist_add is adds the events to the list head which is a push operation.
The processing of the completion elements is done by disconnecting all the
pushed elements and iterating over the disconnected list. The problem is
that the processing is done in reverse order w.r.t order of the insertion
i.e. LIFO processing. By reversing the disconnected list which is done in
linear time the desired FIFO processing is achieved.
Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/null_blk.c')
-rw-r--r-- | drivers/block/null_blk.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 3107282a9741..cc801cde5cfa 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -195,6 +195,7 @@ static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer) | |||
195 | cq = &per_cpu(completion_queues, smp_processor_id()); | 195 | cq = &per_cpu(completion_queues, smp_processor_id()); |
196 | 196 | ||
197 | while ((entry = llist_del_all(&cq->list)) != NULL) { | 197 | while ((entry = llist_del_all(&cq->list)) != NULL) { |
198 | entry = llist_reverse_order(entry); | ||
198 | do { | 199 | do { |
199 | cmd = container_of(entry, struct nullb_cmd, ll_list); | 200 | cmd = container_of(entry, struct nullb_cmd, ll_list); |
200 | end_cmd(cmd); | 201 | end_cmd(cmd); |
@@ -235,6 +236,7 @@ static void null_ipi_cmd_end_io(void *data) | |||
235 | cq = &per_cpu(completion_queues, smp_processor_id()); | 236 | cq = &per_cpu(completion_queues, smp_processor_id()); |
236 | 237 | ||
237 | entry = llist_del_all(&cq->list); | 238 | entry = llist_del_all(&cq->list); |
239 | entry = llist_reverse_order(entry); | ||
238 | 240 | ||
239 | while (entry) { | 241 | while (entry) { |
240 | next = entry->next; | 242 | next = entry->next; |