diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2019-09-05 12:51:30 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-09-06 04:52:33 +0300 |
commit | 954b4a5ce4a806e7c284ce6b2659abdd03d0b6e2 (patch) | |
tree | d750b8f375ef88ab4b75526c7e4128a62cc7c8ff /block/blk-mq.c | |
parent | 61db437d1cc16c470cf6fccc04d34be9cf6e4e4b (diff) |
block: Change elevator_init_mq() to always succeed
If the default elevator chosen is mq-deadline, elevator_init_mq() may
return an error if mq-deadline initialization fails, leading to
blk_mq_init_allocated_queue() returning an error, which in turn will
cause the block device initialization to fail and the device not being
exposed.
Instead of taking such extreme measure, handle mq-deadline
initialization failures in the same manner as when mq-deadline is not
available (no module to load), that is, default to the "none" scheduler.
With this change, elevator_init_mq() return type can be changed to void.
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index c3bd5b48a5b1..d10a7ab4207a 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2848,8 +2848,6 @@ static unsigned int nr_hw_queues(struct blk_mq_tag_set *set) struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, struct request_queue *q) { - int ret = -ENOMEM; - /* mark the queue as mq asap */ q->mq_ops = set->ops; @@ -2910,14 +2908,10 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, blk_mq_add_queue_tag_set(set, q); blk_mq_map_swqueue(q); - ret = elevator_init_mq(q); - if (ret) - goto err_tag_set; + elevator_init_mq(q); return q; -err_tag_set: - blk_mq_del_queue_tag_set(q); err_hctxs: kfree(q->queue_hw_ctx); q->nr_hw_queues = 0; |