]>
Commit | Line | Data |
---|---|---|
34ee731f AX |
1 | AC_DEFUN([SPL_AC_SHRINKER_CALLBACK],[ |
2 | tmp_flags="$EXTRA_KCFLAGS" | |
3 | EXTRA_KCFLAGS="-Werror" | |
4 | dnl # | |
5 | dnl # 2.6.23 to 2.6.34 API change | |
6 | dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask) | |
7 | dnl # | |
8 | AC_MSG_CHECKING([whether old 2-argument shrinker exists]) | |
9 | SPL_LINUX_TRY_COMPILE([ | |
10 | #include <linux/mm.h> | |
11 | ||
12 | int shrinker_cb(int nr_to_scan, gfp_t gfp_mask); | |
13 | ],[ | |
14 | struct shrinker cache_shrinker = { | |
15 | .shrink = shrinker_cb, | |
16 | .seeks = DEFAULT_SEEKS, | |
17 | }; | |
18 | register_shrinker(&cache_shrinker); | |
19 | ],[ | |
20 | AC_MSG_RESULT(yes) | |
21 | AC_DEFINE(HAVE_2ARGS_OLD_SHRINKER_CALLBACK, 1, | |
22 | [old shrinker callback wants 2 args]) | |
23 | ],[ | |
24 | AC_MSG_RESULT(no) | |
25 | dnl # | |
26 | dnl # 2.6.35 - 2.6.39 API change | |
27 | dnl # ->shrink(struct shrinker *, | |
28 | dnl # int nr_to_scan, gfp_t gfp_mask) | |
29 | dnl # | |
30 | AC_MSG_CHECKING([whether old 3-argument shrinker exists]) | |
31 | SPL_LINUX_TRY_COMPILE([ | |
32 | #include <linux/mm.h> | |
33 | ||
34 | int shrinker_cb(struct shrinker *, int nr_to_scan, | |
35 | gfp_t gfp_mask); | |
36 | ],[ | |
37 | struct shrinker cache_shrinker = { | |
38 | .shrink = shrinker_cb, | |
39 | .seeks = DEFAULT_SEEKS, | |
40 | }; | |
41 | register_shrinker(&cache_shrinker); | |
42 | ],[ | |
43 | AC_MSG_RESULT(yes) | |
44 | AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1, | |
45 | [old shrinker callback wants 3 args]) | |
46 | ],[ | |
47 | AC_MSG_RESULT(no) | |
48 | dnl # | |
49 | dnl # 3.0 - 3.11 API change | |
50 | dnl # ->shrink(struct shrinker *, | |
51 | dnl # struct shrink_control *sc) | |
52 | dnl # | |
53 | AC_MSG_CHECKING( | |
54 | [whether new 2-argument shrinker exists]) | |
55 | SPL_LINUX_TRY_COMPILE([ | |
56 | #include <linux/mm.h> | |
57 | ||
58 | int shrinker_cb(struct shrinker *, | |
59 | struct shrink_control *sc); | |
60 | ],[ | |
61 | struct shrinker cache_shrinker = { | |
62 | .shrink = shrinker_cb, | |
63 | .seeks = DEFAULT_SEEKS, | |
64 | }; | |
65 | register_shrinker(&cache_shrinker); | |
66 | ],[ | |
67 | AC_MSG_RESULT(yes) | |
68 | AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1, | |
69 | [new shrinker callback wants 2 args]) | |
70 | ],[ | |
71 | AC_MSG_RESULT(no) | |
72 | dnl # | |
73 | dnl # 3.12 API change, | |
74 | dnl # ->shrink() is logically split in to | |
75 | dnl # ->count_objects() and ->scan_objects() | |
76 | dnl # | |
77 | AC_MSG_CHECKING( | |
78 | [whether ->count_objects callback exists]) | |
79 | SPL_LINUX_TRY_COMPILE([ | |
80 | #include <linux/mm.h> | |
81 | ||
82 | unsigned long shrinker_cb( | |
83 | struct shrinker *, | |
84 | struct shrink_control *sc); | |
85 | ],[ | |
86 | struct shrinker cache_shrinker = { | |
87 | .count_objects = shrinker_cb, | |
88 | .scan_objects = shrinker_cb, | |
89 | .seeks = DEFAULT_SEEKS, | |
90 | }; | |
91 | register_shrinker(&cache_shrinker); | |
92 | ],[ | |
93 | AC_MSG_RESULT(yes) | |
94 | AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK, | |
95 | 1, [->count_objects exists]) | |
96 | ],[ | |
97 | AC_MSG_ERROR(error) | |
98 | ]) | |
99 | ]) | |
100 | ]) | |
101 | ]) | |
102 | EXTRA_KCFLAGS="$tmp_flags" | |
103 | ]) | |
104 | ||
105 | dnl # | |
106 | dnl # 2.6.39 API change, | |
107 | dnl # Shrinker adjust to use common shrink_control structure. | |
108 | dnl # | |
109 | AC_DEFUN([SPL_AC_SHRINK_CONTROL_STRUCT], [ | |
110 | AC_MSG_CHECKING([whether struct shrink_control exists]) | |
111 | SPL_LINUX_TRY_COMPILE([ | |
112 | #include <linux/mm.h> | |
113 | ],[ | |
114 | struct shrink_control sc __attribute__ ((unused)); | |
115 | ||
116 | sc.nr_to_scan = 0; | |
117 | sc.gfp_mask = GFP_KERNEL; | |
118 | ],[ | |
119 | AC_MSG_RESULT(yes) | |
120 | AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1, | |
121 | [struct shrink_control exists]) | |
122 | ],[ | |
123 | AC_MSG_RESULT(no) | |
124 | ]) | |
125 | ]) |