diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/kernel-blk-queue-discard.m4 | 65 | ||||
-rw-r--r-- | config/kernel.m4 | 2 |
2 files changed, 67 insertions, 0 deletions
diff --git a/config/kernel-blk-queue-discard.m4 b/config/kernel-blk-queue-discard.m4 new file mode 100644 index 000000000..addbba814 --- /dev/null +++ b/config/kernel-blk-queue-discard.m4 @@ -0,0 +1,65 @@ +dnl # +dnl # 2.6.32 - 4.x API, +dnl # blk_queue_discard() +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [ + AC_MSG_CHECKING([whether blk_queue_discard() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include <linux/blkdev.h> + ],[ + struct request_queue *q __attribute__ ((unused)) = NULL; + int value __attribute__ ((unused)); + + value = blk_queue_discard(q); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_DISCARD, 1, + [blk_queue_discard() is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # 4.8 - 4.x API, +dnl # blk_queue_secure_erase() +dnl # +dnl # 2.6.36 - 4.7 API, +dnl # blk_queue_secdiscard() +dnl # +dnl # 2.6.x - 2.6.35 API, +dnl # Unsupported by kernel +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [ + AC_MSG_CHECKING([whether blk_queue_secure_erase() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include <linux/blkdev.h> + ],[ + struct request_queue *q __attribute__ ((unused)) = NULL; + int value __attribute__ ((unused)); + + value = blk_queue_secure_erase(q); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1, + [blk_queue_secure_erase() is available]) + ],[ + AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether blk_queue_secdiscard() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include <linux/blkdev.h> + ],[ + struct request_queue *q __attribute__ ((unused)) = NULL; + int value __attribute__ ((unused)); + + value = blk_queue_secdiscard(q); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1, + [blk_queue_secdiscard() is available]) + ],[ + AC_MSG_RESULT(no) + ]) + ]) +]) diff --git a/config/kernel.m4 b/config/kernel.m4 index e4d0e3393..f7d657e0c 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -164,6 +164,8 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL_IN_COMPAT_SYSCALL ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64 ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNC + ZFS_AC_KERNEL_BLK_QUEUE_DISCARD + ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE AS_IF([test "$LINUX_OBJ" != "$LINUX"], [ KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ" |