UPSTREAM: loop: Use bdev limit helpers for configuring discard
Instead of directly looking at the request_queue limits, use the bdev limits helpers, which is preferable. Change-Id: Ia4eca604290e7cdb4dcd0057ab6d2b4aa1d7d973 Signed-off-by: John Garry <john.g.garry@oracle.com> Link: https://lore.kernel.org/r/20241030111900.3981223-1-john.g.garry@oracle.com Signed-off-by: Jens Axboe <axboe@kernel.dk> (cherry picked from commit 8d3fd059dd289e6c322e5741ad56794bcce699a2) Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
committed by
Bart Van Assche
parent
02cf51391e
commit
f1aac3cfaf
@@ -786,11 +786,11 @@ static void loop_config_discard(struct loop_device *lo,
|
|||||||
* file-backed loop devices: discarded regions read back as zero.
|
* file-backed loop devices: discarded regions read back as zero.
|
||||||
*/
|
*/
|
||||||
if (S_ISBLK(inode->i_mode)) {
|
if (S_ISBLK(inode->i_mode)) {
|
||||||
struct request_queue *backingq = bdev_get_queue(I_BDEV(inode));
|
struct block_device *bdev = I_BDEV(inode);
|
||||||
|
|
||||||
max_discard_sectors = backingq->limits.max_write_zeroes_sectors;
|
max_discard_sectors = bdev_write_zeroes_sectors(bdev);
|
||||||
granularity = bdev_discard_granularity(I_BDEV(inode)) ?:
|
granularity = bdev_discard_granularity(bdev) ?:
|
||||||
queue_physical_block_size(backingq);
|
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