summaryrefslogtreecommitdiff
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-04-15 07:52:56 +0300
committerJens Axboe <axboe@kernel.dk>2022-04-18 04:49:59 +0300
commit7b47ef52d0a2025fd1408a8a0990933b8e1e510f (patch)
tree7df157ba434f0911852a57837610cc4f8e28b70f /include/linux/blkdev.h
parent70200574cc229f6ba038259e8142af2aa09e6976 (diff)
downloadlinux-7b47ef52d0a2025fd1408a8a0990933b8e1e510f.tar.xz
block: add a bdev_discard_granularity helper
Abstract away implementation details from file systems by providing a block_device based helper to retrieve the discard granularity. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com> [drbd] Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com> Acked-by: David Sterba <dsterba@suse.com> [btrfs] Link: https://lore.kernel.org/r/20220415045258.199825-26-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 767ab22e1052..f1cf557ea20e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1257,6 +1257,11 @@ static inline unsigned int bdev_max_discard_sectors(struct block_device *bdev)
return bdev_get_queue(bdev)->limits.max_discard_sectors;
}
+static inline unsigned int bdev_discard_granularity(struct block_device *bdev)
+{
+ return bdev_get_queue(bdev)->limits.discard_granularity;
+}
+
static inline unsigned int bdev_write_zeroes_sectors(struct block_device *bdev)
{
struct request_queue *q = bdev_get_queue(bdev);