479fb3a6eea1794cd69a5d04462fbdb0d5d21148
[zfs.git] / config / kernel-shrink.m4
1 dnl #
2 dnl # 3.1 API change
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.
6 dnl #
7 AC_DEFUN([ZFS_AC_KERNEL_SHRINK], [
8         AC_MSG_CHECKING([whether super_block has s_shrink])
9         ZFS_LINUX_TRY_COMPILE([
10                 #include <linux/fs.h>
11
12                 int shrink(struct shrinker *s, struct shrink_control *sc)
13                     { return 0; }
14
15                 static const struct super_block
16                     sb __attribute__ ((unused)) = {
17                         .s_shrink.shrink = shrink,
18                         .s_shrink.seeks = DEFAULT_SEEKS,
19                         .s_shrink.batch = 0,
20                 };
21         ],[
22         ],[
23                 AC_MSG_RESULT(yes)
24                 AC_DEFINE(HAVE_SHRINK, 1, [struct super_block has s_shrink])
25
26         ],[
27                 AC_MSG_RESULT(no)
28         ])
29 ])
30
31 AC_DEFUN([ZFS_AC_KERNEL_NR_CACHED_OBJECTS], [
32         AC_MSG_CHECKING([whether sops->nr_cached_objects() exists])
33         ZFS_LINUX_TRY_COMPILE([
34                 #include <linux/fs.h>
35
36                 int nr_cached_objects(struct super_block *sb) { return 0; }
37
38                 static const struct super_operations
39                     sops __attribute__ ((unused)) = {
40                         .nr_cached_objects = nr_cached_objects,
41                 };
42         ],[
43         ],[
44                 AC_MSG_RESULT(yes)
45                 AC_DEFINE(HAVE_NR_CACHED_OBJECTS, 1,
46                         [sops->nr_cached_objects() exists])
47         ],[
48                 AC_MSG_RESULT(no)
49         ])
50 ])
51
52 AC_DEFUN([ZFS_AC_KERNEL_FREE_CACHED_OBJECTS], [
53         AC_MSG_CHECKING([whether sops->free_cached_objects() exists])
54         ZFS_LINUX_TRY_COMPILE([
55                 #include <linux/fs.h>
56
57                 void free_cached_objects(struct super_block *sb, int x)
58                     { return; }
59
60                 static const struct super_operations
61                     sops __attribute__ ((unused)) = {
62                         .free_cached_objects = free_cached_objects,
63                 };
64         ],[
65         ],[
66                 AC_MSG_RESULT(yes)
67                 AC_DEFINE(HAVE_FREE_CACHED_OBJECTS, 1,
68                         [sops->free_cached_objects() exists])
69         ],[
70                 AC_MSG_RESULT(no)
71         ])
72 ])