On Wed, Apr 12, 2023 at 08:37:42AM +0200, Christoph Hellwig wrote: > Instead of calling blk_mq_hctx_stopped in both callers, move it right > next to the dispatching. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > block/blk-mq.c | 18 ++++++------------ > 1 file changed, 6 insertions(+), 12 deletions(-) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index 03c6fa4afcdb91..cdf1d5ca04bba2 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -2150,6 +2150,8 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) > */ > WARN_ON_ONCE(in_interrupt()); > > + if (blk_mq_hctx_stopped(hctx)) > + return; > blk_mq_run_dispatch_ops(hctx->queue, > blk_mq_sched_dispatch_requests(hctx)); The above new check isn't needed actually, since blk_mq_sched_dispatch_requests() does check it with rcu read lock held, which should be more reliable. Thanks, Ming