blk-mq: split bitmap grow and resize case in blk_mq_update_nr_requests()
No functional changes are intended, make code cleaner and prepare to fix the grow case in following patches. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Nilay Shroff <nilay@linux.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>pull/1354/merge
parent
7f2799c546
commit
e632004044
|
|
@ -4936,25 +4936,40 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
|
||||||
blk_mq_quiesce_queue(q);
|
blk_mq_quiesce_queue(q);
|
||||||
|
|
||||||
if (blk_mq_is_shared_tags(set->flags)) {
|
if (blk_mq_is_shared_tags(set->flags)) {
|
||||||
|
/*
|
||||||
|
* Shared tags, for sched tags, we allocate max initially hence
|
||||||
|
* tags can't grow, see blk_mq_alloc_sched_tags().
|
||||||
|
*/
|
||||||
if (q->elevator)
|
if (q->elevator)
|
||||||
blk_mq_tag_update_sched_shared_tags(q);
|
blk_mq_tag_update_sched_shared_tags(q);
|
||||||
else
|
else
|
||||||
blk_mq_tag_resize_shared_tags(set, nr);
|
blk_mq_tag_resize_shared_tags(set, nr);
|
||||||
} else {
|
} else if (!q->elevator) {
|
||||||
|
/*
|
||||||
|
* Non-shared hardware tags, nr is already checked from
|
||||||
|
* queue_requests_store() and tags can't grow.
|
||||||
|
*/
|
||||||
queue_for_each_hw_ctx(q, hctx, i) {
|
queue_for_each_hw_ctx(q, hctx, i) {
|
||||||
if (!hctx->tags)
|
if (!hctx->tags)
|
||||||
continue;
|
continue;
|
||||||
/*
|
sbitmap_queue_resize(&hctx->tags->bitmap_tags,
|
||||||
* If we're using an MQ scheduler, just update the
|
nr - hctx->tags->nr_reserved_tags);
|
||||||
* scheduler queue depth. This is similar to what the
|
}
|
||||||
* old code would do.
|
} else if (nr <= q->elevator->et->nr_requests) {
|
||||||
*/
|
/* Non-shared sched tags, and tags don't grow. */
|
||||||
if (hctx->sched_tags)
|
queue_for_each_hw_ctx(q, hctx, i) {
|
||||||
ret = blk_mq_tag_update_depth(hctx,
|
if (!hctx->sched_tags)
|
||||||
&hctx->sched_tags, nr);
|
continue;
|
||||||
else
|
sbitmap_queue_resize(&hctx->sched_tags->bitmap_tags,
|
||||||
ret = blk_mq_tag_update_depth(hctx,
|
nr - hctx->sched_tags->nr_reserved_tags);
|
||||||
&hctx->tags, nr);
|
}
|
||||||
|
} else {
|
||||||
|
/* Non-shared sched tags, and tags grow */
|
||||||
|
queue_for_each_hw_ctx(q, hctx, i) {
|
||||||
|
if (!hctx->sched_tags)
|
||||||
|
continue;
|
||||||
|
ret = blk_mq_tag_update_depth(hctx, &hctx->sched_tags,
|
||||||
|
nr);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue