Commit 115243f5 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

blk-mq: factor out a helper to reise the block softirq

Add a helper to deduplicate the logic that raises the block softirq.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDaniel Wagner <dwagner@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent c3077b5d
...@@ -598,19 +598,27 @@ static __latent_entropy void blk_done_softirq(struct softirq_action *h) ...@@ -598,19 +598,27 @@ static __latent_entropy void blk_done_softirq(struct softirq_action *h)
} }
} }
#ifdef CONFIG_SMP static void blk_mq_trigger_softirq(struct request *rq)
static void trigger_softirq(void *data)
{ {
struct request *rq = data; struct list_head *list = this_cpu_ptr(&blk_cpu_done);
struct list_head *list;
list = this_cpu_ptr(&blk_cpu_done);
list_add_tail(&rq->ipi_list, list); list_add_tail(&rq->ipi_list, list);
/*
* If the list only contains our just added request, signal a raise of
* the softirq. If there are already entries there, someone already
* raised the irq but it hasn't run yet.
*/
if (list->next == &rq->ipi_list) if (list->next == &rq->ipi_list)
raise_softirq_irqoff(BLOCK_SOFTIRQ); raise_softirq_irqoff(BLOCK_SOFTIRQ);
} }
#ifdef CONFIG_SMP
static void trigger_softirq(void *data)
{
blk_mq_trigger_softirq(data);
}
/* /*
* Setup and invoke a run of 'trigger_softirq' on the given cpu. * Setup and invoke a run of 'trigger_softirq' on the given cpu.
*/ */
...@@ -681,19 +689,8 @@ static void __blk_complete_request(struct request *req) ...@@ -681,19 +689,8 @@ static void __blk_complete_request(struct request *req)
* avoids IPI sending from current CPU to the first CPU of a group. * avoids IPI sending from current CPU to the first CPU of a group.
*/ */
if (ccpu == cpu || shared) { if (ccpu == cpu || shared) {
struct list_head *list;
do_local: do_local:
list = this_cpu_ptr(&blk_cpu_done); blk_mq_trigger_softirq(req);
list_add_tail(&req->ipi_list, list);
/*
* if the list only contains our just added request,
* signal a raise of the softirq. If there are already
* entries there, someone already raised the irq but it
* hasn't run yet.
*/
if (list->next == &req->ipi_list)
raise_softirq_irqoff(BLOCK_SOFTIRQ);
} else if (raise_blk_irq(ccpu, req)) } else if (raise_blk_irq(ccpu, req))
goto do_local; goto do_local;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment