Re: [PATCH v2 3/3] block: Improve blk_mq_get_sq_hctx()
From: Ming Lei <hidden>
Date: 2022-06-16 01:32:47
On Wed, Jun 15, 2022 at 02:01:36PM -0700, Bart Van Assche wrote:
quoted hunk ↗ jump to hunk
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 <redacted> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- 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 <redacted>
thanks,
Ming