Skip to content

Commit 0e5abd0

Browse files
johnpgarryjfvogel
authored andcommitted
loop: Use bdev limit helpers for configuring discard
[ Upstream commit 8d3fd05 ] Instead of directly looking at the request_queue limits, use the bdev limits helpers, which is preferable. 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> Stable-dep-of: f5c84ef ("loop: Add sanity check for read/write_iter") Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit 02a77b3020a2b8777ead56468e8f1421e640ebd6) Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
1 parent 1c49463 commit 0e5abd0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/block/loop.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -710,11 +710,11 @@ static void loop_config_discard(struct loop_device *lo,
710710
* file-backed loop devices: discarded regions read back as zero.
711711
*/
712712
if (S_ISBLK(inode->i_mode)) {
713-
struct request_queue *backingq = bdev_get_queue(I_BDEV(inode));
713+
struct block_device *bdev = I_BDEV(inode);
714714

715-
max_discard_sectors = backingq->limits.max_write_zeroes_sectors;
716-
granularity = bdev_discard_granularity(I_BDEV(inode)) ?:
717-
queue_physical_block_size(backingq);
715+
max_discard_sectors = bdev_write_zeroes_sectors(bdev);
716+
granularity = bdev_discard_granularity(bdev) ?:
717+
bdev_physical_block_size(bdev);
718718

719719
/*
720720
* We use punch hole to reclaim the free space used by the

0 commit comments

Comments
 (0)