Skip to content

Commit 4d5bba5

Browse files
Christoph Hellwigaxboe
authored andcommitted
blk-mq: remove __blk_mq_run_hw_queue
__blk_mq_run_hw_queue just contains a WARN_ON_ONCE for calls from interrupt context and a blk_mq_run_dispatch_ops-protected call to blk_mq_sched_dispatch_requests. Open code the call to blk_mq_sched_dispatch_requests in both callers, and move the WARN_ON_ONCE to blk_mq_run_hw_queue where it can be extended to all !async calls, while the other call is from workqueue context and thus obviously does not need the assert. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/20230413060651.694656-6-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 1aa8d87 commit 4d5bba5

1 file changed

Lines changed: 9 additions & 20 deletions

File tree

block/blk-mq.c

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,24 +2138,6 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
21382138
return true;
21392139
}
21402140

2141-
/**
2142-
* __blk_mq_run_hw_queue - Run a hardware queue.
2143-
* @hctx: Pointer to the hardware queue to run.
2144-
*
2145-
* Send pending requests to the hardware.
2146-
*/
2147-
static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
2148-
{
2149-
/*
2150-
* We can't run the queue inline with ints disabled. Ensure that
2151-
* we catch bad users of this early.
2152-
*/
2153-
WARN_ON_ONCE(in_interrupt());
2154-
2155-
blk_mq_run_dispatch_ops(hctx->queue,
2156-
blk_mq_sched_dispatch_requests(hctx));
2157-
}
2158-
21592141
static inline int blk_mq_first_mapped_cpu(struct blk_mq_hw_ctx *hctx)
21602142
{
21612143
int cpu = cpumask_first_and(hctx->cpumask, cpu_online_mask);
@@ -2240,6 +2222,11 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)
22402222
{
22412223
bool need_run;
22422224

2225+
/*
2226+
* We can't run the queue inline with interrupts disabled.
2227+
*/
2228+
WARN_ON_ONCE(!async && in_interrupt());
2229+
22432230
/*
22442231
* When queue is quiesced, we may be switching io scheduler, or
22452232
* updating nr_hw_queues, or other things, and we can't run queue
@@ -2261,7 +2248,8 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)
22612248
return;
22622249
}
22632250

2264-
__blk_mq_run_hw_queue(hctx);
2251+
blk_mq_run_dispatch_ops(hctx->queue,
2252+
blk_mq_sched_dispatch_requests(hctx));
22652253
}
22662254
EXPORT_SYMBOL(blk_mq_run_hw_queue);
22672255

@@ -2429,7 +2417,8 @@ static void blk_mq_run_work_fn(struct work_struct *work)
24292417
struct blk_mq_hw_ctx *hctx =
24302418
container_of(work, struct blk_mq_hw_ctx, run_work.work);
24312419

2432-
__blk_mq_run_hw_queue(hctx);
2420+
blk_mq_run_dispatch_ops(hctx->queue,
2421+
blk_mq_sched_dispatch_requests(hctx));
24332422
}
24342423

24352424
/**

0 commit comments

Comments
 (0)