1dnl # 2dnl # 3.1 API change 3dnl # The super_block structure now stores a per-filesystem shrinker. 4dnl # This interface is preferable because it can be used to specifically 5dnl # target only the zfs filesystem for pruning. 6dnl # 7AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK], [ 8 ZFS_LINUX_TEST_SRC([super_block_s_shrink], [ 9 #include <linux/fs.h> 10 11 static const struct super_block 12 sb __attribute__ ((unused)) = { 13 .s_shrink.seeks = DEFAULT_SEEKS, 14 .s_shrink.batch = 0, 15 }; 16 ],[]) 17]) 18 19dnl # 20dnl # 6.7 API change 21dnl # s_shrink is now a pointer. 22dnl # 23AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK_PTR], [ 24 ZFS_LINUX_TEST_SRC([super_block_s_shrink_ptr], [ 25 #include <linux/fs.h> 26 static unsigned long shrinker_cb(struct shrinker *shrink, 27 struct shrink_control *sc) { return 0; } 28 static struct shrinker shrinker = { 29 .count_objects = shrinker_cb, 30 .scan_objects = shrinker_cb, 31 .seeks = DEFAULT_SEEKS, 32 }; 33 static const struct super_block 34 sb __attribute__ ((unused)) = { 35 .s_shrink = &shrinker, 36 }; 37 ],[]) 38]) 39 40AC_DEFUN([ZFS_AC_KERNEL_SUPER_BLOCK_S_SHRINK], [ 41 AC_MSG_CHECKING([whether super_block has s_shrink]) 42 ZFS_LINUX_TEST_RESULT([super_block_s_shrink], [ 43 AC_MSG_RESULT(yes) 44 AC_DEFINE(HAVE_SUPER_BLOCK_S_SHRINK, 1, 45 [have super_block s_shrink]) 46 ],[ 47 AC_MSG_RESULT(no) 48 AC_MSG_CHECKING([whether super_block has s_shrink pointer]) 49 ZFS_LINUX_TEST_RESULT([super_block_s_shrink_ptr], [ 50 AC_MSG_RESULT(yes) 51 AC_DEFINE(HAVE_SUPER_BLOCK_S_SHRINK_PTR, 1, 52 [have super_block s_shrink pointer]) 53 ],[ 54 AC_MSG_RESULT(no) 55 ZFS_LINUX_TEST_ERROR([sb->s_shrink()]) 56 ]) 57 ]) 58]) 59 60dnl # 61dnl # 6.0 API change 62dnl # register_shrinker() becomes a var-arg function that takes 63dnl # a printf-style format string as args > 0 64dnl # 65AC_DEFUN([ZFS_AC_KERNEL_SRC_REGISTER_SHRINKER_VARARG], [ 66 ZFS_LINUX_TEST_SRC([register_shrinker_vararg], [ 67 #include <linux/mm.h> 68 static unsigned long shrinker_cb(struct shrinker *shrink, 69 struct shrink_control *sc) { return 0; } 70 ],[ 71 struct shrinker cache_shrinker = { 72 .count_objects = shrinker_cb, 73 .scan_objects = shrinker_cb, 74 .seeks = DEFAULT_SEEKS, 75 }; 76 register_shrinker(&cache_shrinker, "vararg-reg-shrink-test"); 77 ]) 78]) 79 80AC_DEFUN([ZFS_AC_KERNEL_REGISTER_SHRINKER_VARARG],[ 81 AC_MSG_CHECKING([whether new var-arg register_shrinker() exists]) 82 ZFS_LINUX_TEST_RESULT([register_shrinker_vararg], [ 83 AC_MSG_RESULT(yes) 84 AC_DEFINE(HAVE_REGISTER_SHRINKER_VARARG, 1, 85 [register_shrinker is vararg]) 86 ],[ 87 AC_MSG_RESULT(no) 88 ]) 89]) 90 91dnl # 92dnl # 6.7 API change 93dnl # register_shrinker has been replaced by shrinker_register. 94dnl # 95AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_REGISTER], [ 96 ZFS_LINUX_TEST_SRC([shrinker_register], [ 97 #include <linux/shrinker.h> 98 static unsigned long shrinker_cb(struct shrinker *shrink, 99 struct shrink_control *sc) { return 0; } 100 ],[ 101 struct shrinker cache_shrinker = { 102 .count_objects = shrinker_cb, 103 .scan_objects = shrinker_cb, 104 .seeks = DEFAULT_SEEKS, 105 }; 106 shrinker_register(&cache_shrinker); 107 ]) 108]) 109 110AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_REGISTER], [ 111 AC_MSG_CHECKING([whether shrinker_register() exists]) 112 ZFS_LINUX_TEST_RESULT([shrinker_register], [ 113 AC_MSG_RESULT(yes) 114 AC_DEFINE(HAVE_SHRINKER_REGISTER, 1, [shrinker_register exists]) 115 ], [ 116 AC_MSG_RESULT(no) 117 ]) 118]) 119 120AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER], [ 121 ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK 122 ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK_PTR 123 ZFS_AC_KERNEL_SRC_REGISTER_SHRINKER_VARARG 124 ZFS_AC_KERNEL_SRC_SHRINKER_REGISTER 125]) 126 127AC_DEFUN([ZFS_AC_KERNEL_SHRINKER], [ 128 ZFS_AC_KERNEL_SUPER_BLOCK_S_SHRINK 129 ZFS_AC_KERNEL_REGISTER_SHRINKER_VARARG 130 ZFS_AC_KERNEL_SHRINKER_REGISTER 131]) 132