]> git.proxmox.com Git - mirror_zfs.git/blobdiff - config/kernel-shrink.m4
Linux 6.7 compat: handle superblock shrinker member change
[mirror_zfs.git] / config / kernel-shrink.m4
index 0c702153e8c4585957725fe240811243a63c3d25..1c5f753d411c9c360ac2d627a40611a26d4759d6 100644 (file)
@@ -19,12 +19,44 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK], [
        ],[])
 ])
 
+dnl #
+dnl # 6.7 API change
+dnl # s_shrink is now a pointer.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK_PTR], [
+       ZFS_LINUX_TEST_SRC([super_block_s_shrink_ptr], [
+               #include <linux/fs.h>
+               unsigned long shrinker_cb(struct shrinker *shrink,
+                   struct shrink_control *sc) { return 0; }
+               static struct shrinker shrinker = {
+                       .count_objects = shrinker_cb,
+                       .scan_objects = shrinker_cb,
+                       .seeks = DEFAULT_SEEKS,
+               };
+               static const struct super_block
+                   sb __attribute__ ((unused)) = {
+                       .s_shrink = &shrinker,
+               };
+       ],[])
+])
+
 AC_DEFUN([ZFS_AC_KERNEL_SUPER_BLOCK_S_SHRINK], [
        AC_MSG_CHECKING([whether super_block has s_shrink])
        ZFS_LINUX_TEST_RESULT([super_block_s_shrink], [
                AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SUPER_BLOCK_S_SHRINK, 1,
+                       [have super_block s_shrink])
        ],[
-               ZFS_LINUX_TEST_ERROR([sb->s_shrink()])
+               AC_MSG_RESULT(no)
+               AC_MSG_CHECKING([whether super_block has s_shrink pointer])
+               ZFS_LINUX_TEST_RESULT([super_block_s_shrink_ptr], [
+                       AC_MSG_RESULT(yes)
+                       AC_DEFINE(HAVE_SUPER_BLOCK_S_SHRINK_PTR, 1,
+                               [have super_block s_shrink pointer])
+               ],[
+                       AC_MSG_RESULT(no)
+                       ZFS_LINUX_TEST_ERROR([sb->s_shrink()])
+               ])
        ])
 ])
 
@@ -174,6 +206,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT], [
 
 AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER], [
        ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK
+       ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK_PTR
        ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_HAS_NID
        ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK
        ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_STRUCT