]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-shrink.m4
Eliminate runtime function pointer mods in autotools checks
[mirror_zfs.git] / config / kernel-shrink.m4
CommitLineData
ab26409d
BB
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_SHRINK], [
8 AC_MSG_CHECKING([whether super_block has s_shrink])
9 ZFS_LINUX_TRY_COMPILE([
10 #include <linux/fs.h>
c38367c7
RY
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)) = {
ab26409d
BB
17 .s_shrink.shrink = shrink,
18 .s_shrink.seeks = DEFAULT_SEEKS,
19 .s_shrink.batch = 0,
20 };
c38367c7 21 ],[
ab26409d
BB
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
31AC_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>
c38367c7
RY
35
36 int nr_cached_objects(struct super_block *sb) { return 0; }
37
38 static const struct super_operations
39 sops __attribute__ ((unused)) = {
ab26409d
BB
40 .nr_cached_objects = nr_cached_objects,
41 };
c38367c7 42 ],[
ab26409d
BB
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
52AC_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>
c38367c7
RY
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)) = {
ab26409d
BB
62 .free_cached_objects = free_cached_objects,
63 };
c38367c7 64 ],[
ab26409d
BB
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])