Skip to content

Commit 6259151

Browse files
bvanasscheaxboe
authored andcommitted
block: Call .limit_depth() after .hctx has been set
Call .limit_depth() after data->hctx has been set such that data->hctx can be used in .limit_depth() implementations. Cc: Christoph Hellwig <[email protected]> Cc: Damien Le Moal <[email protected]> Cc: Zhiguo Niu <[email protected]> Fixes: 0775758 ("block/mq-deadline: Reserve 25% of scheduler tags for synchronous requests") Signed-off-by: Bart Van Assche <[email protected]> Tested-by: Zhiguo Niu <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent f3bf25d commit 6259151

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

block/blk-mq.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data)
448448
if (data->cmd_flags & REQ_NOWAIT)
449449
data->flags |= BLK_MQ_REQ_NOWAIT;
450450

451+
retry:
452+
data->ctx = blk_mq_get_ctx(q);
453+
data->hctx = blk_mq_map_queue(q, data->cmd_flags, data->ctx);
454+
451455
if (q->elevator) {
452456
/*
453457
* All requests use scheduler tags when an I/O scheduler is
@@ -469,13 +473,9 @@ static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data)
469473
if (ops->limit_depth)
470474
ops->limit_depth(data->cmd_flags, data);
471475
}
472-
}
473-
474-
retry:
475-
data->ctx = blk_mq_get_ctx(q);
476-
data->hctx = blk_mq_map_queue(q, data->cmd_flags, data->ctx);
477-
if (!(data->rq_flags & RQF_SCHED_TAGS))
476+
} else {
478477
blk_mq_tag_busy(data->hctx);
478+
}
479479

480480
if (data->flags & BLK_MQ_REQ_RESERVED)
481481
data->rq_flags |= RQF_RESV;

0 commit comments

Comments
 (0)