3 dnl # The super_block structure now stores a per-filesystem shrinker.
4 dnl # This interface is preferable because it can be used to specifically
5 dnl # target only the zfs filesystem for pruning.
7 AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK], [
8 ZFS_LINUX_TEST_SRC([super_block_s_shrink], [
11 static const struct super_block
12 sb __attribute__ ((unused)) = {
13 .s_shrink.seeks = DEFAULT_SEEKS,
21 dnl # s_shrink is now a pointer.
23 AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK_PTR], [
24 ZFS_LINUX_TEST_SRC([super_block_s_shrink_ptr], [
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,
33 static const struct super_block
34 sb __attribute__ ((unused)) = {
35 .s_shrink = &shrinker,
40 AC_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], [
44 AC_DEFINE(HAVE_SUPER_BLOCK_S_SHRINK, 1,
45 [have super_block s_shrink])
48 AC_MSG_CHECKING([whether super_block has s_shrink pointer])
49 ZFS_LINUX_TEST_RESULT([super_block_s_shrink_ptr], [
51 AC_DEFINE(HAVE_SUPER_BLOCK_S_SHRINK_PTR, 1,
52 [have super_block s_shrink pointer])
55 ZFS_LINUX_TEST_ERROR([sb->s_shrink()])
62 dnl # register_shrinker() becomes a var-arg function that takes
63 dnl # a printf-style format string as args > 0
65 AC_DEFUN([ZFS_AC_KERNEL_SRC_REGISTER_SHRINKER_VARARG], [
66 ZFS_LINUX_TEST_SRC([register_shrinker_vararg], [
68 static unsigned long shrinker_cb(struct shrinker *shrink,
69 struct shrink_control *sc) { return 0; }
71 struct shrinker cache_shrinker = {
72 .count_objects = shrinker_cb,
73 .scan_objects = shrinker_cb,
74 .seeks = DEFAULT_SEEKS,
76 register_shrinker(&cache_shrinker, "vararg-reg-shrink-test");
80 AC_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], [
84 AC_DEFINE(HAVE_REGISTER_SHRINKER_VARARG, 1,
85 [register_shrinker is vararg])
93 dnl # register_shrinker has been replaced by shrinker_register.
95 AC_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; }
101 struct shrinker cache_shrinker = {
102 .count_objects = shrinker_cb,
103 .scan_objects = shrinker_cb,
104 .seeks = DEFAULT_SEEKS,
106 shrinker_register(&cache_shrinker);
110 AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_REGISTER], [
111 AC_MSG_CHECKING([whether shrinker_register() exists])
112 ZFS_LINUX_TEST_RESULT([shrinker_register], [
114 AC_DEFINE(HAVE_SHRINKER_REGISTER, 1, [shrinker_register exists])
120 AC_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
127 AC_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