Skip to content

Commit 8d3fd05

Browse files
johnpgarryaxboe
authored andcommitted
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. Signed-off-by: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 2f5a65e commit 8d3fd05

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
@@ -786,11 +786,11 @@ static void loop_config_discard(struct loop_device *lo,
786786
* file-backed loop devices: discarded regions read back as zero.
787787
*/
788788
if (S_ISBLK(inode->i_mode)) {
789-
struct request_queue *backingq = bdev_get_queue(I_BDEV(inode));
789+
struct block_device *bdev = I_BDEV(inode);
790790

791-
max_discard_sectors = backingq->limits.max_write_zeroes_sectors;
792-
granularity = bdev_discard_granularity(I_BDEV(inode)) ?:
793-
queue_physical_block_size(backingq);
791+
max_discard_sectors = bdev_write_zeroes_sectors(bdev);
792+
granularity = bdev_discard_granularity(bdev) ?:
793+
bdev_physical_block_size(bdev);
794794

795795
/*
796796
* We use punch hole to reclaim the free space used by the

0 commit comments

Comments
 (0)