brd: 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: Christoph Hellwig <hch@lst.de> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Link: https://lore.kernel.org/r/20240215071055.2201424-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
2cfe0104bc
commit
b5baaba4ce
@ -318,6 +318,16 @@ static int brd_alloc(int i)
|
|||||||
struct gendisk *disk;
|
struct gendisk *disk;
|
||||||
char buf[DISK_NAME_LEN];
|
char buf[DISK_NAME_LEN];
|
||||||
int err = -ENOMEM;
|
int err = -ENOMEM;
|
||||||
|
struct queue_limits lim = {
|
||||||
|
/*
|
||||||
|
* This is so fdisk will align partitions on 4k, because of
|
||||||
|
* direct_access API needing 4k alignment, returning a PFN
|
||||||
|
* (This is only a problem on very small devices <= 4M,
|
||||||
|
* otherwise fdisk will align on 1M. Regardless this call
|
||||||
|
* is harmless)
|
||||||
|
*/
|
||||||
|
.physical_block_size = PAGE_SIZE,
|
||||||
|
};
|
||||||
|
|
||||||
list_for_each_entry(brd, &brd_devices, brd_list)
|
list_for_each_entry(brd, &brd_devices, brd_list)
|
||||||
if (brd->brd_number == i)
|
if (brd->brd_number == i)
|
||||||
@ -335,7 +345,7 @@ static int brd_alloc(int i)
|
|||||||
debugfs_create_u64(buf, 0444, brd_debugfs_dir,
|
debugfs_create_u64(buf, 0444, brd_debugfs_dir,
|
||||||
&brd->brd_nr_pages);
|
&brd->brd_nr_pages);
|
||||||
|
|
||||||
disk = brd->brd_disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
|
disk = brd->brd_disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
|
||||||
if (IS_ERR(disk)) {
|
if (IS_ERR(disk)) {
|
||||||
err = PTR_ERR(disk);
|
err = PTR_ERR(disk);
|
||||||
goto out_free_dev;
|
goto out_free_dev;
|
||||||
@ -348,15 +358,6 @@ static int brd_alloc(int i)
|
|||||||
strscpy(disk->disk_name, buf, DISK_NAME_LEN);
|
strscpy(disk->disk_name, buf, DISK_NAME_LEN);
|
||||||
set_capacity(disk, rd_size * 2);
|
set_capacity(disk, rd_size * 2);
|
||||||
|
|
||||||
/*
|
|
||||||
* This is so fdisk will align partitions on 4k, because of
|
|
||||||
* direct_access API needing 4k alignment, returning a PFN
|
|
||||||
* (This is only a problem on very small devices <= 4M,
|
|
||||||
* otherwise fdisk will align on 1M. Regardless this call
|
|
||||||
* is harmless)
|
|
||||||
*/
|
|
||||||
blk_queue_physical_block_size(disk->queue, PAGE_SIZE);
|
|
||||||
|
|
||||||
/* Tell the block layer that this is not a rotational device */
|
/* Tell the block layer that this is not a rotational device */
|
||||||
blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
|
blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
|
||||||
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, disk->queue);
|
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, disk->queue);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user