]> git.ipfire.org Git - thirdparty/linux.git/commit - include/linux/blkdev.h
block: add a bdev_max_discard_sectors helper
authorChristoph Hellwig <hch@lst.de>
Fri, 15 Apr 2022 04:52:54 +0000 (06:52 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Apr 2022 01:49:59 +0000 (19:49 -0600)
commitcf0fbf894bb543f472f682c486be48298eccf199
tree94e16623288183a37b3448976a706a3e9e5aec74
parente3cc28ea28b5f8794db2aed24f8a0282ad2e85a2
block: add a bdev_max_discard_sectors helper

Add a helper to query the number of sectors support per each discard bio
based on the block device and use this helper to stop various places from
poking into the request_queue to see if discard is supported and if so how
much.  This mirrors what is done e.g. for write zeroes as well.

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: Coly Li <colyli@suse.de> [bcache]
Acked-by: David Sterba <dsterba@suse.com> [btrfs]
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Link: https://lore.kernel.org/r/20220415045258.199825-24-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/drbd/drbd_nl.c
drivers/block/drbd/drbd_receiver.c
drivers/block/rnbd/rnbd-srv-dev.h
drivers/md/dm-io.c
drivers/target/target_core_device.c
fs/f2fs/segment.c
include/linux/blkdev.h