diff mbox series

loop: Simplify discard granularity calc

Message ID 20241101092215.422428-1-john.g.garry@oracle.com (mailing list archive)
State New
Headers show
Series loop: Simplify discard granularity calc | expand

Commit Message

John Garry Nov. 1, 2024, 9:22 a.m. UTC
A bdev discard granularity is always at least SECTOR_SIZE, so don't check
for a zero value.

Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.g.garry@oracle.com>

Comments

Jens Axboe Nov. 1, 2024, 6:12 p.m. UTC | #1
On Fri, 01 Nov 2024 09:22:15 +0000, John Garry wrote:
> A bdev discard granularity is always at least SECTOR_SIZE, so don't check
> for a zero value.
> 
> 

Applied, thanks!

[1/1] loop: Simplify discard granularity calc
      (no commit info)

Best regards,
diff mbox series

Patch

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 7719858c49bb..f21f4254b038 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -789,8 +789,7 @@  static void loop_config_discard(struct loop_device *lo,
 		struct block_device *bdev = I_BDEV(inode);
 
 		max_discard_sectors = bdev_write_zeroes_sectors(bdev);
-		granularity = bdev_discard_granularity(bdev) ?:
-			bdev_physical_block_size(bdev);
+		granularity = bdev_discard_granularity(bdev);
 
 	/*
 	 * We use punch hole to reclaim the free space used by the