Use sb->s_d_op default dentry operations
[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 *, struct shrink_control *sc)
13                         __attribute__ ((unused)) = NULL;
14                 struct super_block sb __attribute__ ((unused)) = {
15                         .s_shrink.shrink = shrink,
16                         .s_shrink.seeks = DEFAULT_SEEKS,
17                         .s_shrink.batch = 0,
18                 };
19         ],[
20                 AC_MSG_RESULT(yes)
21                 AC_DEFINE(HAVE_SHRINK, 1, [struct super_block has s_shrink])
22
23         ],[
24                 AC_MSG_RESULT(no)
25         ])
26 ])
27
28 AC_DEFUN([ZFS_AC_KERNEL_NR_CACHED_OBJECTS], [
29         AC_MSG_CHECKING([whether sops->nr_cached_objects() exists])
30         ZFS_LINUX_TRY_COMPILE([
31                 #include <linux/fs.h>
32         ],[
33                 int (*nr_cached_objects)(struct super_block *)
34                         __attribute__ ((unused)) = NULL;
35                 struct super_operations sops __attribute__ ((unused)) = {
36                         .nr_cached_objects = nr_cached_objects,
37                 };
38         ],[
39                 AC_MSG_RESULT(yes)
40                 AC_DEFINE(HAVE_NR_CACHED_OBJECTS, 1,
41                         [sops->nr_cached_objects() exists])
42         ],[
43                 AC_MSG_RESULT(no)
44         ])
45 ])
46
47 AC_DEFUN([ZFS_AC_KERNEL_FREE_CACHED_OBJECTS], [
48         AC_MSG_CHECKING([whether sops->free_cached_objects() exists])
49         ZFS_LINUX_TRY_COMPILE([
50                 #include <linux/fs.h>
51         ],[
52                 void (*free_cached_objects)(struct super_block *, int)
53                         __attribute__ ((unused)) = NULL;
54                 struct super_operations sops __attribute__ ((unused)) = {
55                         .free_cached_objects = free_cached_objects,
56                 };
57         ],[
58                 AC_MSG_RESULT(yes)
59                 AC_DEFINE(HAVE_FREE_CACHED_OBJECTS, 1,
60                         [sops->free_cached_objects() exists])
61         ],[
62                 AC_MSG_RESULT(no)
63         ])
64 ])