summaryrefslogtreecommitdiff
path: root/drivers/block/loop.c
diff options
context:
space:
mode:
authorJohn Garry <john.g.garry@oracle.com>2024-11-01 09:22:15 +0000
committerJens Axboe <axboe@kernel.dk>2024-11-01 20:17:52 -0600
commitd47de6ac8842327ae1c782670283450159c55d5b (patch)
tree17ecc938169ba53f5606dca6bfbaff7ac40a417c /drivers/block/loop.c
parentf187b9bf1a639090893c31030ddb60f9beae23f0 (diff)
loop: Simplify discard granularity calc
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> Link: https://lore.kernel.org/r/20241101092215.422428-1-john.g.garry@oracle.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r--drivers/block/loop.c3
1 files changed, 1 insertions, 2 deletions
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