On Wed, Jun 15, 2022 at 02:01:36PM -0700, Bart Van Assche wrote: > Since the introduction of blk_mq_get_hctx_type() the operation type in > the second argument of blk_mq_get_hctx_type() matters. Make sure that > blk_mq_get_sq_hctx() selects a hardware queue of type HCTX_TYPE_DEFAULT > instead of a hardware queue of type HCTX_TYPE_READ. > > Cc: Ming Lei <ming.lei@xxxxxxxxxx> > Cc: Christoph Hellwig <hch@xxxxxx> > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > block/blk-mq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index e9bf950983c7..7a5558bbc7f6 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -2168,7 +2168,7 @@ static struct blk_mq_hw_ctx *blk_mq_get_sq_hctx(struct request_queue *q) > * just causes lock contention inside the scheduler and pointless cache > * bouncing. > */ > - struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(q, 0, ctx); > + struct blk_mq_hw_ctx *hctx = ctx->hctxs[HCTX_TYPE_DEFAULT]; > > if (!blk_mq_hctx_stopped(hctx)) > return hctx; Looks fine, since the original behavior is to return hctx with HCTX_TYPE_DEFAULT before commit 5d05426e2d5f ("blk-mq: don't touch ->tagset in blk_mq_get_sq_hctx"). Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx> thanks, Ming