blk-mq: check invalid nr_requests in queue_requests_store()
queue_requests_store() is the only caller of blk_mq_update_nr_requests(), and blk_mq_update_nr_requests() is the only caller of blk_mq_tag_update_depth(), however, they all have checkings for nr_requests input by user. Make code cleaner by moving all the checkings to the top function: 1) nr_requests > reserved tags; 2) if there is elevator, 4 <= nr_requests <= 2048; 3) if elevator is none, 4 <= nr_requests <= tag_set->queue_depth; Meanwhile, case 2 is the only case tags can grow and -ENOMEM might be returned. Signed-off-by:Yu Kuai <yukuai3@huawei.com> Reviewed-by:
Nilay Shroff <nilay@linux.ibm.com> Signed-off-by:
Jens Axboe <axboe@kernel.dk>
Loading
Please sign in to comment