diff mbox series

[3/3] dm-integrity: set max_integrity_segments in dm_integrity_io_hints

Message ID 20240306142739.237234-4-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/3] nvdimm: remove nd_integrity_init | expand

Commit Message

Christoph Hellwig March 6, 2024, 2:27 p.m. UTC
Set max_integrity_segments with the other queue limits instead
of updating it later.  This also uncovered that the driver is trying
to set the limit to UINT_MAX while max_integrity_segments is an
unsigned short, so fix it up to use USHRT_MAX instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/dm-integrity.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mike Snitzer March 6, 2024, 5:25 p.m. UTC | #1
On Wed, Mar 06 2024 at  9:27P -0500,
Christoph Hellwig <hch@lst.de> wrote:

> Set max_integrity_segments with the other queue limits instead
> of updating it later.  This also uncovered that the driver is trying
> to set the limit to UINT_MAX while max_integrity_segments is an
> unsigned short, so fix it up to use USHRT_MAX instead.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/md/dm-integrity.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> index c5f03aab455256..a2e5cfe84565ae 100644
> --- a/drivers/md/dm-integrity.c
> +++ b/drivers/md/dm-integrity.c
> @@ -3419,6 +3419,7 @@ static void dm_integrity_io_hints(struct dm_target *ti, struct queue_limits *lim
>  		blk_limits_io_min(limits, ic->sectors_per_block << SECTOR_SHIFT);
>  		limits->dma_alignment = limits->logical_block_size - 1;
>  	}
> +	limits->max_integrity_segments = USHRT_MAX;
>  }
>  
>  static void calculate_journal_section_size(struct dm_integrity_c *ic)
> @@ -3586,7 +3587,6 @@ static void dm_integrity_set(struct dm_target *ti, struct dm_integrity_c *ic)
>  	bi.interval_exp = ic->sb->log2_sectors_per_block + SECTOR_SHIFT;
>  
>  	blk_integrity_register(disk, &bi);
> -	blk_queue_max_integrity_segments(disk->queue, UINT_MAX);
>  }
>  
>  static void dm_integrity_free_page_list(struct page_list *pl)
> -- 
> 2.39.2
> 

I've picked this up for 6.9:
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-6.9&id=f30e5ed1306be8a900b33317bc429dd3794d81a1

Thanks.
Christoph Hellwig March 6, 2024, 9:57 p.m. UTC | #2
On Wed, Mar 06, 2024 at 12:25:42PM -0500, Mike Snitzer wrote:
> I've picked this up for 6.9:
> https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-6.9&id=f30e5ed1306be8a900b33317bc429dd3794d81a1

A yes, dm was already passing the limits around so there is no
dependency on the block changes.  The dm tree is defintively the
better place then.
diff mbox series

Patch

diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index c5f03aab455256..a2e5cfe84565ae 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -3419,6 +3419,7 @@  static void dm_integrity_io_hints(struct dm_target *ti, struct queue_limits *lim
 		blk_limits_io_min(limits, ic->sectors_per_block << SECTOR_SHIFT);
 		limits->dma_alignment = limits->logical_block_size - 1;
 	}
+	limits->max_integrity_segments = USHRT_MAX;
 }
 
 static void calculate_journal_section_size(struct dm_integrity_c *ic)
@@ -3586,7 +3587,6 @@  static void dm_integrity_set(struct dm_target *ti, struct dm_integrity_c *ic)
 	bi.interval_exp = ic->sb->log2_sectors_per_block + SECTOR_SHIFT;
 
 	blk_integrity_register(disk, &bi);
-	blk_queue_max_integrity_segments(disk->queue, UINT_MAX);
 }
 
 static void dm_integrity_free_page_list(struct page_list *pl)