From 72ba4b2a4ca8c55bc8e8350126de2e9f18e75900 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 22 Dec 2020 13:02:59 -0800 Subject: 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 Reviewed-by: Coleman Kane Signed-off-by: Brian Behlendorf Closes #11387 Closes #11390 --- config/kernel-blkdev.m4 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'config/kernel-blkdev.m4') 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 + ],[ + 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 ]) -- cgit v1.2.3