@@ -2643,6 +2643,7 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
struct blk_mq_tag_set *set = q->tag_set;
struct blk_mq_hw_ctx *hctx;
int i, ret;
+ bool sched = false;
if (!set)
return -EINVAL;
@@ -2664,12 +2665,13 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
} else {
ret = blk_mq_tag_update_depth(hctx, &hctx->sched_tags,
nr, true);
+ sched = true;
}
if (ret)
break;
}
- if (!ret)
+ if (!ret && sched)
q->nr_requests = nr;
blk_mq_unfreeze_queue(q);
In MQ scheduler, q->nr_requests represents requests in scheduler queue depth, so don't update it if hw queue's depth is updated. Signed-off-by: Ming Lei <ming.lei@redhat.com> --- block/blk-mq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)