diff mbox series

[7/9] btt: pass queue_limits to blk_mq_alloc_disk

Message ID 20240215071055.2201424-8-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/9] block: pass a queue_limits argument to blk_alloc_disk | expand

Commit Message

Christoph Hellwig Feb. 15, 2024, 7:10 a.m. UTC
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>
---
 drivers/nvdimm/btt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Dave Jiang Feb. 15, 2024, 6:16 p.m. UTC | #1
On 2/15/24 12:10 AM, Christoph Hellwig wrote:
> 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: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/nvdimm/btt.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
> index 9a0eae01d5986e..4d0c527e857678 100644
> --- a/drivers/nvdimm/btt.c
> +++ b/drivers/nvdimm/btt.c
> @@ -1496,9 +1496,13 @@ static int btt_blk_init(struct btt *btt)
>  {
>  	struct nd_btt *nd_btt = btt->nd_btt;
>  	struct nd_namespace_common *ndns = nd_btt->ndns;
> +	struct queue_limits lim = {
> +		.logical_block_size	= btt->sector_size,
> +		.max_hw_sectors		= UINT_MAX,
> +	};
>  	int rc;
>  
> -	btt->btt_disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
> +	btt->btt_disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
>  	if (IS_ERR(btt->btt_disk))
>  		return PTR_ERR(btt->btt_disk);
>  
> @@ -1507,8 +1511,6 @@ static int btt_blk_init(struct btt *btt)
>  	btt->btt_disk->fops = &btt_fops;
>  	btt->btt_disk->private_data = btt;
>  
> -	blk_queue_logical_block_size(btt->btt_disk->queue, btt->sector_size);
> -	blk_queue_max_hw_sectors(btt->btt_disk->queue, UINT_MAX);
>  	blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_disk->queue);
>  	blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue);
>
diff mbox series

Patch

diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 9a0eae01d5986e..4d0c527e857678 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1496,9 +1496,13 @@  static int btt_blk_init(struct btt *btt)
 {
 	struct nd_btt *nd_btt = btt->nd_btt;
 	struct nd_namespace_common *ndns = nd_btt->ndns;
+	struct queue_limits lim = {
+		.logical_block_size	= btt->sector_size,
+		.max_hw_sectors		= UINT_MAX,
+	};
 	int rc;
 
-	btt->btt_disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+	btt->btt_disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
 	if (IS_ERR(btt->btt_disk))
 		return PTR_ERR(btt->btt_disk);
 
@@ -1507,8 +1511,6 @@  static int btt_blk_init(struct btt *btt)
 	btt->btt_disk->fops = &btt_fops;
 	btt->btt_disk->private_data = btt;
 
-	blk_queue_logical_block_size(btt->btt_disk->queue, btt->sector_size);
-	blk_queue_max_hw_sectors(btt->btt_disk->queue, UINT_MAX);
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_disk->queue);
 	blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue);