diff options
author | Brian Behlendorf <[email protected]> | 2022-05-27 18:20:04 +0000 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-05-31 12:04:22 -0700 |
commit | e2c31f2bc7d190fbd8fc5c13bac23daffc5d7b56 (patch) | |
tree | 77bca43f2078f11c47e190888476e27e971ff241 /include | |
parent | 5e4aedaca7cee981ed21ac856fd27b4682bb7888 (diff) |
Linux 5.19 compat: bdev_max_secure_erase_sectors()
Linux 5.19 commit torvalds/linux@44abff2c0 removed the
blk_queue_secure_erase() helper function. The preferred
interface is to now use the bdev_max_secure_erase_sectors()
function to check for discard support.
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #13515
Diffstat (limited to 'include')
-rw-r--r-- | include/os/linux/kernel/linux/blkdev_compat.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/include/os/linux/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h index 084d48c87..da188b4ea 100644 --- a/include/os/linux/kernel/linux/blkdev_compat.h +++ b/include/os/linux/kernel/linux/blkdev_compat.h @@ -514,21 +514,26 @@ bdev_discard_supported(struct block_device *bdev) } /* + * 5.19 API, + * bdev_max_secure_erase_sectors() + * * 4.8 API, * blk_queue_secure_erase() * * 2.6.36 - 4.7 API, * blk_queue_secdiscard() */ -static inline int -blk_queue_discard_secure(struct request_queue *q) +static inline boolean_t +bdev_secure_discard_supported(struct block_device *bdev) { -#if defined(HAVE_BLK_QUEUE_SECURE_ERASE) - return (blk_queue_secure_erase(q)); +#if defined(HAVE_BDEV_MAX_SECURE_ERASE_SECTORS) + return (!!bdev_max_secure_erase_sectors(bdev)); +#elif defined(HAVE_BLK_QUEUE_SECURE_ERASE) + return (!!blk_queue_secure_erase(bdev_get_queue(bdev))); #elif defined(HAVE_BLK_QUEUE_SECDISCARD) - return (blk_queue_secdiscard(q)); + return (!!blk_queue_secdiscard(bdev_get_queue(bdev))); #else - return (0); +#error "Unsupported kernel" #endif } |