]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
loop: Use bdev limit helpers for configuring discard
authorJohn Garry <john.g.garry@oracle.com>
Wed, 30 Oct 2024 11:19:00 +0000 (11:19 +0000)
committerJens Axboe <axboe@kernel.dk>
Wed, 30 Oct 2024 13:23:57 +0000 (07:23 -0600)
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>
drivers/block/loop.c

index 78a7bb28defe4cb6e41019cdda07ef88701eb345..7719858c49bb632698b139246f677a393cf061ba 100644 (file)
@@ -786,11 +786,11 @@ static void loop_config_discard(struct loop_device *lo,
         * file-backed loop devices: discarded regions read back as zero.
         */
        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;
-               granularity = bdev_discard_granularity(I_BDEV(inode)) ?:
-                       queue_physical_block_size(backingq);
+               max_discard_sectors = bdev_write_zeroes_sectors(bdev);
+               granularity = bdev_discard_granularity(bdev) ?:
+                       bdev_physical_block_size(bdev);
 
        /*
         * We use punch hole to reclaim the free space used by the