aboutsummaryrefslogtreecommitdiffstats
path: root/config/kernel-blkdev.m4
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2020-12-22 13:02:59 -0800
committerBrian Behlendorf <[email protected]>2020-12-27 16:20:33 -0800
commit72ba4b2a4ca8c55bc8e8350126de2e9f18e75900 (patch)
tree56288eb0e3337af212c34edd2e0704eb5acc5430 /config/kernel-blkdev.m4
parenta970f0594e9f67363dece8e0ed066e3eb7725bb4 (diff)
Linux 5.11 compat: bdev_whole()
The bd_contains member was removed from the block_device structure. Callers needing to determine if a vdev is a whole block device should use the new bdev_whole() wrapper. For older kernels we provide our own bdev_whole() wrapper which relies on bd_contains for compatibility. Reviewed-by: Rafael Kitover <[email protected]> Reviewed-by: Coleman Kane <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11387 Closes #11390
Diffstat (limited to 'config/kernel-blkdev.m4')
-rw-r--r--config/kernel-blkdev.m425
1 files changed, 25 insertions, 0 deletions
diff --git a/config/kernel-blkdev.m4 b/config/kernel-blkdev.m4
index 622a1af5d..4b80d4dd2 100644
--- a/config/kernel-blkdev.m4
+++ b/config/kernel-blkdev.m4
@@ -271,6 +271,29 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE], [
])
])
+dnl #
+dnl # 5.11 API change
+dnl # Added bdev_whole() helper.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE], [
+ ZFS_LINUX_TEST_SRC([bdev_whole], [
+ #include <linux/blkdev.h>
+ ],[
+ struct block_device *bdev = NULL;
+ bdev = bdev_whole(bdev);
+ ])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE], [
+ AC_MSG_CHECKING([whether bdev_whole() is available])
+ ZFS_LINUX_TEST_RESULT([bdev_whole], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BDEV_WHOLE, 1, [bdev_whole() is available])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
+
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [
ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH
ZFS_AC_KERNEL_SRC_BLKDEV_PUT
@@ -281,6 +304,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE
ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE
+ ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE
])
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [
@@ -293,4 +317,5 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [
ZFS_AC_KERNEL_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE
ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE
ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE
+ ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE
])