UPSTREAM: 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> Change-Id: Ia2cc07d3e7af37bce2b0ebd2aa576f72b359eacf 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> (cherry picked from commit d47de6ac8842327ae1c782670283450159c55d5b) Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
committed by
Bart Van Assche
parent
f1aac3cfaf
commit
49d8530dfe
@@ -789,8 +789,7 @@ static void loop_config_discard(struct loop_device *lo,
|
|||||||
struct block_device *bdev = I_BDEV(inode);
|
struct block_device *bdev = I_BDEV(inode);
|
||||||
|
|
||||||
max_discard_sectors = bdev_write_zeroes_sectors(bdev);
|
max_discard_sectors = bdev_write_zeroes_sectors(bdev);
|
||||||
granularity = bdev_discard_granularity(bdev) ?:
|
granularity = bdev_discard_granularity(bdev);
|
||||||
bdev_physical_block_size(bdev);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We use punch hole to reclaim the free space used by the
|
* We use punch hole to reclaim the free space used by the
|
||||||
|
|||||||
Reference in New Issue
Block a user