block: Make blk_mq_get_sq_hctx() select the proper hardware queue type
authorBart Van Assche <bvanassche@acm.org>
Wed, 15 Jun 2022 22:55:49 +0000 (15:55 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 27 Jun 2022 12:29:11 +0000 (06:29 -0600)
Since the introduction of blk_mq_get_hctx_type() the operation type in
the second argument of blk_mq_get_hctx_type() matters. The introduction
of blk_mq_get_hctx_type() caused blk_mq_get_sq_hctx() to select a
hardware queue of type HCTX_TYPE_READ instead of HCTX_TYPE_DEFAULT.
Switch to hardware queue type HCTX_TYPE_DEFAULT since HCTX_TYPE_READ
should only be used for read requests.

Cc: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220615225549.1054905-4-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index 93d9d60..fa3dc4f 100644 (file)
@@ -2156,7 +2156,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;