aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2020-12-22 13:53:25 -0800
committerBrian Behlendorf <[email protected]>2020-12-27 16:20:40 -0800
commit19697e4545cae70cf6692d19d17821d2f11a1ece (patch)
treed5b3d09778e46c1ab4e1c4215c573dbc266fd954
parent72ba4b2a4ca8c55bc8e8350126de2e9f18e75900 (diff)
Linux 5.11 compat: revalidate_disk_size()
Both revalidate_disk_size() and revalidate_disk() have been removed. Functionally this isn't a problem because we only relied on these functions to call zvol_revalidate_disk() for us and to perform any additional handling which might be needed for that kernel version. When neither are available we know there's no additional handling needed and we can directly call zvol_revalidate_disk(). Reviewed-by: Rafael Kitover <[email protected]> Reviewed-by: Coleman Kane <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11387 Closes #11390
-rw-r--r--config/kernel-revalidate-disk-size.m428
-rw-r--r--config/kernel.m44
-rw-r--r--module/os/linux/zfs/zvol_os.c6
3 files changed, 31 insertions, 7 deletions
diff --git a/config/kernel-revalidate-disk-size.m4 b/config/kernel-revalidate-disk-size.m4
index de1146c10..a7d0cb3cd 100644
--- a/config/kernel-revalidate-disk-size.m4
+++ b/config/kernel-revalidate-disk-size.m4
@@ -1,24 +1,46 @@
dnl #
+dnl # 5.11 API change
+dnl # revalidate_disk_size() has been removed entirely.
+dnl #
dnl # 5.10 API change
dnl # revalidate_disk() was replaced by revalidate_disk_size()
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_SRC_REVALIDATE_DISK_SIZE], [
+AC_DEFUN([ZFS_AC_KERNEL_SRC_REVALIDATE_DISK], [
+
ZFS_LINUX_TEST_SRC([revalidate_disk_size], [
#include <linux/genhd.h>
], [
struct gendisk *disk = NULL;
(void) revalidate_disk_size(disk, false);
])
+
+ ZFS_LINUX_TEST_SRC([revalidate_disk], [
+ #include <linux/genhd.h>
+ ], [
+ struct gendisk *disk = NULL;
+ (void) revalidate_disk(disk);
+ ])
])
-AC_DEFUN([ZFS_AC_KERNEL_REVALIDATE_DISK_SIZE], [
+AC_DEFUN([ZFS_AC_KERNEL_REVALIDATE_DISK], [
+
AC_MSG_CHECKING([whether revalidate_disk_size() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([revalidate_disk_size],
[revalidate_disk_size], [block/genhd.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REVALIDATE_DISK_SIZE, 1,
- [revalidate_disk_size() is available])
+ [revalidate_disk_size() is available])
], [
AC_MSG_RESULT(no)
+
+ AC_MSG_CHECKING([whether revalidate_disk() is available])
+ ZFS_LINUX_TEST_RESULT_SYMBOL([revalidate_disk],
+ [revalidate_disk], [block/genhd.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_REVALIDATE_DISK, 1,
+ [revalidate_disk() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
])
diff --git a/config/kernel.m4 b/config/kernel.m4
index c8340bde5..200ce05b7 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -62,7 +62,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
ZFS_AC_KERNEL_SRC_BLKDEV
ZFS_AC_KERNEL_SRC_BLK_QUEUE
ZFS_AC_KERNEL_SRC_GET_DISK_AND_MODULE
- ZFS_AC_KERNEL_SRC_REVALIDATE_DISK_SIZE
+ ZFS_AC_KERNEL_SRC_REVALIDATE_DISK
ZFS_AC_KERNEL_SRC_GET_DISK_RO
ZFS_AC_KERNEL_SRC_GENERIC_READLINK_GLOBAL
ZFS_AC_KERNEL_SRC_DISCARD_GRANULARITY
@@ -161,7 +161,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_BLKDEV
ZFS_AC_KERNEL_BLK_QUEUE
ZFS_AC_KERNEL_GET_DISK_AND_MODULE
- ZFS_AC_KERNEL_REVALIDATE_DISK_SIZE
+ ZFS_AC_KERNEL_REVALIDATE_DISK
ZFS_AC_KERNEL_GET_DISK_RO
ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL
ZFS_AC_KERNEL_DISCARD_GRANULARITY
diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c
index 9a9a721ce..6f5ef12e7 100644
--- a/module/os/linux/zfs/zvol_os.c
+++ b/module/os/linux/zfs/zvol_os.c
@@ -658,10 +658,12 @@ zvol_update_volsize(zvol_state_t *zv, uint64_t volsize)
{
struct gendisk *disk = zv->zv_zso->zvo_disk;
-#ifdef HAVE_REVALIDATE_DISK_SIZE
+#if defined(HAVE_REVALIDATE_DISK_SIZE)
revalidate_disk_size(disk, zvol_revalidate_disk(disk) == 0);
-#else
+#elif defined(HAVE_REVALIDATE_DISK)
revalidate_disk(disk);
+#else
+ zvol_revalidate_disk(disk);
#endif
return (0);
}