From e924da7d6622b72f9eee78a3aad3e75b859da341 Mon Sep 17 00:00:00 2001 From: John Garry Date: Tue, 12 Nov 2024 09:21:44 +0000 Subject: [PATCH] block: Drop granularity check in queue_limit_discard_alignment() 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 Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20241112092144.4059847-1-john.g.garry@oracle.com Signed-off-by: Jens Axboe --- block/blk-settings.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index 0fe16f987cde..2f1005da530c 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -465,8 +465,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);