Commit 2cfe0104 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

nfblock: pass queue_limits to blk_mq_alloc_disk

Pass the queue limits directly to blk_alloc_disk instead of setting them
one at a time.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Link: https://lore.kernel.org/r/20240215071055.2201424-3-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 74fa8f9c
...@@ -96,6 +96,9 @@ static const struct block_device_operations nfhd_ops = { ...@@ -96,6 +96,9 @@ static const struct block_device_operations nfhd_ops = {
static int __init nfhd_init_one(int id, u32 blocks, u32 bsize) static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
{ {
struct queue_limits lim = {
.logical_block_size = bsize,
};
struct nfhd_device *dev; struct nfhd_device *dev;
int dev_id = id - NFHD_DEV_OFFSET; int dev_id = id - NFHD_DEV_OFFSET;
int err = -ENOMEM; int err = -ENOMEM;
...@@ -117,7 +120,7 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize) ...@@ -117,7 +120,7 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
dev->bsize = bsize; dev->bsize = bsize;
dev->bshift = ffs(bsize) - 10; dev->bshift = ffs(bsize) - 10;
dev->disk = blk_alloc_disk(NULL, NUMA_NO_NODE); dev->disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
if (IS_ERR(dev->disk)) { if (IS_ERR(dev->disk)) {
err = PTR_ERR(dev->disk); err = PTR_ERR(dev->disk);
goto free_dev; goto free_dev;
...@@ -130,7 +133,6 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize) ...@@ -130,7 +133,6 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
dev->disk->private_data = dev; dev->disk->private_data = dev;
sprintf(dev->disk->disk_name, "nfhd%u", dev_id); sprintf(dev->disk->disk_name, "nfhd%u", dev_id);
set_capacity(dev->disk, (sector_t)blocks * (bsize / 512)); set_capacity(dev->disk, (sector_t)blocks * (bsize / 512));
blk_queue_logical_block_size(dev->disk->queue, bsize);
err = add_disk(dev->disk); err = add_disk(dev->disk);
if (err) if (err)
goto out_cleanup_disk; goto out_cleanup_disk;
......
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