aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/os/linux/kernel/linux/blkdev_compat.h17
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
}