diff mbox series

block: Drop granularity check in queue_limit_discard_alignment()

Message ID 20241112092144.4059847-1-john.g.garry@oracle.com (mailing list archive)
State New
Headers show
Series block: Drop granularity check in queue_limit_discard_alignment() | expand

Commit Message

John Garry Nov. 12, 2024, 9:21 a.m. UTC
lim->discard_granularity is always at least SECTOR_SIZE, so drop the
pointless check for granularity less than SECTOR_SIZE.

Signed-off-by: John Garry <john.g.garry@oracle.com>

Comments

Christoph Hellwig Nov. 12, 2024, 5:22 p.m. UTC | #1
On Tue, Nov 12, 2024 at 09:21:44AM +0000, John Garry wrote:
> lim->discard_granularity is always at least SECTOR_SIZE, so drop the
> pointless check for granularity less than SECTOR_SIZE.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
John Garry Nov. 19, 2024, 4:05 p.m. UTC | #2
On 12/11/2024 09:21, John Garry wrote:
> lim->discard_granularity is always at least SECTOR_SIZE, so drop the
> pointless check for granularity less than SECTOR_SIZE.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>

Just a reminder in case this can still make v6.13

I wouldn't say that it is a fix.

Thanks,
John

> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 7d6b296997c2..4091794c5a1c 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -457,8 +457,6 @@ static unsigned int queue_limit_discard_alignment(
>   	/* Why are these in bytes, not sectors? */
>   	alignment = lim->discard_alignment >> SECTOR_SHIFT;
>   	granularity = lim->discard_granularity >> SECTOR_SHIFT;
> -	if (!granularity)
> -		return 0;
>   
>   	/* Offset of the partition start in 'granularity' sectors */
>   	offset = sector_div(sector, granularity);
Jens Axboe Nov. 19, 2024, 4:10 p.m. UTC | #3
On Tue, 12 Nov 2024 09:21:44 +0000, John Garry wrote:
> lim->discard_granularity is always at least SECTOR_SIZE, so drop the
> pointless check for granularity less than SECTOR_SIZE.
> 
> 

Applied, thanks!

[1/1] block: Drop granularity check in queue_limit_discard_alignment()
      commit: e924da7d6622b72f9eee78a3aad3e75b859da341

Best regards,
diff mbox series

Patch

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 7d6b296997c2..4091794c5a1c 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -457,8 +457,6 @@  static unsigned int queue_limit_discard_alignment(
 	/* Why are these in bytes, not sectors? */
 	alignment = lim->discard_alignment >> SECTOR_SHIFT;
 	granularity = lim->discard_granularity >> SECTOR_SHIFT;
-	if (!granularity)
-		return 0;
 
 	/* Offset of the partition start in 'granularity' sectors */
 	offset = sector_div(sector, granularity);