Commit f93b43ae authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

ms_block: pass queue_limits to blk_mq_alloc_disk

Pass the few limits ms_block imposes directly to blk_mq_alloc_disk
instead of setting them one at a time.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20240215070300.2200308-12-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a339cf2b
...@@ -2078,6 +2078,12 @@ static const struct blk_mq_ops msb_mq_ops = { ...@@ -2078,6 +2078,12 @@ static const struct blk_mq_ops msb_mq_ops = {
static int msb_init_disk(struct memstick_dev *card) static int msb_init_disk(struct memstick_dev *card)
{ {
struct msb_data *msb = memstick_get_drvdata(card); struct msb_data *msb = memstick_get_drvdata(card);
struct queue_limits lim = {
.logical_block_size = msb->page_size,
.max_hw_sectors = MS_BLOCK_MAX_PAGES,
.max_segments = MS_BLOCK_MAX_SEGS,
.max_segment_size = MS_BLOCK_MAX_PAGES * msb->page_size,
};
int rc; int rc;
unsigned long capacity; unsigned long capacity;
...@@ -2093,19 +2099,13 @@ static int msb_init_disk(struct memstick_dev *card) ...@@ -2093,19 +2099,13 @@ static int msb_init_disk(struct memstick_dev *card)
if (rc) if (rc)
goto out_release_id; goto out_release_id;
msb->disk = blk_mq_alloc_disk(&msb->tag_set, NULL, card); msb->disk = blk_mq_alloc_disk(&msb->tag_set, &lim, card);
if (IS_ERR(msb->disk)) { if (IS_ERR(msb->disk)) {
rc = PTR_ERR(msb->disk); rc = PTR_ERR(msb->disk);
goto out_free_tag_set; goto out_free_tag_set;
} }
msb->queue = msb->disk->queue; msb->queue = msb->disk->queue;
blk_queue_max_hw_sectors(msb->queue, MS_BLOCK_MAX_PAGES);
blk_queue_max_segments(msb->queue, MS_BLOCK_MAX_SEGS);
blk_queue_max_segment_size(msb->queue,
MS_BLOCK_MAX_PAGES * msb->page_size);
blk_queue_logical_block_size(msb->queue, msb->page_size);
sprintf(msb->disk->disk_name, "msblk%d", msb->disk_id); sprintf(msb->disk->disk_name, "msblk%d", msb->disk_id);
msb->disk->fops = &msb_bdops; msb->disk->fops = &msb_bdops;
msb->disk->private_data = msb; msb->disk->private_data = msb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment