mtd_blkdevs: pass queue_limits to blk_mq_alloc_disk
Pass the few limits mtd_blkdevs imposes directly to blk_mq_alloc_disk instead of setting them one at a time. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20240215070300.2200308-14-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
9f633ecd43
commit
3ec44e52bf
@ -277,6 +277,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
|
||||
{
|
||||
struct mtd_blktrans_ops *tr = new->tr;
|
||||
struct mtd_blktrans_dev *d;
|
||||
struct queue_limits lim = { };
|
||||
int last_devnum = -1;
|
||||
struct gendisk *gd;
|
||||
int ret;
|
||||
@ -331,9 +332,13 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
|
||||
BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING);
|
||||
if (ret)
|
||||
goto out_kfree_tag_set;
|
||||
|
||||
lim.logical_block_size = tr->blksize;
|
||||
if (tr->discard)
|
||||
lim.max_hw_discard_sectors = UINT_MAX;
|
||||
|
||||
/* Create gendisk */
|
||||
gd = blk_mq_alloc_disk(new->tag_set, NULL, new);
|
||||
gd = blk_mq_alloc_disk(new->tag_set, &lim, new);
|
||||
if (IS_ERR(gd)) {
|
||||
ret = PTR_ERR(gd);
|
||||
goto out_free_tag_set;
|
||||
@ -371,14 +376,9 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
|
||||
if (tr->flush)
|
||||
blk_queue_write_cache(new->rq, true, false);
|
||||
|
||||
blk_queue_logical_block_size(new->rq, tr->blksize);
|
||||
|
||||
blk_queue_flag_set(QUEUE_FLAG_NONROT, new->rq);
|
||||
blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, new->rq);
|
||||
|
||||
if (tr->discard)
|
||||
blk_queue_max_discard_sectors(new->rq, UINT_MAX);
|
||||
|
||||
gd->queue = new->rq;
|
||||
|
||||
if (new->readonly)
|
||||
|
Loading…
Reference in New Issue
Block a user