Skip to content

Commit 02a77b3

Browse files
johnpgarrygregkh
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]> Stable-dep-of: f5c84ef ("loop: Add sanity check for read/write_iter") Signed-off-by: Sasha Levin <[email protected]>
1 parent 126be03 commit 02a77b3

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)