Skip to content

Commit 6d11339

Browse files
jankaraaxboe
authored andcommitted
block: Stop abusing rq->csd.list in blk-softirq
Abusing rq->csd.list for a list of requests to complete is rather ugly. We use rq->queuelist instead which is much cleaner. It is safe because queuelist is used by the block layer only for requests waiting to be submitted to a device. Thus it is unused when irq reports the request IO is finished. Signed-off-by: Jan Kara <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jens Axboe <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent d9a74df commit 6d11339

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

block/blk-softirq.c

+11-6
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ static void blk_done_softirq(struct softirq_action *h)
3030
while (!list_empty(&local_list)) {
3131
struct request *rq;
3232

33-
rq = list_entry(local_list.next, struct request, csd.list);
34-
list_del_init(&rq->csd.list);
33+
rq = list_entry(local_list.next, struct request, queuelist);
34+
list_del_init(&rq->queuelist);
3535
rq->q->softirq_done_fn(rq);
3636
}
3737
}
@@ -45,9 +45,14 @@ static void trigger_softirq(void *data)
4545

4646
local_irq_save(flags);
4747
list = this_cpu_ptr(&blk_cpu_done);
48-
list_add_tail(&rq->csd.list, list);
48+
/*
49+
* We reuse queuelist for a list of requests to process. Since the
50+
* queuelist is used by the block layer only for requests waiting to be
51+
* submitted to the device it is unused now.
52+
*/
53+
list_add_tail(&rq->queuelist, list);
4954

50-
if (list->next == &rq->csd.list)
55+
if (list->next == &rq->queuelist)
5156
raise_softirq_irqoff(BLOCK_SOFTIRQ);
5257

5358
local_irq_restore(flags);
@@ -136,15 +141,15 @@ void __blk_complete_request(struct request *req)
136141
struct list_head *list;
137142
do_local:
138143
list = this_cpu_ptr(&blk_cpu_done);
139-
list_add_tail(&req->csd.list, list);
144+
list_add_tail(&req->queuelist, list);
140145

141146
/*
142147
* if the list only contains our just added request,
143148
* signal a raise of the softirq. If there are already
144149
* entries there, someone already raised the irq but it
145150
* hasn't run yet.
146151
*/
147-
if (list->next == &req->csd.list)
152+
if (list->next == &req->queuelist)
148153
raise_softirq_irqoff(BLOCK_SOFTIRQ);
149154
} else if (raise_blk_irq(ccpu, req))
150155
goto do_local;

0 commit comments

Comments
 (0)