]> git.proxmox.com Git - zfsonlinux.git/blob - debian/patches/0009-Perform-KABI-checks-in-parallel.patch
74025a7f97768dc594ad41fe765d883c3b414e5d
[zfsonlinux.git] / debian / patches / 0009-Perform-KABI-checks-in-parallel.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Brian Behlendorf <behlendorf1@llnl.gov>
3 Date: Tue, 1 Oct 2019 12:50:34 -0700
4 Subject: [PATCH] Perform KABI checks in parallel
5
6 Reduce the time required for ./configure to perform the needed
7 KABI checks by allowing kbuild to compile multiple test cases in
8 parallel. This was accomplished by splitting each test's source
9 code from the logic handling whether that code could be compiled
10 or not.
11
12 By introducing this split it's possible to minimize the number of
13 times kbuild needs to be invoked. As importantly, it means all of
14 the tests can be built in parallel. This does require a little extra
15 care since we expect some tests to fail, so the --keep-going (-k)
16 option must be provided otherwise some tests may not get compiled.
17 Furthermore, since a failure during the kbuild modpost phase will
18 result in an early exit; the final linking phase is limited to tests
19 which passed the initial compilation and produced an object file.
20
21 Once everything has been built the configure script proceeds as
22 previously. The only significant difference is that it now merely
23 needs to test for the existence of a .ko file to determine the
24 result of a given test. This vastly speeds up the entire process.
25
26 New test cases should use ZFS_LINUX_TEST_SRC to declare their test
27 source code and ZFS_LINUX_TEST_RESULT to check the result. All of
28 the existing kernel-*.m4 files have been updated accordingly, see
29 config/kernel-current-time.m4 for a basic example. The legacy
30 ZFS_LINUX_TRY_COMPILE macro has been kept to handle special cases
31 but it's use is not encouraged.
32
33 master (secs) patched (secs)
34 ------------- ----------------
35 autogen.sh 61 68
36 configure 137 24 (~17% of current run time)
37 make -j $(nproc) 44 44
38 make rpms 287 150
39
40 Reviewed-by: Tony Hutter <hutter2@llnl.gov>
41 Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
42 Closes #8547
43 Closes #9132
44 Closes #9341
45 (cherry picked from commit 608f8749a1055e6769899788e11bd51fd396f9e5)
46 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
47 ---
48 .gitignore | 1 +
49 Makefile.am | 6 +-
50 config/iconv.m4 | 3 +-
51 config/kernel-access-ok-type.m4 | 18 +-
52 config/kernel-acl.m4 | 253 ++++--
53 config/kernel-aio-fsync.m4 | 14 +-
54 config/kernel-automount.m4 | 13 +-
55 config/kernel-bdev-logical-size.m4 | 17 +-
56 config/kernel-bdev-physical-size.m4 | 17 +-
57 config/kernel-bdi.m4 | 78 +-
58 config/kernel-bio-bvec-iter.m4 | 13 +-
59 config/kernel-bio-end-io-t-args.m4 | 34 +-
60 config/kernel-bio-failfast.m4 | 39 +-
61 config/kernel-bio-op.m4 | 74 +-
62 config/kernel-bio-rw-barrier.m4 | 15 +-
63 config/kernel-bio-rw-discard.m4 | 15 +-
64 config/kernel-bio_set_dev.m4 | 51 +-
65 config/kernel-blk-queue-bdi.m4 | 12 +-
66 config/kernel-blk-queue-discard.m4 | 41 +-
67 config/kernel-blk-queue-flags.m4 | 40 +-
68 config/kernel-blk-queue-flush.m4 | 64 +-
69 config/kernel-blk-queue-max-hw-sectors.m4 | 19 +-
70 config/kernel-blk-queue-max-segments.m4 | 21 +-
71 config/kernel-blk-queue-unplug.m4 | 48 +-
72 config/kernel-blkdev-get-by-path.m4 | 15 +-
73 config/kernel-blkdev-reread-part.m4 | 12 +-
74 config/kernel-block-device-operations.m4 | 46 +-
75 config/kernel-clear-inode.m4 | 13 +-
76 config/kernel-commit-metadata.m4 | 15 +-
77 config/kernel-config-defined.m4 | 183 ++++
78 config/kernel-create-nameidata.m4 | 15 +-
79 config/kernel-ctl-table-name.m4 | 12 +-
80 config/kernel-current-time.m4 | 13 +-
81 config/kernel-current_bio_tail.m4 | 30 +-
82 config/kernel-d-make-root.m4 | 17 -
83 config/kernel-d-obtain-alias.m4 | 18 -
84 config/kernel-d-prune-aliases.m4 | 19 -
85 config/kernel-declare-event-class.m4 | 8 +-
86 config/kernel-dentry-operations.m4 | 174 +++-
87 config/kernel-dirty-inode.m4 | 15 +-
88 config/kernel-discard-granularity.m4 | 15 +-
89 config/kernel-elevator-change.m4 | 21 +-
90 config/kernel-encode-fh-inode.m4 | 15 +-
91 config/kernel-evict-inode.m4 | 13 +-
92 config/kernel-fallocate-pax.m4 | 19 -
93 config/kernel-fallocate.m4 | 50 +-
94 config/kernel-file-dentry.m4 | 12 +-
95 config/kernel-file-inode.m4 | 12 +-
96 config/kernel-fmode-t.m4 | 15 +-
97 config/kernel-follow-down-one.m4 | 12 +-
98 config/kernel-fpu.m4 | 99 ++-
99 config/kernel-fst-mount.m4 | 13 +-
100 config/kernel-fsync.m4 | 83 +-
101 config/kernel-generic_io_acct.m4 | 63 +-
102 config/kernel-generic_readlink.m4 | 15 +-
103 config/kernel-get-disk-and-module.m4 | 13 +-
104 config/kernel-get-disk-ro.m4 | 18 +-
105 config/kernel-get-link.m4 | 126 +--
106 config/kernel-global_page_state.m4 | 72 +-
107 config/kernel-group-info.m4 | 15 +-
108 config/kernel-in-compat-syscall.m4 | 12 +-
109 config/kernel-inode-getattr.m4 | 56 +-
110 config/kernel-inode-lock.m4 | 15 +-
111 config/kernel-inode-set-flags.m4 | 12 +-
112 config/kernel-inode-set-iversion.m4 | 12 +-
113 config/kernel-inode-times.m4 | 15 +-
114 config/kernel-insert-inode-locked.m4 | 15 +-
115 config/kernel-invalidate-bdev-args.m4 | 14 +-
116 config/kernel-is_owner_or_cap.m4 | 31 +-
117 config/kernel-kmap-atomic-args.m4 | 14 +-
118 config/kernel-kmem-cache.m4 | 62 +-
119 config/kernel-kstrtoul.m4 | 14 +-
120 config/kernel-ktime_get_coarse_real_ts64.m4 | 15 +-
121 config/kernel-kuid-helpers.m4 | 12 +-
122 config/kernel-kuidgid.m4 | 26 +-
123 config/kernel-lookup-bdev.m4 | 32 +-
124 config/kernel-lookup-nameidata.m4 | 15 +-
125 config/kernel-lseek-execute.m4 | 16 +-
126 config/kernel-make-request-fn.m4 | 77 ++
127 config/kernel-misc-minor.m4 | 2 +-
128 config/kernel-mk-request-fn.m4 | 65 --
129 config/kernel-mkdir-umode-t.m4 | 13 +-
130 config/kernel-mod-param.m4 | 13 +-
131 config/kernel-objtool.m4 | 47 +-
132 config/kernel-open-bdev-exclusive.m4 | 15 +-
133 config/kernel-pde-data.m4 | 14 +-
134 config/kernel-put-link.m4 | 57 +-
135 config/kernel-rename.m4 | 16 +-
136 config/kernel-rw.m4 | 40 +-
137 config/kernel-rwsem.m4 | 65 +-
138 config/kernel-sched.m4 | 53 +-
139 config/kernel-security-inode-init.m4 | 38 +-
140 config/kernel-set-nlink.m4 | 15 +-
141 config/kernel-setattr-prepare.m4 | 16 +-
142 config/kernel-sget-args.m4 | 13 +-
143 config/kernel-show-options.m4 | 21 +-
144 config/kernel-shrink.m4 | 219 +++--
145 config/kernel-submit_bio.m4 | 12 +-
146 config/kernel-super-userns.m4 | 14 +-
147 config/kernel-timer.m4 | 52 +-
148 config/kernel-tmpfile.m4 | 16 +-
149 config/kernel-totalhigh_pages.m4 | 14 +-
150 config/kernel-totalram-pages-func.m4 | 15 +-
151 config/kernel-truncate-range.m4 | 13 +-
152 config/kernel-truncate-setsize.m4 | 15 +-
153 config/kernel-userns-capabilities.m4 | 48 +-
154 ...urange-sleep.m4 => kernel-usleep_range.m4} | 19 +-
155 config/kernel-vfs-direct_IO.m4 | 145 ++--
156 config/kernel-vfs-fsync.m4 | 12 +-
157 config/kernel-vfs-getattr.m4 | 54 +-
158 config/kernel-vfs-iterate.m4 | 84 +-
159 config/kernel-vfs-rw-iterate.m4 | 76 +-
160 config/kernel-wait.m4 | 73 +-
161 config/kernel-xattr-handler.m4 | 442 +++++-----
162 config/kernel-zlib.m4 | 57 +-
163 config/kernel.m4 | 783 +++++++++++-------
164 config/zfs-build.m4 | 11 +
165 config/zfs-meta.m4 | 18 +
166 118 files changed, 3245 insertions(+), 2127 deletions(-)
167 create mode 100644 config/kernel-config-defined.m4
168 delete mode 100644 config/kernel-d-make-root.m4
169 delete mode 100644 config/kernel-d-obtain-alias.m4
170 delete mode 100644 config/kernel-d-prune-aliases.m4
171 delete mode 100644 config/kernel-fallocate-pax.m4
172 create mode 100644 config/kernel-make-request-fn.m4
173 delete mode 100644 config/kernel-mk-request-fn.m4
174 rename config/{kernel-urange-sleep.m4 => kernel-usleep_range.m4} (60%)
175
176 diff --git a/.gitignore b/.gitignore
177 index ae9e22dfa..19377a7b1 100644
178 --- a/.gitignore
179 +++ b/.gitignore
180 @@ -36,6 +36,7 @@ Makefile.in
181 # Top level generated files specific to this top level dir
182 #
183 /bin
184 +/build
185 /configure
186 /config.log
187 /config.status
188 diff --git a/Makefile.am b/Makefile.am
189 index 9afe22954..5ee7c20be 100644
190 --- a/Makefile.am
191 +++ b/Makefile.am
192 @@ -40,7 +40,7 @@ gitrev:
193 BUILT_SOURCES = gitrev
194
195 distclean-local::
196 - -$(RM) -R autom4te*.cache
197 + -$(RM) -R autom4te*.cache build
198 -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
199 -o -name .pc -o -name .hg -o -name .git \) -prune -o \
200 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
201 @@ -87,8 +87,8 @@ commitcheck:
202 fi
203
204 cstyle:
205 - @find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' \
206 - ! -name '*.mod.c' -type f \
207 + @find ${top_srcdir} -name build -prune -o -name '*.[hc]' \
208 + ! -name 'zfs_config.*' ! -name '*.mod.c' -type f \
209 -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+
210
211 shellcheck:
212 diff --git a/config/iconv.m4 b/config/iconv.m4
213 index a285e9daa..fc915fde6 100644
214 --- a/config/iconv.m4
215 +++ b/config/iconv.m4
216 @@ -269,8 +269,7 @@ size_t iconv();
217 [am_cv_proto_iconv_arg1="const"])
218 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
219 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
220 - AC_MSG_RESULT([
221 - $am_cv_proto_iconv])
222 + AC_MSG_RESULT([$am_cv_proto_iconv])
223 else
224 dnl When compiling GNU libiconv on a system that does not have iconv yet,
225 dnl pick the POSIX compliant declaration without 'const'.
226 diff --git a/config/kernel-access-ok-type.m4 b/config/kernel-access-ok-type.m4
227 index 3b2878a55..dc9433458 100644
228 --- a/config/kernel-access-ok-type.m4
229 +++ b/config/kernel-access-ok-type.m4
230 @@ -4,17 +4,23 @@ dnl #
231 dnl # - access_ok(type, addr, size)
232 dnl # + access_ok(addr, size)
233 dnl #
234 -AC_DEFUN([ZFS_AC_KERNEL_ACCESS_OK_TYPE], [
235 - AC_MSG_CHECKING([whether access_ok() has 'type' parameter])
236 - ZFS_LINUX_TRY_COMPILE([
237 +AC_DEFUN([ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE], [
238 + ZFS_LINUX_TEST_SRC([access_ok_type], [
239 #include <linux/uaccess.h>
240 ],[
241 - const void __user __attribute__((unused)) *addr = (void *) 0xdeadbeef;
242 + const void __user __attribute__((unused)) *addr =
243 + (void *) 0xdeadbeef;
244 unsigned long __attribute__((unused)) size = 1;
245 int error __attribute__((unused)) = access_ok(0, addr, size);
246 - ],[
247 + ])
248 +])
249 +
250 +AC_DEFUN([ZFS_AC_KERNEL_ACCESS_OK_TYPE], [
251 + AC_MSG_CHECKING([whether access_ok() has 'type' parameter])
252 + ZFS_LINUX_TEST_RESULT([access_ok_type], [
253 AC_MSG_RESULT(yes)
254 - AC_DEFINE(HAVE_ACCESS_OK_TYPE, 1, [kernel has access_ok with 'type' parameter])
255 + AC_DEFINE(HAVE_ACCESS_OK_TYPE, 1,
256 + [kernel has access_ok with 'type' parameter])
257 ],[
258 AC_MSG_RESULT(no)
259 ])
260 diff --git a/config/kernel-acl.m4 b/config/kernel-acl.m4
261 index 02cc020e5..68a72872d 100644
262 --- a/config/kernel-acl.m4
263 +++ b/config/kernel-acl.m4
264 @@ -3,32 +3,26 @@ dnl # Check if posix_acl_release can be used from a ZFS_META_LICENSED
265 dnl # module. The is_owner_or_cap macro was replaced by
266 dnl # inode_owner_or_capable
267 dnl #
268 -AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [
269 - AC_MSG_CHECKING([whether posix_acl_release() is available])
270 - ZFS_LINUX_TRY_COMPILE([
271 +AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE], [
272 + ZFS_LINUX_TEST_SRC([posix_acl_release], [
273 #include <linux/cred.h>
274 #include <linux/fs.h>
275 #include <linux/posix_acl.h>
276 - ],[
277 - struct posix_acl* tmp = posix_acl_alloc(1, 0);
278 + ], [
279 + struct posix_acl *tmp = posix_acl_alloc(1, 0);
280 posix_acl_release(tmp);
281 - ],[
282 + ], [], [$ZFS_META_LICENSE])
283 +])
284 +
285 +AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [
286 + AC_MSG_CHECKING([whether posix_acl_release() is available])
287 + ZFS_LINUX_TEST_RESULT([posix_acl_release], [
288 AC_MSG_RESULT(yes)
289 AC_DEFINE(HAVE_POSIX_ACL_RELEASE, 1,
290 [posix_acl_release() is available])
291
292 AC_MSG_CHECKING([whether posix_acl_release() is GPL-only])
293 - ZFS_LINUX_TRY_COMPILE([
294 - #include <linux/module.h>
295 - #include <linux/cred.h>
296 - #include <linux/fs.h>
297 - #include <linux/posix_acl.h>
298 -
299 - MODULE_LICENSE("$ZFS_META_LICENSE");
300 - ],[
301 - struct posix_acl* tmp = posix_acl_alloc(1, 0);
302 - posix_acl_release(tmp);
303 - ],[
304 + ZFS_LINUX_TEST_RESULT([posix_acl_release_license], [
305 AC_MSG_RESULT(no)
306 ],[
307 AC_MSG_RESULT(yes)
308 @@ -46,24 +40,25 @@ dnl # set_cached_acl() and forget_cached_acl() changed from inline to
309 dnl # EXPORT_SYMBOL. In the former case, they may not be usable because of
310 dnl # posix_acl_release. In the latter case, we can always use them.
311 dnl #
312 -AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [
313 - AC_MSG_CHECKING([whether set_cached_acl() is usable])
314 - ZFS_LINUX_TRY_COMPILE([
315 - #include <linux/module.h>
316 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE], [
317 + ZFS_LINUX_TEST_SRC([set_cached_acl], [
318 #include <linux/cred.h>
319 #include <linux/fs.h>
320 #include <linux/posix_acl.h>
321 -
322 - MODULE_LICENSE("$ZFS_META_LICENSE");
323 - ],[
324 + ], [
325 struct inode *ip = NULL;
326 struct posix_acl *acl = posix_acl_alloc(1, 0);
327 set_cached_acl(ip, ACL_TYPE_ACCESS, acl);
328 forget_cached_acl(ip, ACL_TYPE_ACCESS);
329 - ],[
330 + ], [], [$ZFS_META_LICENSE])
331 +])
332 +
333 +AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [
334 + AC_MSG_CHECKING([whether set_cached_acl() is usable])
335 + ZFS_LINUX_TEST_RESULT([set_cached_acl_license], [
336 AC_MSG_RESULT(yes)
337 AC_DEFINE(HAVE_SET_CACHED_ACL_USABLE, 1,
338 - [posix_acl_release() is usable])
339 + [set_cached_acl() is usable])
340 ],[
341 AC_MSG_RESULT(no)
342 ])
343 @@ -77,14 +72,25 @@ dnl #
344 dnl # 3.14 API change,
345 dnl # posix_acl_chmod() is changed to __posix_acl_chmod()
346 dnl #
347 -AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
348 - AC_MSG_CHECKING([whether posix_acl_chmod exists])
349 - ZFS_LINUX_TRY_COMPILE([
350 +AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD], [
351 + ZFS_LINUX_TEST_SRC([posix_acl_chmod], [
352 #include <linux/fs.h>
353 #include <linux/posix_acl.h>
354 ],[
355 posix_acl_chmod(NULL, 0, 0)
356 + ])
357 +
358 + ZFS_LINUX_TEST_SRC([__posix_acl_chmod], [
359 + #include <linux/fs.h>
360 + #include <linux/posix_acl.h>
361 ],[
362 + __posix_acl_chmod(NULL, 0, 0)
363 + ])
364 +])
365 +
366 +AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
367 + AC_MSG_CHECKING([whether posix_acl_chmod exists])
368 + ZFS_LINUX_TEST_RESULT([posix_acl_chmod], [
369 AC_MSG_RESULT(yes)
370 AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, [posix_acl_chmod() exists])
371 ],[
372 @@ -92,14 +98,10 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
373 ])
374
375 AC_MSG_CHECKING([whether __posix_acl_chmod exists])
376 - ZFS_LINUX_TRY_COMPILE([
377 - #include <linux/fs.h>
378 - #include <linux/posix_acl.h>
379 - ],[
380 - __posix_acl_chmod(NULL, 0, 0)
381 - ],[
382 + ZFS_LINUX_TEST_RESULT([__posix_acl_chmod], [
383 AC_MSG_RESULT(yes)
384 - AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1, [__posix_acl_chmod() exists])
385 + AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1,
386 + [__posix_acl_chmod() exists])
387 ],[
388 AC_MSG_RESULT(no)
389 ])
390 @@ -109,18 +111,22 @@ dnl #
391 dnl # 3.1 API change,
392 dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t*
393 dnl #
394 -AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
395 - AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
396 - ZFS_LINUX_TRY_COMPILE([
397 +AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
398 + ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [
399 #include <linux/fs.h>
400 #include <linux/posix_acl.h>
401 ],[
402 umode_t tmp;
403 posix_acl_equiv_mode(NULL,&tmp);
404 - ],[
405 + ])
406 +])
407 +
408 +AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
409 + AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
410 + ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [
411 AC_MSG_RESULT(yes)
412 AC_DEFINE(HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T, 1,
413 - [ posix_acl_equiv_mode wants umode_t*])
414 + [posix_acl_equiv_mode wants umode_t*])
415 ],[
416 AC_MSG_RESULT(no)
417 ])
418 @@ -130,9 +136,8 @@ dnl #
419 dnl # 4.8 API change,
420 dnl # The function posix_acl_valid now must be passed a namespace.
421 dnl #
422 -AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
423 - AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
424 - ZFS_LINUX_TRY_COMPILE([
425 +AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS], [
426 + ZFS_LINUX_TEST_SRC([posix_acl_valid_with_ns], [
427 #include <linux/fs.h>
428 #include <linux/posix_acl.h>
429 ],[
430 @@ -141,7 +146,12 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
431 int error;
432
433 error = posix_acl_valid(user_ns, acl);
434 - ],[
435 + ])
436 +])
437 +
438 +AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
439 + AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
440 + ZFS_LINUX_TEST_RESULT([posix_acl_valid_with_ns], [
441 AC_MSG_RESULT(yes)
442 AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1,
443 [posix_acl_valid() wants user namespace])
444 @@ -155,9 +165,8 @@ dnl # 2.6.27 API change,
445 dnl # Check if inode_operations contains the function permission
446 dnl # and expects the nameidata structure to have been removed.
447 dnl #
448 -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [
449 - AC_MSG_CHECKING([whether iops->permission() exists])
450 - ZFS_LINUX_TRY_COMPILE([
451 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION], [
452 + ZFS_LINUX_TEST_SRC([inode_operations_permission], [
453 #include <linux/fs.h>
454
455 int permission_fn(struct inode *inode, int mask) { return 0; }
456 @@ -166,8 +175,12 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [
457 iops __attribute__ ((unused)) = {
458 .permission = permission_fn,
459 };
460 - ],[
461 - ],[
462 + ],[])
463 +])
464 +
465 +AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [
466 + AC_MSG_CHECKING([whether iops->permission() exists])
467 + ZFS_LINUX_TEST_RESULT([inode_operations_permission], [
468 AC_MSG_RESULT(yes)
469 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
470 ],[
471 @@ -180,9 +193,8 @@ dnl # 2.6.26 API change,
472 dnl # Check if inode_operations contains the function permission
473 dnl # and expects the nameidata structure to be passed.
474 dnl #
475 -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
476 - AC_MSG_CHECKING([whether iops->permission() wants nameidata])
477 - ZFS_LINUX_TRY_COMPILE([
478 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
479 + ZFS_LINUX_TEST_SRC([inode_operations_permission_with_nameidata], [
480 #include <linux/fs.h>
481 #include <linux/sched.h>
482
483 @@ -193,8 +205,12 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
484 iops __attribute__ ((unused)) = {
485 .permission = permission_fn,
486 };
487 - ],[
488 - ],[
489 + ],[])
490 +])
491 +
492 +AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
493 + AC_MSG_CHECKING([whether iops->permission() wants nameidata])
494 + ZFS_LINUX_TEST_RESULT([inode_operations_permission_with_nameidata], [
495 AC_MSG_RESULT(yes)
496 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
497 AC_DEFINE(HAVE_PERMISSION_WITH_NAMEIDATA, 1,
498 @@ -208,9 +224,8 @@ dnl #
499 dnl # 2.6.32 API change,
500 dnl # Check if inode_operations contains the function check_acl
501 dnl #
502 -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [
503 - AC_MSG_CHECKING([whether iops->check_acl() exists])
504 - ZFS_LINUX_TRY_COMPILE([
505 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL], [
506 + ZFS_LINUX_TEST_SRC([inode_operations_check_acl], [
507 #include <linux/fs.h>
508
509 int check_acl_fn(struct inode *inode, int mask) { return 0; }
510 @@ -219,8 +234,12 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [
511 iops __attribute__ ((unused)) = {
512 .check_acl = check_acl_fn,
513 };
514 - ],[
515 - ],[
516 + ],[])
517 +])
518 +
519 +AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [
520 + AC_MSG_CHECKING([whether iops->check_acl() exists])
521 + ZFS_LINUX_TEST_RESULT([inode_operations_check_acl], [
522 AC_MSG_RESULT(yes)
523 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
524 ],[
525 @@ -232,9 +251,8 @@ dnl #
526 dnl # 2.6.38 API change,
527 dnl # The function check_acl gained a new parameter: flags
528 dnl #
529 -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
530 - AC_MSG_CHECKING([whether iops->check_acl() wants flags])
531 - ZFS_LINUX_TRY_COMPILE([
532 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
533 + ZFS_LINUX_TEST_SRC([inode_operations_check_acl_with_flags], [
534 #include <linux/fs.h>
535
536 int check_acl_fn(struct inode *inode, int mask,
537 @@ -244,8 +262,12 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
538 iops __attribute__ ((unused)) = {
539 .check_acl = check_acl_fn,
540 };
541 - ],[
542 - ],[
543 + ],[])
544 +])
545 +
546 +AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
547 + AC_MSG_CHECKING([whether iops->check_acl() wants flags])
548 + ZFS_LINUX_TEST_RESULT([inode_operations_check_acl_with_flags], [
549 AC_MSG_RESULT(yes)
550 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
551 AC_DEFINE(HAVE_CHECK_ACL_WITH_FLAGS, 1,
552 @@ -259,9 +281,8 @@ dnl #
553 dnl # 3.1 API change,
554 dnl # Check if inode_operations contains the function get_acl
555 dnl #
556 -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
557 - AC_MSG_CHECKING([whether iops->get_acl() exists])
558 - ZFS_LINUX_TRY_COMPILE([
559 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
560 + ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [
561 #include <linux/fs.h>
562
563 struct posix_acl *get_acl_fn(struct inode *inode, int type)
564 @@ -271,8 +292,12 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
565 iops __attribute__ ((unused)) = {
566 .get_acl = get_acl_fn,
567 };
568 - ],[
569 - ],[
570 + ],[])
571 +])
572 +
573 +AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
574 + AC_MSG_CHECKING([whether iops->get_acl() exists])
575 + ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [
576 AC_MSG_RESULT(yes)
577 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
578 ],[
579 @@ -284,20 +309,23 @@ dnl #
580 dnl # 3.14 API change,
581 dnl # Check if inode_operations contains the function set_acl
582 dnl #
583 -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
584 - AC_MSG_CHECKING([whether iops->set_acl() exists])
585 - ZFS_LINUX_TRY_COMPILE([
586 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
587 + ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
588 #include <linux/fs.h>
589
590 - int set_acl_fn(struct inode *inode, struct posix_acl *acl, int type)
591 - { return 0; }
592 + int set_acl_fn(struct inode *inode, struct posix_acl *acl,
593 + int type) { return 0; }
594
595 static const struct inode_operations
596 iops __attribute__ ((unused)) = {
597 .set_acl = set_acl_fn,
598 };
599 - ],[
600 - ],[
601 + ],[])
602 +])
603 +
604 +AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
605 + AC_MSG_CHECKING([whether iops->set_acl() exists])
606 + ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
607 AC_MSG_RESULT(yes)
608 AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
609 ],[
610 @@ -311,16 +339,79 @@ dnl # The kernel get_acl will now check cache before calling i_op->get_acl and
611 dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that
612 dnl # anymore.
613 dnl #
614 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE], [
615 + ZFS_LINUX_TEST_SRC([get_acl_handle_cache], [
616 + #include <linux/fs.h>
617 + ],[
618 + void *sentinel __attribute__ ((unused)) =
619 + uncached_acl_sentinel(NULL);
620 + ])
621 +])
622 +
623 AC_DEFUN([ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE], [
624 AC_MSG_CHECKING([whether uncached_acl_sentinel() exists])
625 - ZFS_LINUX_TRY_COMPILE([
626 - #include <linux/fs.h>
627 + ZFS_LINUX_TEST_RESULT([get_acl_handle_cache], [
628 + AC_MSG_RESULT(yes)
629 + AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1,
630 + [uncached_acl_sentinel() exists])
631 ],[
632 - void *sentinel __attribute__ ((unused)) = uncached_acl_sentinel(NULL);
633 + AC_MSG_RESULT(no)
634 + ])
635 +])
636 +
637 +dnl #
638 +dnl # 4.16 kernel: check if struct posix_acl acl.a_refcount is a refcount_t.
639 +dnl # It's an atomic_t on older kernels.
640 +dnl #
641 +AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT], [
642 + ZFS_LINUX_TEST_SRC([acl_refcount], [
643 + #include <linux/backing-dev.h>
644 + #include <linux/refcount.h>
645 + #include <linux/posix_acl.h>
646 ],[
647 + struct posix_acl acl;
648 + refcount_t *r __attribute__ ((unused)) = &acl.a_refcount;
649 + ])
650 +])
651 +
652 +AC_DEFUN([ZFS_AC_KERNEL_ACL_HAS_REFCOUNT], [
653 + AC_MSG_CHECKING([whether posix_acl has refcount_t])
654 + ZFS_LINUX_TEST_RESULT([acl_refcount], [
655 AC_MSG_RESULT(yes)
656 - AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1, [uncached_acl_sentinel() exists])
657 + AC_DEFINE(HAVE_ACL_REFCOUNT, 1, [posix_acl has refcount_t])
658 ],[
659 AC_MSG_RESULT(no)
660 ])
661 ])
662 +
663 +AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [
664 + ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE
665 + ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE
666 + ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD
667 + ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
668 + ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS
669 + ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION
670 + ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA
671 + ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL
672 + ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS
673 + ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL
674 + ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL
675 + ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE
676 + ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT
677 +])
678 +
679 +AC_DEFUN([ZFS_AC_KERNEL_ACL], [
680 + ZFS_AC_KERNEL_POSIX_ACL_RELEASE
681 + ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE
682 + ZFS_AC_KERNEL_POSIX_ACL_CHMOD
683 + ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
684 + ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS
685 + ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION
686 + ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA
687 + ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL
688 + ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS
689 + ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
690 + ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
691 + ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
692 + ZFS_AC_KERNEL_ACL_HAS_REFCOUNT
693 +])
694 diff --git a/config/kernel-aio-fsync.m4 b/config/kernel-aio-fsync.m4
695 index 41b7a98a6..b4dbf29ba 100644
696 --- a/config/kernel-aio-fsync.m4
697 +++ b/config/kernel-aio-fsync.m4
698 @@ -1,21 +1,23 @@
699 dnl #
700 dnl # Linux 4.9-rc5+ ABI, removal of the .aio_fsync field
701 dnl #
702 -AC_DEFUN([ZFS_AC_KERNEL_AIO_FSYNC], [
703 - AC_MSG_CHECKING([whether fops->aio_fsync() exists])
704 - ZFS_LINUX_TRY_COMPILE([
705 +AC_DEFUN([ZFS_AC_KERNEL_SRC_AIO_FSYNC], [
706 + ZFS_LINUX_TEST_SRC([aio_fsync], [
707 #include <linux/fs.h>
708
709 static const struct file_operations
710 fops __attribute__ ((unused)) = {
711 .aio_fsync = NULL,
712 };
713 - ],[
714 - ],[
715 + ],[])
716 +])
717 +
718 +AC_DEFUN([ZFS_AC_KERNEL_AIO_FSYNC], [
719 + AC_MSG_CHECKING([whether fops->aio_fsync() exists])
720 + ZFS_LINUX_TEST_RESULT([aio_fsync], [
721 AC_MSG_RESULT(yes)
722 AC_DEFINE(HAVE_FILE_AIO_FSYNC, 1, [fops->aio_fsync() exists])
723 ],[
724 AC_MSG_RESULT(no)
725 ])
726 ])
727 -
728 diff --git a/config/kernel-automount.m4 b/config/kernel-automount.m4
729 index 1ee4c168d..93e14fa8d 100644
730 --- a/config/kernel-automount.m4
731 +++ b/config/kernel-automount.m4
732 @@ -5,16 +5,19 @@ dnl # solution to handling automounts. Prior to this cifs/nfs clients
733 dnl # which required automount support would abuse the follow_link()
734 dnl # operation on directories for this purpose.
735 dnl #
736 -AC_DEFUN([ZFS_AC_KERNEL_AUTOMOUNT], [
737 - AC_MSG_CHECKING([whether dops->d_automount() exists])
738 - ZFS_LINUX_TRY_COMPILE([
739 +AC_DEFUN([ZFS_AC_KERNEL_SRC_AUTOMOUNT], [
740 + ZFS_LINUX_TEST_SRC([dentry_operations_d_automount], [
741 #include <linux/dcache.h>
742 struct vfsmount *d_automount(struct path *p) { return NULL; }
743 struct dentry_operations dops __attribute__ ((unused)) = {
744 .d_automount = d_automount,
745 };
746 - ],[
747 - ],[
748 + ],[])
749 +])
750 +
751 +AC_DEFUN([ZFS_AC_KERNEL_AUTOMOUNT], [
752 + AC_MSG_CHECKING([whether dops->d_automount() exists])
753 + ZFS_LINUX_TEST_RESULT([dentry_operations_d_automount], [
754 AC_MSG_RESULT(yes)
755 AC_DEFINE(HAVE_AUTOMOUNT, 1, [dops->automount() exists])
756 ],[
757 diff --git a/config/kernel-bdev-logical-size.m4 b/config/kernel-bdev-logical-size.m4
758 index a6194577a..0de9afd88 100644
759 --- a/config/kernel-bdev-logical-size.m4
760 +++ b/config/kernel-bdev-logical-size.m4
761 @@ -5,21 +5,22 @@ dnl # it has been true for a while that there was no strict 1:1 mapping
762 dnl # between physical sector size and logical block size this change makes
763 dnl # it explicit.
764 dnl #
765 -AC_DEFUN([ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE], [
766 - AC_MSG_CHECKING([whether bdev_logical_block_size() is available])
767 - tmp_flags="$EXTRA_KCFLAGS"
768 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
769 - ZFS_LINUX_TRY_COMPILE([
770 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_LOGICAL_BLOCK_SIZE], [
771 + ZFS_LINUX_TEST_SRC([bdev_logical_block_size], [
772 #include <linux/blkdev.h>
773 ],[
774 struct block_device *bdev = NULL;
775 bdev_logical_block_size(bdev);
776 - ],[
777 + ], [$NO_UNUSED_BUT_SET_VARIABLE])
778 +])
779 +
780 +AC_DEFUN([ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE], [
781 + AC_MSG_CHECKING([whether bdev_logical_block_size() is available])
782 + ZFS_LINUX_TEST_RESULT([bdev_logical_block_size], [
783 AC_MSG_RESULT(yes)
784 AC_DEFINE(HAVE_BDEV_LOGICAL_BLOCK_SIZE, 1,
785 - [bdev_logical_block_size() is available])
786 + [bdev_logical_block_size() is available])
787 ],[
788 AC_MSG_RESULT(no)
789 ])
790 - EXTRA_KCFLAGS="$tmp_flags"
791 ])
792 diff --git a/config/kernel-bdev-physical-size.m4 b/config/kernel-bdev-physical-size.m4
793 index 77746ee91..94d8172d3 100644
794 --- a/config/kernel-bdev-physical-size.m4
795 +++ b/config/kernel-bdev-physical-size.m4
796 @@ -19,21 +19,22 @@ dnl #
797 dnl # Unfortunately, this interface isn't entirely reliable because
798 dnl # drives are sometimes known to misreport this value.
799 dnl #
800 -AC_DEFUN([ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE], [
801 - AC_MSG_CHECKING([whether bdev_physical_block_size() is available])
802 - tmp_flags="$EXTRA_KCFLAGS"
803 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
804 - ZFS_LINUX_TRY_COMPILE([
805 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_PHYSICAL_BLOCK_SIZE], [
806 + ZFS_LINUX_TEST_SRC([bdev_physical_block_size], [
807 #include <linux/blkdev.h>
808 ],[
809 struct block_device *bdev = NULL;
810 bdev_physical_block_size(bdev);
811 - ],[
812 + ], [$NO_UNUSED_BUT_SET_VARIABLE])
813 +])
814 +
815 +AC_DEFUN([ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE], [
816 + AC_MSG_CHECKING([whether bdev_physical_block_size() is available])
817 + ZFS_LINUX_TEST_RESULT([bdev_physical_block_size], [
818 AC_MSG_RESULT(yes)
819 AC_DEFINE(HAVE_BDEV_PHYSICAL_BLOCK_SIZE, 1,
820 - [bdev_physical_block_size() is available])
821 + [bdev_physical_block_size() is available])
822 ],[
823 AC_MSG_RESULT(no)
824 ])
825 - EXTRA_KCFLAGS="$tmp_flags"
826 ])
827 diff --git a/config/kernel-bdi.m4 b/config/kernel-bdi.m4
828 index cb7479ee9..51516332a 100644
829 --- a/config/kernel-bdi.m4
830 +++ b/config/kernel-bdi.m4
831 @@ -1,55 +1,81 @@
832 dnl #
833 -dnl # 2.6.32 - 2.6.33, bdi_setup_and_register() is not exported.
834 -dnl # 2.6.34 - 3.19, bdi_setup_and_register() takes 3 arguments.
835 -dnl # 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments.
836 -dnl # 4.12 - x.y, super_setup_bdi_name() new interface.
837 +dnl # Check available BDI interfaces.
838 dnl #
839 -AC_DEFUN([ZFS_AC_KERNEL_BDI], [
840 - AC_MSG_CHECKING([whether super_setup_bdi_name() exists])
841 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
842 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BDI], [
843 + ZFS_LINUX_TEST_SRC([super_setup_bdi_name], [
844 #include <linux/fs.h>
845 struct super_block sb;
846 ], [
847 char *name = "bdi";
848 atomic_long_t zfs_bdi_seq;
849 int error __attribute__((unused)) =
850 - super_setup_bdi_name(&sb, "%.28s-%ld", name, atomic_long_inc_return(&zfs_bdi_seq));
851 - ], [super_setup_bdi_name], [fs/super.c], [
852 + super_setup_bdi_name(&sb, "%.28s-%ld", name,
853 + atomic_long_inc_return(&zfs_bdi_seq));
854 + ])
855 +
856 + ZFS_LINUX_TEST_SRC([bdi_setup_and_register], [
857 + #include <linux/backing-dev.h>
858 + struct backing_dev_info bdi;
859 + ], [
860 + char *name = "bdi";
861 + int error __attribute__((unused)) =
862 + bdi_setup_and_register(&bdi, name);
863 + ])
864 +
865 + ZFS_LINUX_TEST_SRC([bdi_setup_and_register_3args], [
866 + #include <linux/backing-dev.h>
867 + struct backing_dev_info bdi;
868 + ], [
869 + char *name = "bdi";
870 + unsigned int cap = BDI_CAP_MAP_COPY;
871 + int error __attribute__((unused)) =
872 + bdi_setup_and_register(&bdi, name, cap);
873 + ])
874 +])
875 +
876 +AC_DEFUN([ZFS_AC_KERNEL_BDI], [
877 + dnl #
878 + dnl # 4.12, super_setup_bdi_name() introduced.
879 + dnl #
880 + AC_MSG_CHECKING([whether super_setup_bdi_name() exists])
881 + ZFS_LINUX_TEST_RESULT_SYMBOL([super_setup_bdi_name],
882 + [super_setup_bdi_name], [fs/super.c], [
883 AC_MSG_RESULT(yes)
884 AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
885 [super_setup_bdi_name() exits])
886 ], [
887 AC_MSG_RESULT(no)
888 +
889 + dnl #
890 + dnl # 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments.
891 + dnl #
892 AC_MSG_CHECKING(
893 [whether bdi_setup_and_register() wants 2 args])
894 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
895 - #include <linux/backing-dev.h>
896 - struct backing_dev_info bdi;
897 - ], [
898 - char *name = "bdi";
899 - int error __attribute__((unused)) =
900 - bdi_setup_and_register(&bdi, name);
901 - ], [bdi_setup_and_register], [mm/backing-dev.c], [
902 + ZFS_LINUX_TEST_RESULT_SYMBOL([bdi_setup_and_register],
903 + [bdi_setup_and_register], [mm/backing-dev.c], [
904 AC_MSG_RESULT(yes)
905 AC_DEFINE(HAVE_2ARGS_BDI_SETUP_AND_REGISTER, 1,
906 [bdi_setup_and_register() wants 2 args])
907 ], [
908 AC_MSG_RESULT(no)
909 +
910 + dnl #
911 + dnl # 2.6.34 - 3.19, bdi_setup_and_register()
912 + dnl # takes 3 arguments.
913 + dnl #
914 AC_MSG_CHECKING(
915 [whether bdi_setup_and_register() wants 3 args])
916 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
917 - #include <linux/backing-dev.h>
918 - struct backing_dev_info bdi;
919 - ], [
920 - char *name = "bdi";
921 - unsigned int cap = BDI_CAP_MAP_COPY;
922 - int error __attribute__((unused)) =
923 - bdi_setup_and_register(&bdi, name, cap);
924 - ], [bdi_setup_and_register], [mm/backing-dev.c], [
925 + ZFS_LINUX_TEST_RESULT_SYMBOL(
926 + [bdi_setup_and_register_3args],
927 + [bdi_setup_and_register], [mm/backing-dev.c], [
928 AC_MSG_RESULT(yes)
929 AC_DEFINE(HAVE_3ARGS_BDI_SETUP_AND_REGISTER, 1,
930 [bdi_setup_and_register() wants 3 args])
931 ], [
932 + dnl #
933 + dnl # 2.6.32 - 2.6.33, bdi_setup_and_register()
934 + dnl # is not exported.
935 + dnl #
936 AC_MSG_RESULT(no)
937 ])
938 ])
939 diff --git a/config/kernel-bio-bvec-iter.m4 b/config/kernel-bio-bvec-iter.m4
940 index 64c989386..f9a99cee6 100644
941 --- a/config/kernel-bio-bvec-iter.m4
942 +++ b/config/kernel-bio-bvec-iter.m4
943 @@ -3,18 +3,21 @@ dnl # 3.14 API change,
944 dnl # Immutable biovecs. A number of fields of struct bio are moved to
945 dnl # struct bvec_iter.
946 dnl #
947 -AC_DEFUN([ZFS_AC_KERNEL_BIO_BVEC_ITER], [
948 - AC_MSG_CHECKING([whether bio has bi_iter])
949 - ZFS_LINUX_TRY_COMPILE([
950 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BVEC_ITER], [
951 + ZFS_LINUX_TEST_SRC([bio_bvec_iter], [
952 #include <linux/bio.h>
953 ],[
954 struct bio bio;
955 bio.bi_iter.bi_sector = 0;
956 - ],[
957 + ])
958 +])
959 +
960 +AC_DEFUN([ZFS_AC_KERNEL_BIO_BVEC_ITER], [
961 + AC_MSG_CHECKING([whether bio has bi_iter])
962 + ZFS_LINUX_TEST_RESULT([bio_bvec_iter], [
963 AC_MSG_RESULT(yes)
964 AC_DEFINE(HAVE_BIO_BVEC_ITER, 1, [bio has bi_iter])
965 ],[
966 AC_MSG_RESULT(no)
967 ])
968 ])
969 -
970 diff --git a/config/kernel-bio-end-io-t-args.m4 b/config/kernel-bio-end-io-t-args.m4
971 index 3c420cc0c..80a1fbeda 100644
972 --- a/config/kernel-bio-end-io-t-args.m4
973 +++ b/config/kernel-bio-end-io-t-args.m4
974 @@ -5,20 +5,21 @@ dnl # bio->bi_error. This also replaces bio->bi_flags value BIO_UPTODATE.
975 dnl # Introduced by torvalds/linux@4246a0b63bd8f56a1469b12eafeb875b1041a451
976 dnl # ("block: add a bi_error field to struct bio").
977 dnl #
978 -AC_DEFUN([ZFS_AC_KERNEL_BIO_END_IO_T_ARGS], [
979 - AC_MSG_CHECKING([whether bio_end_io_t wants 1 arg])
980 - ZFS_LINUX_TRY_COMPILE([
981 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_END_IO_T_ARGS], [
982 + ZFS_LINUX_TEST_SRC([bio_end_io_t_args], [
983 #include <linux/bio.h>
984 -
985 void wanted_end_io(struct bio *bio) { return; }
986 -
987 bio_end_io_t *end_io __attribute__ ((unused)) = wanted_end_io;
988 - ],[
989 - ],[
990 + ], [])
991 +])
992 +
993 +AC_DEFUN([ZFS_AC_KERNEL_BIO_END_IO_T_ARGS], [
994 + AC_MSG_CHECKING([whether bio_end_io_t wants 1 arg])
995 + ZFS_LINUX_TEST_RESULT([bio_end_io_t_args], [
996 AC_MSG_RESULT(yes)
997 AC_DEFINE(HAVE_1ARG_BIO_END_IO_T, 1,
998 - [bio_end_io_t wants 1 arg])
999 - ],[
1000 + [bio_end_io_t wants 1 arg])
1001 + ], [
1002 AC_MSG_RESULT(no)
1003 ])
1004 ])
1005 @@ -28,16 +29,19 @@ dnl # 4.13 API change
1006 dnl # The bio->bi_error field was replaced with bio->bi_status which is an
1007 dnl # enum which describes all possible error types.
1008 dnl #
1009 -AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_STATUS], [
1010 - AC_MSG_CHECKING([whether bio->bi_status exists])
1011 - ZFS_LINUX_TRY_COMPILE([
1012 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BI_STATUS], [
1013 + ZFS_LINUX_TEST_SRC([bio_bi_status], [
1014 #include <linux/bio.h>
1015 - ],[
1016 + ], [
1017 struct bio bio __attribute__ ((unused));
1018 blk_status_t status __attribute__ ((unused)) = BLK_STS_OK;
1019 -
1020 bio.bi_status = status;
1021 - ],[
1022 + ])
1023 +])
1024 +
1025 +AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_STATUS], [
1026 + AC_MSG_CHECKING([whether bio->bi_status exists])
1027 + ZFS_LINUX_TEST_RESULT([bio_bi_status], [
1028 AC_MSG_RESULT(yes)
1029 AC_DEFINE(HAVE_BIO_BI_STATUS, 1, [bio->bi_status exists])
1030 ],[
1031 diff --git a/config/kernel-bio-failfast.m4 b/config/kernel-bio-failfast.m4
1032 index cfbec0523..0c636f08c 100644
1033 --- a/config/kernel-bio-failfast.m4
1034 +++ b/config/kernel-bio-failfast.m4
1035 @@ -3,37 +3,54 @@ dnl # Preferred interface for setting FAILFAST on a bio:
1036 dnl # 2.6.28-2.6.35: BIO_RW_FAILFAST_{DEV|TRANSPORT|DRIVER}
1037 dnl # >= 2.6.36: REQ_FAILFAST_{DEV|TRANSPORT|DRIVER}
1038 dnl #
1039 -
1040 -AC_DEFUN([ZFS_AC_KERNEL_BIO_FAILFAST_DTD], [
1041 - AC_MSG_CHECKING([whether BIO_RW_FAILFAST_* are defined])
1042 - ZFS_LINUX_TRY_COMPILE([
1043 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_FAILFAST_DTD], [
1044 + ZFS_LINUX_TEST_SRC([bio_failfast_dtd], [
1045 #include <linux/bio.h>
1046 ],[
1047 int flags __attribute__ ((unused));
1048 flags = ((1 << BIO_RW_FAILFAST_DEV) |
1049 (1 << BIO_RW_FAILFAST_TRANSPORT) |
1050 (1 << BIO_RW_FAILFAST_DRIVER));
1051 - ],[
1052 + ])
1053 +])
1054 +
1055 +AC_DEFUN([ZFS_AC_KERNEL_BIO_FAILFAST_DTD], [
1056 + AC_MSG_CHECKING([whether BIO_RW_FAILFAST_* are defined])
1057 + ZFS_LINUX_TEST_RESULT([bio_failfast_dtd], [
1058 AC_MSG_RESULT(yes)
1059 AC_DEFINE(HAVE_BIO_RW_FAILFAST_DTD, 1,
1060 - [BIO_RW_FAILFAST_* are defined])
1061 + [BIO_RW_FAILFAST_* are defined])
1062 ],[
1063 AC_MSG_RESULT(no)
1064 ])
1065 ])
1066
1067 -AC_DEFUN([ZFS_AC_KERNEL_REQ_FAILFAST_MASK], [
1068 - AC_MSG_CHECKING([whether REQ_FAILFAST_MASK is defined])
1069 - ZFS_LINUX_TRY_COMPILE([
1070 +AC_DEFUN([ZFS_AC_KERNEL_SRC_REQ_FAILFAST_MASK], [
1071 + ZFS_LINUX_TEST_SRC([bio_failfast_mask], [
1072 #include <linux/bio.h>
1073 ],[
1074 int flags __attribute__ ((unused));
1075 flags = REQ_FAILFAST_MASK;
1076 - ],[
1077 + ])
1078 +])
1079 +
1080 +AC_DEFUN([ZFS_AC_KERNEL_REQ_FAILFAST_MASK], [
1081 + AC_MSG_CHECKING([whether REQ_FAILFAST_MASK is defined])
1082 + ZFS_LINUX_TEST_RESULT([bio_failfast_mask], [
1083 AC_MSG_RESULT(yes)
1084 AC_DEFINE(HAVE_REQ_FAILFAST_MASK, 1,
1085 - [REQ_FAILFAST_MASK is defined])
1086 + [REQ_FAILFAST_MASK is defined])
1087 ],[
1088 AC_MSG_RESULT(no)
1089 ])
1090 ])
1091 +
1092 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_FAILFAST], [
1093 + ZFS_AC_KERNEL_SRC_BIO_FAILFAST_DTD
1094 + ZFS_AC_KERNEL_SRC_REQ_FAILFAST_MASK
1095 +])
1096 +
1097 +AC_DEFUN([ZFS_AC_KERNEL_BIO_FAILFAST], [
1098 + ZFS_AC_KERNEL_BIO_FAILFAST_DTD
1099 + ZFS_AC_KERNEL_REQ_FAILFAST_MASK
1100 +])
1101 diff --git a/config/kernel-bio-op.m4 b/config/kernel-bio-op.m4
1102 index 8299e490c..1f2d23791 100644
1103 --- a/config/kernel-bio-op.m4
1104 +++ b/config/kernel-bio-op.m4
1105 @@ -5,13 +5,43 @@ dnl # The bio_op() helper was introduced as a replacement for explicitly
1106 dnl # checking the bio->bi_rw flags. The following checks are used to
1107 dnl # detect if a specific operation is supported.
1108 dnl #
1109 -AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_DISCARD], [
1110 - AC_MSG_CHECKING([whether REQ_OP_DISCARD is defined])
1111 - ZFS_LINUX_TRY_COMPILE([
1112 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_OPS], [
1113 + ZFS_LINUX_TEST_SRC([req_op_discard], [
1114 #include <linux/blk_types.h>
1115 ],[
1116 int op __attribute__ ((unused)) = REQ_OP_DISCARD;
1117 + ])
1118 +
1119 + ZFS_LINUX_TEST_SRC([req_op_secure_erase], [
1120 + #include <linux/blk_types.h>
1121 ],[
1122 + int op __attribute__ ((unused)) = REQ_OP_SECURE_ERASE;
1123 + ])
1124 +
1125 + ZFS_LINUX_TEST_SRC([req_op_flush], [
1126 + #include <linux/blk_types.h>
1127 + ],[
1128 + int op __attribute__ ((unused)) = REQ_OP_FLUSH;
1129 + ])
1130 +
1131 + ZFS_LINUX_TEST_SRC([bio_bi_opf], [
1132 + #include <linux/bio.h>
1133 + ],[
1134 + struct bio bio __attribute__ ((unused));
1135 + bio.bi_opf = 0;
1136 + ])
1137 +
1138 + ZFS_LINUX_TEST_SRC([bio_set_op_attrs], [
1139 + #include <linux/bio.h>
1140 + ],[
1141 + struct bio *bio __attribute__ ((unused)) = NULL;
1142 + bio_set_op_attrs(bio, 0, 0);
1143 + ])
1144 +])
1145 +
1146 +AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_DISCARD], [
1147 + AC_MSG_CHECKING([whether REQ_OP_DISCARD is defined])
1148 + ZFS_LINUX_TEST_RESULT([req_op_discard], [
1149 AC_MSG_RESULT(yes)
1150 AC_DEFINE(HAVE_REQ_OP_DISCARD, 1,
1151 [REQ_OP_DISCARD is defined])
1152 @@ -22,11 +52,7 @@ AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_DISCARD], [
1153
1154 AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_SECURE_ERASE], [
1155 AC_MSG_CHECKING([whether REQ_OP_SECURE_ERASE is defined])
1156 - ZFS_LINUX_TRY_COMPILE([
1157 - #include <linux/blk_types.h>
1158 - ],[
1159 - int op __attribute__ ((unused)) = REQ_OP_SECURE_ERASE;
1160 - ],[
1161 + ZFS_LINUX_TEST_RESULT([req_op_secure_erase], [
1162 AC_MSG_RESULT(yes)
1163 AC_DEFINE(HAVE_REQ_OP_SECURE_ERASE, 1,
1164 [REQ_OP_SECURE_ERASE is defined])
1165 @@ -38,14 +64,9 @@ AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_SECURE_ERASE], [
1166
1167 AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_FLUSH], [
1168 AC_MSG_CHECKING([whether REQ_OP_FLUSH is defined])
1169 - ZFS_LINUX_TRY_COMPILE([
1170 - #include <linux/blk_types.h>
1171 - ],[
1172 - int op __attribute__ ((unused)) = REQ_OP_FLUSH;
1173 - ],[
1174 + ZFS_LINUX_TEST_RESULT([req_op_flush], [
1175 AC_MSG_RESULT(yes)
1176 - AC_DEFINE(HAVE_REQ_OP_FLUSH, 1,
1177 - [REQ_OP_FLUSH is defined])
1178 + AC_DEFINE(HAVE_REQ_OP_FLUSH, 1, [REQ_OP_FLUSH is defined])
1179 ],[
1180 AC_MSG_RESULT(no)
1181 ])
1182 @@ -53,12 +74,7 @@ AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_FLUSH], [
1183
1184 AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_OPF], [
1185 AC_MSG_CHECKING([whether bio->bi_opf is defined])
1186 - ZFS_LINUX_TRY_COMPILE([
1187 - #include <linux/bio.h>
1188 - ],[
1189 - struct bio bio __attribute__ ((unused));
1190 - bio.bi_opf = 0;
1191 - ],[
1192 + ZFS_LINUX_TEST_RESULT([bio_bi_opf], [
1193 AC_MSG_RESULT(yes)
1194 AC_DEFINE(HAVE_BIO_BI_OPF, 1, [bio->bi_opf is defined])
1195 ],[
1196 @@ -68,13 +84,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_OPF], [
1197
1198 AC_DEFUN([ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS], [
1199 AC_MSG_CHECKING([whether bio_set_op_attrs is available])
1200 - ZFS_LINUX_TRY_COMPILE([
1201 - #include <linux/bio.h>
1202 - ],[
1203 - struct bio *bio __attribute__ ((unused)) = NULL;
1204 -
1205 - bio_set_op_attrs(bio, 0, 0);
1206 - ],[
1207 + ZFS_LINUX_TEST_RESULT([bio_set_op_attrs], [
1208 AC_MSG_RESULT(yes)
1209 AC_DEFINE(HAVE_BIO_SET_OP_ATTRS, 1,
1210 [bio_set_op_attrs is available])
1211 @@ -82,3 +92,11 @@ AC_DEFUN([ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS], [
1212 AC_MSG_RESULT(no)
1213 ])
1214 ])
1215 +
1216 +AC_DEFUN([ZFS_AC_KERNEL_BIO_OPS], [
1217 + ZFS_AC_KERNEL_REQ_OP_DISCARD
1218 + ZFS_AC_KERNEL_REQ_OP_SECURE_ERASE
1219 + ZFS_AC_KERNEL_REQ_OP_FLUSH
1220 + ZFS_AC_KERNEL_BIO_BI_OPF
1221 + ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS
1222 +])
1223 diff --git a/config/kernel-bio-rw-barrier.m4 b/config/kernel-bio-rw-barrier.m4
1224 index bcf0f7ea0..f667d4884 100644
1225 --- a/config/kernel-bio-rw-barrier.m4
1226 +++ b/config/kernel-bio-rw-barrier.m4
1227 @@ -3,20 +3,25 @@ dnl # Interface for issuing a discard bio:
1228 dnl # 2.6.28-2.6.35: BIO_RW_BARRIER
1229 dnl # 2.6.36-3.x: REQ_BARRIER
1230 dnl #
1231 -
1232 +dnl #
1233 dnl # Since REQ_BARRIER is a preprocessor definition, there is no need for an
1234 dnl # autotools check for it. Also, REQ_BARRIER existed in the request layer
1235 dnl # until torvalds/linux@7b6d91daee5cac6402186ff224c3af39d79f4a0e unified the
1236 dnl # request layer and bio layer flags, so it would be wrong to assume that
1237 dnl # the APIs are mutually exclusive contrary to the typical case.
1238 -AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_BARRIER], [
1239 - AC_MSG_CHECKING([whether BIO_RW_BARRIER is defined])
1240 - ZFS_LINUX_TRY_COMPILE([
1241 +dnl #
1242 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_BARRIER], [
1243 + ZFS_LINUX_TEST_SRC([bio_rw_barrier], [
1244 #include <linux/bio.h>
1245 ],[
1246 int flags __attribute__ ((unused));
1247 flags = BIO_RW_BARRIER;
1248 - ],[
1249 + ])
1250 +])
1251 +
1252 +AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_BARRIER], [
1253 + AC_MSG_CHECKING([whether BIO_RW_BARRIER is defined])
1254 + ZFS_LINUX_TEST_RESULT([bio_rw_barrier], [
1255 AC_MSG_RESULT(yes)
1256 AC_DEFINE(HAVE_BIO_RW_BARRIER, 1, [BIO_RW_BARRIER is defined])
1257 ],[
1258 diff --git a/config/kernel-bio-rw-discard.m4 b/config/kernel-bio-rw-discard.m4
1259 index 0554b9a9d..34a89279c 100644
1260 --- a/config/kernel-bio-rw-discard.m4
1261 +++ b/config/kernel-bio-rw-discard.m4
1262 @@ -3,20 +3,25 @@ dnl # Interface for issuing a discard bio:
1263 dnl # 2.6.28-2.6.35: BIO_RW_DISCARD
1264 dnl # 2.6.36-3.x: REQ_DISCARD
1265 dnl #
1266 -
1267 +dnl #
1268 dnl # Since REQ_DISCARD is a preprocessor definition, there is no need for an
1269 dnl # autotools check for it. Also, REQ_DISCARD existed in the request layer
1270 dnl # until torvalds/linux@7b6d91daee5cac6402186ff224c3af39d79f4a0e unified the
1271 dnl # request layer and bio layer flags, so it would be wrong to assume that
1272 dnl # the APIs are mutually exclusive contrary to the typical case.
1273 -AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_DISCARD], [
1274 - AC_MSG_CHECKING([whether BIO_RW_DISCARD is defined])
1275 - ZFS_LINUX_TRY_COMPILE([
1276 +dnl #
1277 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_DISCARD], [
1278 + ZFS_LINUX_TEST_SRC([bio_rw_discard], [
1279 #include <linux/bio.h>
1280 ],[
1281 int flags __attribute__ ((unused));
1282 flags = BIO_RW_DISCARD;
1283 - ],[
1284 + ])
1285 +])
1286 +
1287 +AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_DISCARD], [
1288 + AC_MSG_CHECKING([whether BIO_RW_DISCARD is defined])
1289 + ZFS_LINUX_TEST_RESULT([bio_rw_discard], [
1290 AC_MSG_RESULT(yes)
1291 AC_DEFINE(HAVE_BIO_RW_DISCARD, 1, [BIO_RW_DISCARD is defined])
1292 ],[
1293 diff --git a/config/kernel-bio_set_dev.m4 b/config/kernel-bio_set_dev.m4
1294 index 71d47a893..b8e13f35a 100644
1295 --- a/config/kernel-bio_set_dev.m4
1296 +++ b/config/kernel-bio_set_dev.m4
1297 @@ -3,51 +3,38 @@ dnl # Linux 4.14 API,
1298 dnl #
1299 dnl # The bio_set_dev() helper macro was introduced as part of the transition
1300 dnl # to have struct gendisk in struct bio.
1301 -dnl #
1302 -AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV_MACRO], [
1303 - AC_MSG_CHECKING([whether bio_set_dev() exists])
1304 - ZFS_LINUX_TRY_COMPILE([
1305 - #include <linux/bio.h>
1306 - #include <linux/fs.h>
1307 - ],[
1308 - struct block_device *bdev = NULL;
1309 - struct bio *bio = NULL;
1310 - bio_set_dev(bio, bdev);
1311 - ],[
1312 - AC_MSG_RESULT(yes)
1313 - AC_DEFINE(HAVE_BIO_SET_DEV, 1, [bio_set_dev() exists])
1314 - ],[
1315 - AC_MSG_RESULT(no)
1316 - ])
1317 -])
1318 -
1319 dnl #
1320 dnl # Linux 5.0 API,
1321 dnl #
1322 dnl # The bio_set_dev() helper macro was updated to internally depend on
1323 dnl # bio_associate_blkg() symbol which is exported GPL-only.
1324 dnl #
1325 -AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV_GPL_ONLY], [
1326 - AC_MSG_CHECKING([whether bio_set_dev() is GPL-only])
1327 - ZFS_LINUX_TRY_COMPILE([
1328 - #include <linux/module.h>
1329 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_SET_DEV], [
1330 + ZFS_LINUX_TEST_SRC([bio_set_dev], [
1331 #include <linux/bio.h>
1332 #include <linux/fs.h>
1333 - MODULE_LICENSE("$ZFS_META_LICENSE");
1334 ],[
1335 struct block_device *bdev = NULL;
1336 struct bio *bio = NULL;
1337 bio_set_dev(bio, bdev);
1338 - ],[
1339 - AC_MSG_RESULT(no)
1340 - ],[
1341 - AC_MSG_RESULT(yes)
1342 - AC_DEFINE(HAVE_BIO_SET_DEV_GPL_ONLY, 1,
1343 - [bio_set_dev() GPL-only])
1344 - ])
1345 + ], [], [$ZFS_META_LICENSE])
1346 ])
1347
1348 AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [
1349 - ZFS_AC_KERNEL_BIO_SET_DEV_MACRO
1350 - ZFS_AC_KERNEL_BIO_SET_DEV_GPL_ONLY
1351 + AC_MSG_CHECKING([whether bio_set_dev() is available])
1352 + ZFS_LINUX_TEST_RESULT([bio_set_dev], [
1353 + AC_MSG_RESULT(yes)
1354 + AC_DEFINE(HAVE_BIO_SET_DEV, 1, [bio_set_dev() is available])
1355 +
1356 + AC_MSG_CHECKING([whether bio_set_dev() is GPL-only])
1357 + ZFS_LINUX_TEST_RESULT([bio_set_dev_license], [
1358 + AC_MSG_RESULT(no)
1359 + ],[
1360 + AC_MSG_RESULT(yes)
1361 + AC_DEFINE(HAVE_BIO_SET_DEV_GPL_ONLY, 1,
1362 + [bio_set_dev() GPL-only])
1363 + ])
1364 + ],[
1365 + AC_MSG_RESULT(no)
1366 + ])
1367 ])
1368 diff --git a/config/kernel-blk-queue-bdi.m4 b/config/kernel-blk-queue-bdi.m4
1369 index 816471166..28241c494 100644
1370 --- a/config/kernel-blk-queue-bdi.m4
1371 +++ b/config/kernel-blk-queue-bdi.m4
1372 @@ -2,15 +2,19 @@ dnl #
1373 dnl # 2.6.32 - 4.11, statically allocated bdi in request_queue
1374 dnl # 4.12 - x.y, dynamically allocated bdi in request_queue
1375 dnl #
1376 -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [
1377 - AC_MSG_CHECKING([whether blk_queue bdi is dynamic])
1378 - ZFS_LINUX_TRY_COMPILE([
1379 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI], [
1380 + ZFS_LINUX_TEST_SRC([blk_queue_bdi], [
1381 #include <linux/blkdev.h>
1382 ],[
1383 struct request_queue q;
1384 struct backing_dev_info bdi;
1385 q.backing_dev_info = &bdi;
1386 - ],[
1387 + ])
1388 +])
1389 +
1390 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [
1391 + AC_MSG_CHECKING([whether blk_queue bdi is dynamic])
1392 + ZFS_LINUX_TEST_RESULT([blk_queue_bdi], [
1393 AC_MSG_RESULT(yes)
1394 AC_DEFINE(HAVE_BLK_QUEUE_BDI_DYNAMIC, 1,
1395 [blk queue backing_dev_info is dynamic])
1396 diff --git a/config/kernel-blk-queue-discard.m4 b/config/kernel-blk-queue-discard.m4
1397 index addbba814..85a29356d 100644
1398 --- a/config/kernel-blk-queue-discard.m4
1399 +++ b/config/kernel-blk-queue-discard.m4
1400 @@ -2,16 +2,19 @@ dnl #
1401 dnl # 2.6.32 - 4.x API,
1402 dnl # blk_queue_discard()
1403 dnl #
1404 -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [
1405 - AC_MSG_CHECKING([whether blk_queue_discard() is available])
1406 - ZFS_LINUX_TRY_COMPILE([
1407 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [
1408 + ZFS_LINUX_TEST_SRC([blk_queue_discard], [
1409 #include <linux/blkdev.h>
1410 ],[
1411 struct request_queue *q __attribute__ ((unused)) = NULL;
1412 int value __attribute__ ((unused));
1413 -
1414 value = blk_queue_discard(q);
1415 - ],[
1416 + ])
1417 +])
1418 +
1419 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [
1420 + AC_MSG_CHECKING([whether blk_queue_discard() is available])
1421 + ZFS_LINUX_TEST_RESULT([blk_queue_discard], [
1422 AC_MSG_RESULT(yes)
1423 AC_DEFINE(HAVE_BLK_QUEUE_DISCARD, 1,
1424 [blk_queue_discard() is available])
1425 @@ -30,16 +33,27 @@ dnl #
1426 dnl # 2.6.x - 2.6.35 API,
1427 dnl # Unsupported by kernel
1428 dnl #
1429 -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [
1430 - AC_MSG_CHECKING([whether blk_queue_secure_erase() is available])
1431 - ZFS_LINUX_TRY_COMPILE([
1432 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [
1433 + ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [
1434 #include <linux/blkdev.h>
1435 ],[
1436 struct request_queue *q __attribute__ ((unused)) = NULL;
1437 int value __attribute__ ((unused));
1438 -
1439 value = blk_queue_secure_erase(q);
1440 + ])
1441 +
1442 + ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [
1443 + #include <linux/blkdev.h>
1444 ],[
1445 + struct request_queue *q __attribute__ ((unused)) = NULL;
1446 + int value __attribute__ ((unused));
1447 + value = blk_queue_secdiscard(q);
1448 + ])
1449 +])
1450 +
1451 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [
1452 + AC_MSG_CHECKING([whether blk_queue_secure_erase() is available])
1453 + ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [
1454 AC_MSG_RESULT(yes)
1455 AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1,
1456 [blk_queue_secure_erase() is available])
1457 @@ -47,14 +61,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [
1458 AC_MSG_RESULT(no)
1459
1460 AC_MSG_CHECKING([whether blk_queue_secdiscard() is available])
1461 - ZFS_LINUX_TRY_COMPILE([
1462 - #include <linux/blkdev.h>
1463 - ],[
1464 - struct request_queue *q __attribute__ ((unused)) = NULL;
1465 - int value __attribute__ ((unused));
1466 -
1467 - value = blk_queue_secdiscard(q);
1468 - ],[
1469 + ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [
1470 AC_MSG_RESULT(yes)
1471 AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1,
1472 [blk_queue_secdiscard() is available])
1473 diff --git a/config/kernel-blk-queue-flags.m4 b/config/kernel-blk-queue-flags.m4
1474 index b570245c7..9d4dfc159 100644
1475 --- a/config/kernel-blk-queue-flags.m4
1476 +++ b/config/kernel-blk-queue-flags.m4
1477 @@ -3,36 +3,54 @@ dnl # API change
1478 dnl # https://github.com/torvalds/linux/commit/8814ce8
1479 dnl # Introduction of blk_queue_flag_set and blk_queue_flag_clear
1480 dnl #
1481 -
1482 -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET], [
1483 - AC_MSG_CHECKING([whether blk_queue_flag_set() exists])
1484 - ZFS_LINUX_TRY_COMPILE([
1485 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET], [
1486 + ZFS_LINUX_TEST_SRC([blk_queue_flag_set], [
1487 #include <linux/kernel.h>
1488 #include <linux/blkdev.h>
1489 ],[
1490 struct request_queue *q = NULL;
1491 blk_queue_flag_set(0, q);
1492 - ],[
1493 + ])
1494 +])
1495 +
1496 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET], [
1497 + AC_MSG_CHECKING([whether blk_queue_flag_set() exists])
1498 + ZFS_LINUX_TEST_RESULT([blk_queue_flag_set], [
1499 AC_MSG_RESULT(yes)
1500 - AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1, [blk_queue_flag_set() exists])
1501 + AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1,
1502 + [blk_queue_flag_set() exists])
1503 ],[
1504 AC_MSG_RESULT(no)
1505 ])
1506 ])
1507
1508 -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR], [
1509 - AC_MSG_CHECKING([whether blk_queue_flag_clear() exists])
1510 - ZFS_LINUX_TRY_COMPILE([
1511 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR], [
1512 + ZFS_LINUX_TEST_SRC([blk_queue_flag_clear], [
1513 #include <linux/kernel.h>
1514 #include <linux/blkdev.h>
1515 ],[
1516 struct request_queue *q = NULL;
1517 blk_queue_flag_clear(0, q);
1518 - ],[
1519 + ])
1520 +])
1521
1522 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR], [
1523 + AC_MSG_CHECKING([whether blk_queue_flag_clear() exists])
1524 + ZFS_LINUX_TEST_RESULT([blk_queue_flag_clear], [
1525 AC_MSG_RESULT(yes)
1526 - AC_DEFINE(HAVE_BLK_QUEUE_FLAG_CLEAR, 1, [blk_queue_flag_clear() exists])
1527 + AC_DEFINE(HAVE_BLK_QUEUE_FLAG_CLEAR, 1,
1528 + [blk_queue_flag_clear() exists])
1529 ],[
1530 AC_MSG_RESULT(no)
1531 ])
1532 ])
1533 +
1534 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAGS], [
1535 + ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET
1536 + ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR
1537 +])
1538 +
1539 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAGS], [
1540 + ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET
1541 + ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR
1542 +])
1543 diff --git a/config/kernel-blk-queue-flush.m4 b/config/kernel-blk-queue-flush.m4
1544 index 1baab83a4..b546d9400 100644
1545 --- a/config/kernel-blk-queue-flush.m4
1546 +++ b/config/kernel-blk-queue-flush.m4
1547 @@ -9,35 +9,37 @@ dnl # there we implement our own compatibility function, otherwise
1548 dnl # we use the function. The hope is that long term this function
1549 dnl # will be opened up.
1550 dnl #
1551 -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
1552 - AC_MSG_CHECKING([whether blk_queue_flush() is available])
1553 - tmp_flags="$EXTRA_KCFLAGS"
1554 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
1555 - ZFS_LINUX_TRY_COMPILE([
1556 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [
1557 + ZFS_LINUX_TEST_SRC([blk_queue_flush], [
1558 #include <linux/blkdev.h>
1559 - ],[
1560 + ], [
1561 struct request_queue *q = NULL;
1562 (void) blk_queue_flush(q, REQ_FLUSH);
1563 - ],[
1564 + ], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE])
1565 +
1566 + ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [
1567 + #include <linux/kernel.h>
1568 + #include <linux/blkdev.h>
1569 + ], [
1570 + struct request_queue *q = NULL;
1571 + blk_queue_write_cache(q, true, true);
1572 + ], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE])
1573 +])
1574 +
1575 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
1576 + AC_MSG_CHECKING([whether blk_queue_flush() is available])
1577 + ZFS_LINUX_TEST_RESULT([blk_queue_flush], [
1578 AC_MSG_RESULT(yes)
1579 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1,
1580 - [blk_queue_flush() is available])
1581 + [blk_queue_flush() is available])
1582
1583 AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only])
1584 - ZFS_LINUX_TRY_COMPILE([
1585 - #include <linux/module.h>
1586 - #include <linux/blkdev.h>
1587 -
1588 - MODULE_LICENSE("$ZFS_META_LICENSE");
1589 - ],[
1590 - struct request_queue *q = NULL;
1591 - (void) blk_queue_flush(q, REQ_FLUSH);
1592 - ],[
1593 + ZFS_LINUX_TEST_RESULT([blk_queue_flush_license], [
1594 AC_MSG_RESULT(no)
1595 ],[
1596 AC_MSG_RESULT(yes)
1597 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1,
1598 - [blk_queue_flush() is GPL-only])
1599 + [blk_queue_flush() is GPL-only])
1600 ])
1601 ],[
1602 AC_MSG_RESULT(no)
1603 @@ -48,38 +50,20 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
1604 dnl # Replace blk_queue_flush with blk_queue_write_cache
1605 dnl #
1606 AC_MSG_CHECKING([whether blk_queue_write_cache() exists])
1607 - ZFS_LINUX_TRY_COMPILE([
1608 - #include <linux/kernel.h>
1609 - #include <linux/blkdev.h>
1610 -
1611 - ],[
1612 - struct request_queue *q = NULL;
1613 - blk_queue_write_cache(q, true, true);
1614 - ],[
1615 + ZFS_LINUX_TEST_RESULT([blk_queue_write_cache], [
1616 AC_MSG_RESULT(yes)
1617 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1,
1618 - [blk_queue_write_cache() exists])
1619 + [blk_queue_write_cache() exists])
1620
1621 AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only])
1622 - ZFS_LINUX_TRY_COMPILE([
1623 - #include <linux/kernel.h>
1624 - #include <linux/module.h>
1625 - #include <linux/blkdev.h>
1626 -
1627 - MODULE_LICENSE("$ZFS_META_LICENSE");
1628 - ],[
1629 - struct request_queue *q = NULL;
1630 - blk_queue_write_cache(q, true, true);
1631 - ],[
1632 + ZFS_LINUX_TEST_RESULT([blk_queue_write_cache_license], [
1633 AC_MSG_RESULT(no)
1634 ],[
1635 AC_MSG_RESULT(yes)
1636 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY, 1,
1637 - [blk_queue_write_cache() is GPL-only])
1638 + [blk_queue_write_cache() is GPL-only])
1639 ])
1640 ],[
1641 AC_MSG_RESULT(no)
1642 ])
1643 -
1644 - EXTRA_KCFLAGS="$tmp_flags"
1645 ])
1646 diff --git a/config/kernel-blk-queue-max-hw-sectors.m4 b/config/kernel-blk-queue-max-hw-sectors.m4
1647 index 2f5515dc6..7387f84de 100644
1648 --- a/config/kernel-blk-queue-max-hw-sectors.m4
1649 +++ b/config/kernel-blk-queue-max-hw-sectors.m4
1650 @@ -2,21 +2,22 @@ dnl #
1651 dnl # 2.6.34 API change
1652 dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors().
1653 dnl #
1654 -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [
1655 - AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available])
1656 - tmp_flags="$EXTRA_KCFLAGS"
1657 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
1658 - ZFS_LINUX_TRY_COMPILE([
1659 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS], [
1660 + ZFS_LINUX_TEST_SRC([blk_queue_max_hw_sectors], [
1661 #include <linux/blkdev.h>
1662 - ],[
1663 + ], [
1664 struct request_queue *q = NULL;
1665 (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS);
1666 - ],[
1667 + ], [$NO_UNUSED_BUT_SET_VARIABLE])
1668 +])
1669 +
1670 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [
1671 + AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available])
1672 + ZFS_LINUX_TEST_RESULT([blk_queue_max_hw_sectors], [
1673 AC_MSG_RESULT(yes)
1674 AC_DEFINE(HAVE_BLK_QUEUE_MAX_HW_SECTORS, 1,
1675 - [blk_queue_max_hw_sectors() is available])
1676 + [blk_queue_max_hw_sectors() is available])
1677 ],[
1678 AC_MSG_RESULT(no)
1679 ])
1680 - EXTRA_KCFLAGS="$tmp_flags"
1681 ])
1682 diff --git a/config/kernel-blk-queue-max-segments.m4 b/config/kernel-blk-queue-max-segments.m4
1683 index b2a40423a..1e4092df9 100644
1684 --- a/config/kernel-blk-queue-max-segments.m4
1685 +++ b/config/kernel-blk-queue-max-segments.m4
1686 @@ -3,21 +3,22 @@ dnl # 2.6.34 API change
1687 dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments()
1688 dnl # and blk_queue_max_phys_segments().
1689 dnl #
1690 -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [
1691 - AC_MSG_CHECKING([whether blk_queue_max_segments() is available])
1692 - tmp_flags="$EXTRA_KCFLAGS"
1693 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
1694 - ZFS_LINUX_TRY_COMPILE([
1695 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [
1696 + ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [
1697 #include <linux/blkdev.h>
1698 - ],[
1699 + ], [
1700 struct request_queue *q = NULL;
1701 (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS);
1702 - ],[
1703 + ], [$NO_UNUSED_BUT_SET_VARIABLE])
1704 +])
1705 +
1706 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [
1707 + AC_MSG_CHECKING([whether blk_queue_max_segments() is available])
1708 + ZFS_LINUX_TEST_RESULT([blk_queue_max_segments], [
1709 AC_MSG_RESULT(yes)
1710 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
1711 - [blk_queue_max_segments() is available])
1712 - ],[
1713 + [blk_queue_max_segments() is available])
1714 + ], [
1715 AC_MSG_RESULT(no)
1716 ])
1717 - EXTRA_KCFLAGS="$tmp_flags"
1718 ])
1719 diff --git a/config/kernel-blk-queue-unplug.m4 b/config/kernel-blk-queue-unplug.m4
1720 index 075fbccd1..f5d1814b8 100644
1721 --- a/config/kernel-blk-queue-unplug.m4
1722 +++ b/config/kernel-blk-queue-unplug.m4
1723 @@ -2,43 +2,53 @@ dnl #
1724 dnl # 2.6.32-2.6.35 API - The BIO_RW_UNPLUG enum can be used as a hint
1725 dnl # to unplug the queue.
1726 dnl #
1727 -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BIO_RW_UNPLUG], [
1728 - AC_MSG_CHECKING([whether the BIO_RW_UNPLUG enum is available])
1729 - tmp_flags="$EXTRA_KCFLAGS"
1730 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
1731 - ZFS_LINUX_TRY_COMPILE([
1732 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_UNPLUG], [
1733 + ZFS_LINUX_TEST_SRC([blk_queue_bio_rw_unplug], [
1734 #include <linux/blkdev.h>
1735 ],[
1736 - extern enum bio_rw_flags rw;
1737 + enum bio_rw_flags rw __attribute__ ((unused)) = BIO_RW_UNPLUG;
1738 + ])
1739 +])
1740
1741 - rw = BIO_RW_UNPLUG;
1742 - ],[
1743 +AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_UNPLUG], [
1744 + AC_MSG_CHECKING([whether the BIO_RW_UNPLUG enum is available])
1745 + ZFS_LINUX_TEST_RESULT([blk_queue_bio_rw_unplug], [
1746 AC_MSG_RESULT(yes)
1747 AC_DEFINE(HAVE_BLK_QUEUE_HAVE_BIO_RW_UNPLUG, 1,
1748 - [BIO_RW_UNPLUG is available])
1749 + [BIO_RW_UNPLUG is available])
1750 ],[
1751 AC_MSG_RESULT(no)
1752 ])
1753 - EXTRA_KCFLAGS="$tmp_flags"
1754 ])
1755
1756 -AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BLK_PLUG], [
1757 - AC_MSG_CHECKING([whether struct blk_plug is available])
1758 - tmp_flags="$EXTRA_KCFLAGS"
1759 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
1760 - ZFS_LINUX_TRY_COMPILE([
1761 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_PLUG], [
1762 + ZFS_LINUX_TEST_SRC([blk_plug], [
1763 #include <linux/blkdev.h>
1764 ],[
1765 - struct blk_plug plug;
1766 + struct blk_plug plug __attribute__ ((unused));
1767
1768 blk_start_plug(&plug);
1769 blk_finish_plug(&plug);
1770 - ],[
1771 + ])
1772 +])
1773 +
1774 +AC_DEFUN([ZFS_AC_KERNEL_BLK_PLUG], [
1775 + AC_MSG_CHECKING([whether struct blk_plug is available])
1776 + ZFS_LINUX_TEST_RESULT([blk_plug], [
1777 AC_MSG_RESULT(yes)
1778 AC_DEFINE(HAVE_BLK_QUEUE_HAVE_BLK_PLUG, 1,
1779 - [struct blk_plug is available])
1780 + [struct blk_plug is available])
1781 ],[
1782 AC_MSG_RESULT(no)
1783 ])
1784 - EXTRA_KCFLAGS="$tmp_flags"
1785 +])
1786 +
1787 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG], [
1788 + ZFS_AC_KERNEL_SRC_BIO_RW_UNPLUG
1789 + ZFS_AC_KERNEL_SRC_BLK_PLUG
1790 +])
1791 +
1792 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_PLUG], [
1793 + ZFS_AC_KERNEL_BIO_RW_UNPLUG
1794 + ZFS_AC_KERNEL_BLK_PLUG
1795 ])
1796 diff --git a/config/kernel-blkdev-get-by-path.m4 b/config/kernel-blkdev-get-by-path.m4
1797 index 40ecc06b6..fb0cea6af 100644
1798 --- a/config/kernel-blkdev-get-by-path.m4
1799 +++ b/config/kernel-blkdev-get-by-path.m4
1800 @@ -3,16 +3,21 @@ dnl # 2.6.38 API change
1801 dnl # open_bdev_exclusive() changed to blkdev_get_by_path()
1802 dnl # close_bdev_exclusive() changed to blkdev_put()
1803 dnl #
1804 -AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH],
1805 - [AC_MSG_CHECKING([whether blkdev_get_by_path() is available])
1806 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
1807 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH], [
1808 + ZFS_LINUX_TEST_SRC([blkdev_get_by_path], [
1809 #include <linux/fs.h>
1810 ], [
1811 blkdev_get_by_path(NULL, 0, NULL);
1812 - ], [blkdev_get_by_path], [fs/block_dev.c], [
1813 + ])
1814 +])
1815 +
1816 +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [
1817 + AC_MSG_CHECKING([whether blkdev_get_by_path() is available])
1818 + ZFS_LINUX_TEST_RESULT_SYMBOL([blkdev_get_by_path],
1819 + [blkdev_get_by_path], [fs/block_dev.c], [
1820 AC_MSG_RESULT(yes)
1821 AC_DEFINE(HAVE_BLKDEV_GET_BY_PATH, 1,
1822 - [blkdev_get_by_path() is available])
1823 + [blkdev_get_by_path() is available])
1824 ], [
1825 AC_MSG_RESULT(no)
1826 ])
1827 diff --git a/config/kernel-blkdev-reread-part.m4 b/config/kernel-blkdev-reread-part.m4
1828 index 5664769a3..1bf1e7c3a 100644
1829 --- a/config/kernel-blkdev-reread-part.m4
1830 +++ b/config/kernel-blkdev-reread-part.m4
1831 @@ -2,16 +2,20 @@ dnl #
1832 dnl # 4.1 API, exported blkdev_reread_part() symbol, backported to the
1833 dnl # 3.10.0 CentOS 7.x enterprise kernels.
1834 dnl #
1835 -AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_REREAD_PART], [
1836 - AC_MSG_CHECKING([whether blkdev_reread_part() is available])
1837 - ZFS_LINUX_TRY_COMPILE([
1838 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART], [
1839 + ZFS_LINUX_TEST_SRC([blkdev_reread_part], [
1840 #include <linux/fs.h>
1841 ], [
1842 struct block_device *bdev = NULL;
1843 int error;
1844
1845 error = blkdev_reread_part(bdev);
1846 - ], [
1847 + ])
1848 +])
1849 +
1850 +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_REREAD_PART], [
1851 + AC_MSG_CHECKING([whether blkdev_reread_part() is available])
1852 + ZFS_LINUX_TEST_RESULT([blkdev_reread_part], [
1853 AC_MSG_RESULT(yes)
1854 AC_DEFINE(HAVE_BLKDEV_REREAD_PART, 1,
1855 [blkdev_reread_part() is available])
1856 diff --git a/config/kernel-block-device-operations.m4 b/config/kernel-block-device-operations.m4
1857 index 5f2811c15..c3d5eec52 100644
1858 --- a/config/kernel-block-device-operations.m4
1859 +++ b/config/kernel-block-device-operations.m4
1860 @@ -1,11 +1,8 @@
1861 dnl #
1862 dnl # 2.6.38 API change
1863 dnl #
1864 -AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
1865 - AC_MSG_CHECKING([whether bops->check_events() exists])
1866 - tmp_flags="$EXTRA_KCFLAGS"
1867 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
1868 - ZFS_LINUX_TRY_COMPILE([
1869 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
1870 + ZFS_LINUX_TEST_SRC([block_device_operations_check_events], [
1871 #include <linux/blkdev.h>
1872
1873 unsigned int blk_check_events(struct gendisk *disk,
1874 @@ -15,25 +12,25 @@ AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
1875 bops __attribute__ ((unused)) = {
1876 .check_events = blk_check_events,
1877 };
1878 - ],[
1879 - ],[
1880 + ], [], [$NO_UNUSED_BUT_SET_VARIABLE])
1881 +])
1882 +
1883 +AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
1884 + AC_MSG_CHECKING([whether bops->check_events() exists])
1885 + ZFS_LINUX_TEST_RESULT([block_device_operations_check_events], [
1886 AC_MSG_RESULT(yes)
1887 AC_DEFINE(HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS, 1,
1888 [bops->check_events() exists])
1889 ],[
1890 AC_MSG_RESULT(no)
1891 ])
1892 - EXTRA_KCFLAGS="$tmp_flags"
1893 ])
1894
1895 dnl #
1896 dnl # 3.10.x API change
1897 dnl #
1898 -AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
1899 - AC_MSG_CHECKING([whether bops->release() is void])
1900 - tmp_flags="$EXTRA_KCFLAGS"
1901 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
1902 - ZFS_LINUX_TRY_COMPILE([
1903 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
1904 + ZFS_LINUX_TEST_SRC([block_device_operations_release_void], [
1905 #include <linux/blkdev.h>
1906
1907 void blk_release(struct gendisk *g, fmode_t mode) { return; }
1908 @@ -45,13 +42,26 @@ AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
1909 .ioctl = NULL,
1910 .compat_ioctl = NULL,
1911 };
1912 - ],[
1913 - ],[
1914 - AC_MSG_RESULT(void)
1915 + ], [], [$NO_UNUSED_BUT_SET_VARIABLE])
1916 +])
1917 +
1918 +AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
1919 + AC_MSG_CHECKING([whether bops->release() is void])
1920 + ZFS_LINUX_TEST_RESULT([block_device_operations_release_void], [
1921 + AC_MSG_RESULT(yes)
1922 AC_DEFINE(HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID, 1,
1923 [bops->release() returns void])
1924 ],[
1925 - AC_MSG_RESULT(int)
1926 + AC_MSG_RESULT(no)
1927 ])
1928 - EXTRA_KCFLAGS="$tmp_flags"
1929 +])
1930 +
1931 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS], [
1932 + ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
1933 + ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
1934 +])
1935 +
1936 +AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS], [
1937 + ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
1938 + ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
1939 ])
1940 diff --git a/config/kernel-clear-inode.m4 b/config/kernel-clear-inode.m4
1941 index 8d880fcd8..3f454d7ec 100644
1942 --- a/config/kernel-clear-inode.m4
1943 +++ b/config/kernel-clear-inode.m4
1944 @@ -19,13 +19,18 @@ dnl # Therefore, to ensure we have the correct API we only allow the
1945 dnl # clear_inode() compatibility code to be defined iff the evict_inode()
1946 dnl # functionality is also detected.
1947 dnl #
1948 -AC_DEFUN([ZFS_AC_KERNEL_CLEAR_INODE],
1949 - [AC_MSG_CHECKING([whether clear_inode() is available])
1950 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
1951 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CLEAR_INODE], [
1952 + ZFS_LINUX_TEST_SRC([clear_inode], [
1953 #include <linux/fs.h>
1954 ], [
1955 clear_inode(NULL);
1956 - ], [clear_inode], [fs/inode.c], [
1957 + ])
1958 +])
1959 +
1960 +AC_DEFUN([ZFS_AC_KERNEL_CLEAR_INODE], [
1961 + AC_MSG_CHECKING([whether clear_inode() is available])
1962 + ZFS_LINUX_TEST_RESULT_SYMBOL([clear_inode],
1963 + [clear_inode], [fs/inode.c], [
1964 AC_MSG_RESULT(yes)
1965 AC_DEFINE(HAVE_CLEAR_INODE, 1, [clear_inode() is available])
1966 ], [
1967 diff --git a/config/kernel-commit-metadata.m4 b/config/kernel-commit-metadata.m4
1968 index b66a16fd2..9bc3b6622 100644
1969 --- a/config/kernel-commit-metadata.m4
1970 +++ b/config/kernel-commit-metadata.m4
1971 @@ -4,19 +4,22 @@ dnl # Added eops->commit_metadata() callback to allow the underlying
1972 dnl # filesystem to determine the most efficient way to commit the inode.
1973 dnl # Prior to this the nfs server would issue an explicit fsync().
1974 dnl #
1975 -AC_DEFUN([ZFS_AC_KERNEL_COMMIT_METADATA], [
1976 - AC_MSG_CHECKING([whether eops->commit_metadata() exists])
1977 - ZFS_LINUX_TRY_COMPILE([
1978 +AC_DEFUN([ZFS_AC_KERNEL_SRC_COMMIT_METADATA], [
1979 + ZFS_LINUX_TEST_SRC([export_operations_commit_metadata], [
1980 #include <linux/exportfs.h>
1981 int commit_metadata(struct inode *inode) { return 0; }
1982 static struct export_operations eops __attribute__ ((unused))={
1983 .commit_metadata = commit_metadata,
1984 };
1985 - ],[
1986 - ],[
1987 + ],[])
1988 +])
1989 +
1990 +AC_DEFUN([ZFS_AC_KERNEL_COMMIT_METADATA], [
1991 + AC_MSG_CHECKING([whether eops->commit_metadata() exists])
1992 + ZFS_LINUX_TEST_RESULT([export_operations_commit_metadata], [
1993 AC_MSG_RESULT(yes)
1994 AC_DEFINE(HAVE_COMMIT_METADATA, 1,
1995 - [eops->commit_metadata() exists])
1996 + [eops->commit_metadata() exists])
1997 ],[
1998 AC_MSG_RESULT(no)
1999 ])
2000 diff --git a/config/kernel-config-defined.m4 b/config/kernel-config-defined.m4
2001 new file mode 100644
2002 index 000000000..0ee4231cc
2003 --- /dev/null
2004 +++ b/config/kernel-config-defined.m4
2005 @@ -0,0 +1,183 @@
2006 +dnl #
2007 +dnl # Certain kernel build options are not supported. These must be
2008 +dnl # detected at configure time and cause a build failure. Otherwise
2009 +dnl # modules may be successfully built that behave incorrectly.
2010 +dnl #
2011 +AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [
2012 + AS_IF([test "x$cross_compiling" != xyes], [
2013 + AC_RUN_IFELSE([
2014 + AC_LANG_PROGRAM([
2015 + #include "$LINUX/include/linux/license.h"
2016 + ], [
2017 + return !license_is_gpl_compatible(
2018 + "$ZFS_META_LICENSE");
2019 + ])
2020 + ], [
2021 + AC_DEFINE([ZFS_IS_GPL_COMPATIBLE], [1],
2022 + [Define to 1 if GPL-only symbols can be used])
2023 + ], [
2024 + ])
2025 + ])
2026 +
2027 + ZFS_AC_KERNEL_SRC_CONFIG_THREAD_SIZE
2028 + ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC
2029 + ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS
2030 + ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE
2031 + ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE
2032 +
2033 + AC_MSG_CHECKING([for kernel config option compatibility])
2034 + ZFS_LINUX_TEST_COMPILE_ALL([config])
2035 + AC_MSG_RESULT([done])
2036 +
2037 + ZFS_AC_KERNEL_CONFIG_THREAD_SIZE
2038 + ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC
2039 + ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS
2040 + ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE
2041 + ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE
2042 +])
2043 +
2044 +dnl #
2045 +dnl # Check configured THREAD_SIZE
2046 +dnl #
2047 +dnl # The stack size will vary by architecture, but as of Linux 3.15 on x86_64
2048 +dnl # the default thread stack size was increased to 16K from 8K. Therefore,
2049 +dnl # on newer kernels and some architectures stack usage optimizations can be
2050 +dnl # conditionally applied to improve performance without negatively impacting
2051 +dnl # stability.
2052 +dnl #
2053 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_THREAD_SIZE], [
2054 + ZFS_LINUX_TEST_SRC([config_thread_size], [
2055 + #include <linux/module.h>
2056 + ],[
2057 + #if (THREAD_SIZE < 16384)
2058 + #error "THREAD_SIZE is less than 16K"
2059 + #endif
2060 + ])
2061 +])
2062 +
2063 +AC_DEFUN([ZFS_AC_KERNEL_CONFIG_THREAD_SIZE], [
2064 + AC_MSG_CHECKING([whether kernel was built with 16K or larger stacks])
2065 + ZFS_LINUX_TEST_RESULT([config_thread_size], [
2066 + AC_MSG_RESULT([yes])
2067 + AC_DEFINE(HAVE_LARGE_STACKS, 1, [kernel has large stacks])
2068 + ],[
2069 + AC_MSG_RESULT([no])
2070 + ])
2071 +])
2072 +
2073 +dnl #
2074 +dnl # Check CONFIG_DEBUG_LOCK_ALLOC
2075 +dnl #
2076 +dnl # This is typically only set for debug kernels because it comes with
2077 +dnl # a performance penalty. However, when it is set it maps the non-GPL
2078 +dnl # symbol mutex_lock() to the GPL-only mutex_lock_nested() symbol.
2079 +dnl # This will cause a failure at link time which we'd rather know about
2080 +dnl # at compile time.
2081 +dnl #
2082 +dnl # Since we plan to pursue making mutex_lock_nested() a non-GPL symbol
2083 +dnl # with the upstream community we add a check to detect this case.
2084 +dnl #
2085 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC], [
2086 + ZFS_LINUX_TEST_SRC([config_debug_lock_alloc], [
2087 + #include <linux/mutex.h>
2088 + ],[
2089 + struct mutex lock;
2090 +
2091 + mutex_init(&lock);
2092 + mutex_lock(&lock);
2093 + mutex_unlock(&lock);
2094 + ], [], [$ZFS_META_LICENSE])
2095 +])
2096 +
2097 +AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
2098 + AC_MSG_CHECKING([whether mutex_lock() is GPL-only])
2099 + ZFS_LINUX_TEST_RESULT([config_debug_lock_alloc], [
2100 + AC_MSG_RESULT(no)
2101 + ],[
2102 + AC_MSG_RESULT(yes)
2103 + AC_MSG_ERROR([
2104 + *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
2105 + *** with the CDDL license and will prevent the module linking stage
2106 + *** from succeeding. You must rebuild your kernel without this
2107 + *** option enabled.])
2108 + ])
2109 +])
2110 +
2111 +dnl #
2112 +dnl # Check CONFIG_TRIM_UNUSED_KSYMS
2113 +dnl #
2114 +dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled.
2115 +dnl #
2116 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS], [
2117 + ZFS_LINUX_TEST_SRC([config_trim_unusued_ksyms], [
2118 + #if defined(CONFIG_TRIM_UNUSED_KSYMS)
2119 + #error CONFIG_TRIM_UNUSED_KSYMS not defined
2120 + #endif
2121 + ],[])
2122 +])
2123 +
2124 +AC_DEFUN([ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS], [
2125 + AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
2126 + ZFS_LINUX_TEST_RESULT([config_trim_unusued_ksyms], [
2127 + AC_MSG_RESULT([yes])
2128 + ],[
2129 + AC_MSG_RESULT([no])
2130 + AS_IF([test "x$enable_linux_builtin" != xyes], [
2131 + AC_MSG_ERROR([
2132 + *** This kernel has unused symbols trimming enabled, please disable.
2133 + *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
2134 + ])
2135 + ])
2136 +])
2137 +
2138 +dnl #
2139 +dnl # Check CONFIG_ZLIB_INFLATE
2140 +dnl #
2141 +dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
2142 +dnl #
2143 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE], [
2144 + ZFS_LINUX_TEST_SRC([config_zlib_inflate], [
2145 + #if !defined(CONFIG_ZLIB_INFLATE) && \
2146 + !defined(CONFIG_ZLIB_INFLATE_MODULE)
2147 + #error CONFIG_ZLIB_INFLATE not defined
2148 + #endif
2149 + ],[])
2150 +])
2151 +
2152 +AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE], [
2153 + AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
2154 + ZFS_LINUX_TEST_RESULT([config_zlib_inflate], [
2155 + AC_MSG_RESULT([yes])
2156 + ],[
2157 + AC_MSG_RESULT([no])
2158 + AC_MSG_ERROR([
2159 + *** This kernel does not include the required zlib inflate support.
2160 + *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
2161 + ])
2162 +])
2163 +
2164 +dnl #
2165 +dnl # Check CONFIG_ZLIB_DEFLATE
2166 +dnl #
2167 +dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
2168 +dnl #
2169 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE], [
2170 + ZFS_LINUX_TEST_SRC([config_zlib_deflate], [
2171 + #if !defined(CONFIG_ZLIB_DEFLATE) && \
2172 + !defined(CONFIG_ZLIB_DEFLATE_MODULE)
2173 + #error CONFIG_ZLIB_DEFLATE not defined
2174 + #endif
2175 + ],[])
2176 +])
2177 +
2178 +AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE], [
2179 + AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
2180 + ZFS_LINUX_TEST_RESULT([config_zlib_deflate], [
2181 + AC_MSG_RESULT([yes])
2182 + ],[
2183 + AC_MSG_RESULT([no])
2184 + AC_MSG_ERROR([
2185 + *** This kernel does not include the required zlib deflate support.
2186 + *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
2187 + ])
2188 +])
2189 diff --git a/config/kernel-create-nameidata.m4 b/config/kernel-create-nameidata.m4
2190 index d4c155c57..c43ca5b85 100644
2191 --- a/config/kernel-create-nameidata.m4
2192 +++ b/config/kernel-create-nameidata.m4
2193 @@ -1,9 +1,8 @@
2194 dnl #
2195 dnl # 3.6 API change
2196 dnl #
2197 -AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
2198 - AC_MSG_CHECKING([whether iops->create() passes nameidata])
2199 - ZFS_LINUX_TRY_COMPILE([
2200 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_NAMEIDATA], [
2201 + ZFS_LINUX_TEST_SRC([create_nameidata], [
2202 #include <linux/fs.h>
2203 #include <linux/sched.h>
2204
2205 @@ -19,11 +18,15 @@ AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
2206 iops __attribute__ ((unused)) = {
2207 .create = inode_create,
2208 };
2209 - ],[
2210 - ],[
2211 + ],[])
2212 +])
2213 +
2214 +AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
2215 + AC_MSG_CHECKING([whether iops->create() passes nameidata])
2216 + ZFS_LINUX_TEST_RESULT([create_nameidata], [
2217 AC_MSG_RESULT(yes)
2218 AC_DEFINE(HAVE_CREATE_NAMEIDATA, 1,
2219 - [iops->create() passes nameidata])
2220 + [iops->create() passes nameidata])
2221 ],[
2222 AC_MSG_RESULT(no)
2223 ])
2224 diff --git a/config/kernel-ctl-table-name.m4 b/config/kernel-ctl-table-name.m4
2225 index 3ce499968..16f2ad544 100644
2226 --- a/config/kernel-ctl-table-name.m4
2227 +++ b/config/kernel-ctl-table-name.m4
2228 @@ -2,14 +2,18 @@ dnl #
2229 dnl # 2.6.33 API change,
2230 dnl # Removed .ctl_name from struct ctl_table.
2231 dnl #
2232 -AC_DEFUN([ZFS_AC_KERNEL_CTL_NAME], [
2233 - AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
2234 - ZFS_LINUX_TRY_COMPILE([
2235 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CTL_NAME], [
2236 + ZFS_LINUX_TEST_SRC([ctl_name], [
2237 #include <linux/sysctl.h>
2238 ],[
2239 struct ctl_table ctl __attribute__ ((unused));
2240 ctl.ctl_name = 0;
2241 - ],[
2242 + ])
2243 +])
2244 +
2245 +AC_DEFUN([ZFS_AC_KERNEL_CTL_NAME], [
2246 + AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
2247 + ZFS_LINUX_TEST_RESULT([ctl_name], [
2248 AC_MSG_RESULT(yes)
2249 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
2250 ],[
2251 diff --git a/config/kernel-current-time.m4 b/config/kernel-current-time.m4
2252 index c7d5c9b52..3ceb5f63e 100644
2253 --- a/config/kernel-current-time.m4
2254 +++ b/config/kernel-current-time.m4
2255 @@ -2,14 +2,19 @@ dnl #
2256 dnl # 4.9, current_time() added
2257 dnl # 4.18, return type changed from timespec to timespec64
2258 dnl #
2259 -AC_DEFUN([ZFS_AC_KERNEL_CURRENT_TIME],
2260 - [AC_MSG_CHECKING([whether current_time() exists])
2261 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
2262 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CURRENT_TIME], [
2263 + ZFS_LINUX_TEST_SRC([current_time], [
2264 #include <linux/fs.h>
2265 ], [
2266 struct inode ip __attribute__ ((unused));
2267 ip.i_atime = current_time(&ip);
2268 - ], [current_time], [fs/inode.c], [
2269 + ])
2270 +])
2271 +
2272 +AC_DEFUN([ZFS_AC_KERNEL_CURRENT_TIME], [
2273 + AC_MSG_CHECKING([whether current_time() exists])
2274 + ZFS_LINUX_TEST_RESULT_SYMBOL([current_time],
2275 + [current_time], [fs/inode.c], [
2276 AC_MSG_RESULT(yes)
2277 AC_DEFINE(HAVE_CURRENT_TIME, 1, [current_time() exists])
2278 ], [
2279 diff --git a/config/kernel-current_bio_tail.m4 b/config/kernel-current_bio_tail.m4
2280 index b72f21e8a..9dfc3e6e0 100644
2281 --- a/config/kernel-current_bio_tail.m4
2282 +++ b/config/kernel-current_bio_tail.m4
2283 @@ -4,30 +4,36 @@ dnl # current->bio_tail and current->bio_list were struct bio pointers prior to
2284 dnl # Linux 2.6.34. They were refactored into a struct bio_list pointer called
2285 dnl # current->bio_list in Linux 2.6.34.
2286 dnl #
2287 -AC_DEFUN([ZFS_AC_KERNEL_CURRENT_BIO_TAIL], [
2288 - AC_MSG_CHECKING([whether current->bio_tail exists])
2289 - ZFS_LINUX_TRY_COMPILE([
2290 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CURRENT_BIO_TAIL], [
2291 + ZFS_LINUX_TEST_SRC([current_bio_tail], [
2292 #include <linux/sched.h>
2293 - ],[
2294 + ], [
2295 current->bio_tail = (struct bio **) NULL;
2296 - ],[
2297 + ])
2298 +
2299 + ZFS_LINUX_TEST_SRC([current_bio_list], [
2300 + #include <linux/sched.h>
2301 + ], [
2302 + current->bio_list = (struct bio_list *) NULL;
2303 + ])
2304 +])
2305 +
2306 +AC_DEFUN([ZFS_AC_KERNEL_CURRENT_BIO_TAIL], [
2307 + AC_MSG_CHECKING([whether current->bio_tail exists])
2308 + ZFS_LINUX_TEST_RESULT([current_bio_tail], [
2309 AC_MSG_RESULT(yes)
2310 AC_DEFINE(HAVE_CURRENT_BIO_TAIL, 1,
2311 [current->bio_tail exists])
2312 ],[
2313 AC_MSG_RESULT(no)
2314 +
2315 AC_MSG_CHECKING([whether current->bio_list exists])
2316 - ZFS_LINUX_TRY_COMPILE([
2317 - #include <linux/sched.h>
2318 - ],[
2319 - current->bio_list = (struct bio_list *) NULL;
2320 - ],[
2321 + ZFS_LINUX_TEST_RESULT([current_bio_list], [
2322 AC_MSG_RESULT(yes)
2323 AC_DEFINE(HAVE_CURRENT_BIO_LIST, 1,
2324 [current->bio_list exists])
2325 ],[
2326 - AC_MSG_ERROR(no - Please file a bug report at
2327 - https://github.com/zfsonlinux/zfs/issues/new)
2328 + ZFS_LINUX_TEST_ERROR([bio_list])
2329 ])
2330 ])
2331 ])
2332 diff --git a/config/kernel-d-make-root.m4 b/config/kernel-d-make-root.m4
2333 deleted file mode 100644
2334 index 9c2b73dcb..000000000
2335 --- a/config/kernel-d-make-root.m4
2336 +++ /dev/null
2337 @@ -1,17 +0,0 @@
2338 -dnl #
2339 -dnl # 3.4.0 API change
2340 -dnl # Added d_make_root() to replace previous d_alloc_root() function.
2341 -dnl #
2342 -AC_DEFUN([ZFS_AC_KERNEL_D_MAKE_ROOT],
2343 - [AC_MSG_CHECKING([whether d_make_root() is available])
2344 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
2345 - #include <linux/dcache.h>
2346 - ], [
2347 - d_make_root(NULL);
2348 - ], [d_make_root], [fs/dcache.c], [
2349 - AC_MSG_RESULT(yes)
2350 - AC_DEFINE(HAVE_D_MAKE_ROOT, 1, [d_make_root() is available])
2351 - ], [
2352 - AC_MSG_RESULT(no)
2353 - ])
2354 -])
2355 diff --git a/config/kernel-d-obtain-alias.m4 b/config/kernel-d-obtain-alias.m4
2356 deleted file mode 100644
2357 index 2b4b11ecc..000000000
2358 --- a/config/kernel-d-obtain-alias.m4
2359 +++ /dev/null
2360 @@ -1,18 +0,0 @@
2361 -dnl #
2362 -dnl # 2.6.28 API change
2363 -dnl # Added d_obtain_alias() helper function.
2364 -dnl #
2365 -AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS],
2366 - [AC_MSG_CHECKING([whether d_obtain_alias() is available])
2367 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
2368 - #include <linux/dcache.h>
2369 - ], [
2370 - d_obtain_alias(NULL);
2371 - ], [d_obtain_alias], [fs/dcache.c], [
2372 - AC_MSG_RESULT(yes)
2373 - AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
2374 - [d_obtain_alias() is available])
2375 - ], [
2376 - AC_MSG_RESULT(no)
2377 - ])
2378 -])
2379 diff --git a/config/kernel-d-prune-aliases.m4 b/config/kernel-d-prune-aliases.m4
2380 deleted file mode 100644
2381 index d9c521b1d..000000000
2382 --- a/config/kernel-d-prune-aliases.m4
2383 +++ /dev/null
2384 @@ -1,19 +0,0 @@
2385 -dnl #
2386 -dnl # 2.6.12 API change
2387 -dnl # d_prune_aliases() helper function available.
2388 -dnl #
2389 -AC_DEFUN([ZFS_AC_KERNEL_D_PRUNE_ALIASES],
2390 - [AC_MSG_CHECKING([whether d_prune_aliases() is available])
2391 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
2392 - #include <linux/dcache.h>
2393 - ], [
2394 - struct inode *ip = NULL;
2395 - d_prune_aliases(ip);
2396 - ], [d_prune_aliases], [fs/dcache.c], [
2397 - AC_MSG_RESULT(yes)
2398 - AC_DEFINE(HAVE_D_PRUNE_ALIASES, 1,
2399 - [d_prune_aliases() is available])
2400 - ], [
2401 - AC_MSG_RESULT(no)
2402 - ])
2403 -])
2404 diff --git a/config/kernel-declare-event-class.m4 b/config/kernel-declare-event-class.m4
2405 index 7867d7517..6c78ee858 100644
2406 --- a/config/kernel-declare-event-class.m4
2407 +++ b/config/kernel-declare-event-class.m4
2408 @@ -2,13 +2,10 @@ dnl #
2409 dnl # Ensure the DECLARE_EVENT_CLASS macro is available to non-GPL modules.
2410 dnl #
2411 AC_DEFUN([ZFS_AC_KERNEL_DECLARE_EVENT_CLASS], [
2412 - tmp_flags="$EXTRA_KCFLAGS"
2413 - EXTRA_KCFLAGS="-I\$(src)"
2414 -
2415 AC_MSG_CHECKING([whether DECLARE_EVENT_CLASS() is available])
2416 ZFS_LINUX_TRY_COMPILE_HEADER([
2417 #include <linux/module.h>
2418 - MODULE_LICENSE(ZFS_META_LICENSE);
2419 + MODULE_LICENSE("$ZFS_META_LICENSE");
2420
2421 #define CREATE_TRACE_POINTS
2422 #include "conftest.h"
2423 @@ -18,7 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_DECLARE_EVENT_CLASS], [
2424 ],[
2425 AC_MSG_RESULT(yes)
2426 AC_DEFINE(HAVE_DECLARE_EVENT_CLASS, 1,
2427 - [DECLARE_EVENT_CLASS() is available])
2428 + [DECLARE_EVENT_CLASS() is available])
2429 ],[
2430 AC_MSG_RESULT(no)
2431 ],[
2432 @@ -55,5 +52,4 @@ AC_DEFUN([ZFS_AC_KERNEL_DECLARE_EVENT_CLASS], [
2433 #define TRACE_INCLUDE_FILE conftest
2434 #include <trace/define_trace.h>
2435 ])
2436 - EXTRA_KCFLAGS="$tmp_flags"
2437 ])
2438 diff --git a/config/kernel-dentry-operations.m4 b/config/kernel-dentry-operations.m4
2439 index 61f5a27af..f943dad4c 100644
2440 --- a/config/kernel-dentry-operations.m4
2441 +++ b/config/kernel-dentry-operations.m4
2442 @@ -1,9 +1,103 @@
2443 +dnl #
2444 +dnl # 3.4.0 API change
2445 +dnl # Added d_make_root() to replace previous d_alloc_root() function.
2446 +dnl #
2447 +AC_DEFUN([ZFS_AC_KERNEL_SRC_D_MAKE_ROOT], [
2448 + ZFS_LINUX_TEST_SRC([d_make_root], [
2449 + #include <linux/dcache.h>
2450 + ], [
2451 + d_make_root(NULL);
2452 + ])
2453 +])
2454 +
2455 +AC_DEFUN([ZFS_AC_KERNEL_D_MAKE_ROOT], [
2456 + AC_MSG_CHECKING([whether d_make_root() is available])
2457 + ZFS_LINUX_TEST_RESULT_SYMBOL([d_make_root],
2458 + [d_make_root], [fs/dcache.c], [
2459 + AC_MSG_RESULT(yes)
2460 + AC_DEFINE(HAVE_D_MAKE_ROOT, 1, [d_make_root() is available])
2461 + ], [
2462 + AC_MSG_RESULT(no)
2463 + ])
2464 +])
2465 +
2466 +dnl #
2467 +dnl # 2.6.28 API change
2468 +dnl # Added d_obtain_alias() helper function.
2469 +dnl #
2470 +AC_DEFUN([ZFS_AC_KERNEL_SRC_D_OBTAIN_ALIAS], [
2471 + ZFS_LINUX_TEST_SRC([d_obtain_alias], [
2472 + #include <linux/dcache.h>
2473 + ], [
2474 + d_obtain_alias(NULL);
2475 + ])
2476 +])
2477 +
2478 +AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS], [
2479 + AC_MSG_CHECKING([whether d_obtain_alias() is available])
2480 + ZFS_LINUX_TEST_RESULT_SYMBOL([d_obtain_alias],
2481 + [d_obtain_alias], [fs/dcache.c], [
2482 + AC_MSG_RESULT(yes)
2483 + AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
2484 + [d_obtain_alias() is available])
2485 + ], [
2486 + AC_MSG_RESULT(no)
2487 + ])
2488 +])
2489 +
2490 +dnl #
2491 +dnl # 2.6.12 API change
2492 +dnl # d_prune_aliases() helper function available.
2493 +dnl #
2494 +AC_DEFUN([ZFS_AC_KERNEL_SRC_D_PRUNE_ALIASES], [
2495 + ZFS_LINUX_TEST_SRC([d_prune_aliases], [
2496 + #include <linux/dcache.h>
2497 + ], [
2498 + struct inode *ip = NULL;
2499 + d_prune_aliases(ip);
2500 + ])
2501 +])
2502 +
2503 +AC_DEFUN([ZFS_AC_KERNEL_D_PRUNE_ALIASES], [
2504 + AC_MSG_CHECKING([whether d_prune_aliases() is available])
2505 + ZFS_LINUX_TEST_RESULT_SYMBOL([d_prune_aliases],
2506 + [d_prune_aliases], [fs/dcache.c], [
2507 + AC_MSG_RESULT(yes)
2508 + AC_DEFINE(HAVE_D_PRUNE_ALIASES, 1,
2509 + [d_prune_aliases() is available])
2510 + ], [
2511 + AC_MSG_RESULT(no)
2512 + ])
2513 +])
2514 +
2515 +dnl #
2516 +dnl # 2.6.38 API change
2517 +dnl # Added d_set_d_op() helper function.
2518 +dnl #
2519 +AC_DEFUN([ZFS_AC_KERNEL_SRC_D_SET_D_OP], [
2520 + ZFS_LINUX_TEST_SRC([d_set_d_op], [
2521 + #include <linux/dcache.h>
2522 + ], [
2523 + d_set_d_op(NULL, NULL);
2524 + ])
2525 +])
2526 +
2527 +AC_DEFUN([ZFS_AC_KERNEL_D_SET_D_OP], [
2528 + AC_MSG_CHECKING([whether d_set_d_op() is available])
2529 + ZFS_LINUX_TEST_RESULT_SYMBOL([d_set_d_op],
2530 + [d_set_d_op], [fs/dcache.c], [
2531 + AC_MSG_RESULT(yes)
2532 + AC_DEFINE(HAVE_D_SET_D_OP, 1, [d_set_d_op() is available])
2533 + ], [
2534 + AC_MSG_RESULT(no)
2535 + ])
2536 +])
2537 +
2538 dnl #
2539 dnl # 3.6 API change
2540 dnl #
2541 -AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [
2542 - AC_MSG_CHECKING([whether dops->d_revalidate() takes struct nameidata])
2543 - ZFS_LINUX_TRY_COMPILE([
2544 +AC_DEFUN([ZFS_AC_KERNEL_SRC_D_REVALIDATE_NAMEIDATA], [
2545 + ZFS_LINUX_TEST_SRC([dentry_operations_revalidate], [
2546 #include <linux/dcache.h>
2547 #include <linux/sched.h>
2548
2549 @@ -14,11 +108,15 @@ AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [
2550 dops __attribute__ ((unused)) = {
2551 .d_revalidate = revalidate,
2552 };
2553 - ],[
2554 - ],[
2555 + ],[])
2556 +])
2557 +
2558 +AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [
2559 + AC_MSG_CHECKING([whether dops->d_revalidate() takes struct nameidata])
2560 + ZFS_LINUX_TEST_RESULT([dentry_operations_revalidate], [
2561 AC_MSG_RESULT(yes)
2562 AC_DEFINE(HAVE_D_REVALIDATE_NAMEIDATA, 1,
2563 - [dops->d_revalidate() operation takes nameidata])
2564 + [dops->d_revalidate() operation takes nameidata])
2565 ],[
2566 AC_MSG_RESULT(no)
2567 ])
2568 @@ -28,9 +126,8 @@ dnl #
2569 dnl # 2.6.30 API change
2570 dnl # The 'struct dentry_operations' was constified in the dentry structure.
2571 dnl #
2572 -AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [
2573 - AC_MSG_CHECKING([whether dentry uses const struct dentry_operations])
2574 - ZFS_LINUX_TRY_COMPILE([
2575 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CONST_DENTRY_OPERATIONS], [
2576 + ZFS_LINUX_TEST_SRC([dentry_operations_const], [
2577 #include <linux/dcache.h>
2578
2579 const struct dentry_operations test_d_op = {
2580 @@ -38,32 +135,17 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [
2581 };
2582 ],[
2583 struct dentry d __attribute__ ((unused));
2584 -
2585 d.d_op = &test_d_op;
2586 - ],[
2587 - AC_MSG_RESULT(yes)
2588 - AC_DEFINE(HAVE_CONST_DENTRY_OPERATIONS, 1,
2589 - [dentry uses const struct dentry_operations])
2590 - ],[
2591 - AC_MSG_RESULT(no)
2592 ])
2593 ])
2594
2595 -dnl #
2596 -dnl # 2.6.38 API change
2597 -dnl # Added d_set_d_op() helper function.
2598 -dnl #
2599 -AC_DEFUN([ZFS_AC_KERNEL_D_SET_D_OP],
2600 - [AC_MSG_CHECKING([whether d_set_d_op() is available])
2601 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
2602 - #include <linux/dcache.h>
2603 - ], [
2604 - d_set_d_op(NULL, NULL);
2605 - ], [d_set_d_op], [fs/dcache.c], [
2606 +AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [
2607 + AC_MSG_CHECKING([whether dentry uses const struct dentry_operations])
2608 + ZFS_LINUX_TEST_RESULT([dentry_operations_const], [
2609 AC_MSG_RESULT(yes)
2610 - AC_DEFINE(HAVE_D_SET_D_OP, 1,
2611 - [d_set_d_op() is available])
2612 - ], [
2613 + AC_DEFINE(HAVE_CONST_DENTRY_OPERATIONS, 1,
2614 + [dentry uses const struct dentry_operations])
2615 + ],[
2616 AC_MSG_RESULT(no)
2617 ])
2618 ])
2619 @@ -72,17 +154,41 @@ dnl #
2620 dnl # 2.6.38 API chage
2621 dnl # Added sb->s_d_op default dentry_operations member
2622 dnl #
2623 -AC_DEFUN([ZFS_AC_KERNEL_S_D_OP],
2624 - [AC_MSG_CHECKING([whether super_block has s_d_op])
2625 - ZFS_LINUX_TRY_COMPILE([
2626 +AC_DEFUN([ZFS_AC_KERNEL_SRC_S_D_OP], [
2627 + ZFS_LINUX_TEST_SRC([super_block_s_d_op], [
2628 #include <linux/fs.h>
2629 ],[
2630 struct super_block sb __attribute__ ((unused));
2631 sb.s_d_op = NULL;
2632 - ], [
2633 + ])
2634 +])
2635 +
2636 +AC_DEFUN([ZFS_AC_KERNEL_S_D_OP], [
2637 + AC_MSG_CHECKING([whether super_block has s_d_op])
2638 + ZFS_LINUX_TEST_RESULT([super_block_s_d_op], [
2639 AC_MSG_RESULT(yes)
2640 AC_DEFINE(HAVE_S_D_OP, 1, [struct super_block has s_d_op])
2641 ], [
2642 AC_MSG_RESULT(no)
2643 ])
2644 ])
2645 +
2646 +AC_DEFUN([ZFS_AC_KERNEL_SRC_DENTRY], [
2647 + ZFS_AC_KERNEL_SRC_D_MAKE_ROOT
2648 + ZFS_AC_KERNEL_SRC_D_OBTAIN_ALIAS
2649 + ZFS_AC_KERNEL_SRC_D_PRUNE_ALIASES
2650 + ZFS_AC_KERNEL_SRC_D_SET_D_OP
2651 + ZFS_AC_KERNEL_SRC_D_REVALIDATE_NAMEIDATA
2652 + ZFS_AC_KERNEL_SRC_CONST_DENTRY_OPERATIONS
2653 + ZFS_AC_KERNEL_SRC_S_D_OP
2654 +])
2655 +
2656 +AC_DEFUN([ZFS_AC_KERNEL_DENTRY], [
2657 + ZFS_AC_KERNEL_D_MAKE_ROOT
2658 + ZFS_AC_KERNEL_D_OBTAIN_ALIAS
2659 + ZFS_AC_KERNEL_D_PRUNE_ALIASES
2660 + ZFS_AC_KERNEL_D_SET_D_OP
2661 + ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA
2662 + ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS
2663 + ZFS_AC_KERNEL_S_D_OP
2664 +])
2665 diff --git a/config/kernel-dirty-inode.m4 b/config/kernel-dirty-inode.m4
2666 index ffd87bb14..dc7667fa4 100644
2667 --- a/config/kernel-dirty-inode.m4
2668 +++ b/config/kernel-dirty-inode.m4
2669 @@ -4,9 +4,8 @@ dnl # The sops->dirty_inode() callbacks were updated to take a flags
2670 dnl # argument. This allows the greater control over whether the
2671 dnl # filesystem needs to push out a transaction or not.
2672 dnl #
2673 -AC_DEFUN([ZFS_AC_KERNEL_DIRTY_INODE_WITH_FLAGS], [
2674 - AC_MSG_CHECKING([whether sops->dirty_inode() wants flags])
2675 - ZFS_LINUX_TRY_COMPILE([
2676 +AC_DEFUN([ZFS_AC_KERNEL_SRC_DIRTY_INODE], [
2677 + ZFS_LINUX_TEST_SRC([dirty_inode_with_flags], [
2678 #include <linux/fs.h>
2679
2680 void dirty_inode(struct inode *a, int b) { return; }
2681 @@ -15,11 +14,15 @@ AC_DEFUN([ZFS_AC_KERNEL_DIRTY_INODE_WITH_FLAGS], [
2682 sops __attribute__ ((unused)) = {
2683 .dirty_inode = dirty_inode,
2684 };
2685 - ],[
2686 - ],[
2687 + ],[])
2688 +])
2689 +
2690 +AC_DEFUN([ZFS_AC_KERNEL_DIRTY_INODE], [
2691 + AC_MSG_CHECKING([whether sops->dirty_inode() wants flags])
2692 + ZFS_LINUX_TEST_RESULT([dirty_inode_with_flags], [
2693 AC_MSG_RESULT([yes])
2694 AC_DEFINE(HAVE_DIRTY_INODE_WITH_FLAGS, 1,
2695 - [sops->dirty_inode() wants flags])
2696 + [sops->dirty_inode() wants flags])
2697 ],[
2698 AC_MSG_RESULT([no])
2699 ])
2700 diff --git a/config/kernel-discard-granularity.m4 b/config/kernel-discard-granularity.m4
2701 index 2c677c909..c830d9aa9 100644
2702 --- a/config/kernel-discard-granularity.m4
2703 +++ b/config/kernel-discard-granularity.m4
2704 @@ -2,18 +2,21 @@ dnl #
2705 dnl # 2.6.33 API change
2706 dnl # Discard granularity and alignment restrictions may now be set.
2707 dnl #
2708 -AC_DEFUN([ZFS_AC_KERNEL_DISCARD_GRANULARITY], [
2709 - AC_MSG_CHECKING([whether ql->discard_granularity is available])
2710 - ZFS_LINUX_TRY_COMPILE([
2711 +AC_DEFUN([ZFS_AC_KERNEL_SRC_DISCARD_GRANULARITY], [
2712 + ZFS_LINUX_TEST_SRC([discard_granularity], [
2713 #include <linux/blkdev.h>
2714 ],[
2715 struct queue_limits ql __attribute__ ((unused));
2716 -
2717 ql.discard_granularity = 0;
2718 - ],[
2719 + ])
2720 +])
2721 +
2722 +AC_DEFUN([ZFS_AC_KERNEL_DISCARD_GRANULARITY], [
2723 + AC_MSG_CHECKING([whether ql->discard_granularity is available])
2724 + ZFS_LINUX_TEST_RESULT([discard_granularity], [
2725 AC_MSG_RESULT(yes)
2726 AC_DEFINE(HAVE_DISCARD_GRANULARITY, 1,
2727 - [ql->discard_granularity is available])
2728 + [ql->discard_granularity is available])
2729 ],[
2730 AC_MSG_RESULT(no)
2731 ])
2732 diff --git a/config/kernel-elevator-change.m4 b/config/kernel-elevator-change.m4
2733 index eba252579..3aa732040 100644
2734 --- a/config/kernel-elevator-change.m4
2735 +++ b/config/kernel-elevator-change.m4
2736 @@ -2,24 +2,25 @@ dnl #
2737 dnl # 2.6.36 API, exported elevator_change() symbol
2738 dnl # 4.12 API, removed elevator_change() symbol
2739 dnl #
2740 -AC_DEFUN([ZFS_AC_KERNEL_ELEVATOR_CHANGE], [
2741 - AC_MSG_CHECKING([whether elevator_change() is available])
2742 - tmp_flags="$EXTRA_KCFLAGS"
2743 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
2744 - ZFS_LINUX_TRY_COMPILE([
2745 +AC_DEFUN([ZFS_AC_KERNEL_SRC_ELEVATOR_CHANGE], [
2746 + ZFS_LINUX_TEST_SRC([elevator_change], [
2747 #include <linux/blkdev.h>
2748 #include <linux/elevator.h>
2749 ],[
2750 - int ret;
2751 struct request_queue *q = NULL;
2752 char *elevator = NULL;
2753 - ret = elevator_change(q, elevator);
2754 - ],[
2755 + int error __attribute__ ((unused)) =
2756 + elevator_change(q, elevator);
2757 + ])
2758 +])
2759 +
2760 +AC_DEFUN([ZFS_AC_KERNEL_ELEVATOR_CHANGE], [
2761 + AC_MSG_CHECKING([whether elevator_change() is available])
2762 + ZFS_LINUX_TEST_RESULT([elevator_change], [
2763 AC_MSG_RESULT(yes)
2764 AC_DEFINE(HAVE_ELEVATOR_CHANGE, 1,
2765 - [elevator_change() is available])
2766 + [elevator_change() is available])
2767 ],[
2768 AC_MSG_RESULT(no)
2769 ])
2770 - EXTRA_KCFLAGS="$tmp_flags"
2771 ])
2772 diff --git a/config/kernel-encode-fh-inode.m4 b/config/kernel-encode-fh-inode.m4
2773 index 287f62a5e..9d4ba5f0f 100644
2774 --- a/config/kernel-encode-fh-inode.m4
2775 +++ b/config/kernel-encode-fh-inode.m4
2776 @@ -4,20 +4,23 @@ dnl # torvalds/linux@b0b0382bb4904965a9e9fca77ad87514dfda0d1c changed the
2777 dnl # ->encode_fh() callback to pass the child inode and its parents inode
2778 dnl # rather than a dentry and a boolean saying whether we want the parent.
2779 dnl #
2780 -AC_DEFUN([ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE], [
2781 - AC_MSG_CHECKING([whether eops->encode_fh() wants inode])
2782 - ZFS_LINUX_TRY_COMPILE([
2783 +AC_DEFUN([ZFS_AC_KERNEL_SRC_ENCODE_FH_WITH_INODE], [
2784 + ZFS_LINUX_TEST_SRC([export_operations_encode_fh], [
2785 #include <linux/exportfs.h>
2786 int encode_fh(struct inode *inode, __u32 *fh, int *max_len,
2787 struct inode *parent) { return 0; }
2788 static struct export_operations eops __attribute__ ((unused))={
2789 .encode_fh = encode_fh,
2790 };
2791 - ],[
2792 - ],[
2793 + ],[])
2794 +])
2795 +
2796 +AC_DEFUN([ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE], [
2797 + AC_MSG_CHECKING([whether eops->encode_fh() wants inode])
2798 + ZFS_LINUX_TEST_RESULT([export_operations_encode_fh], [
2799 AC_MSG_RESULT(yes)
2800 AC_DEFINE(HAVE_ENCODE_FH_WITH_INODE, 1,
2801 - [eops->encode_fh() wants child and parent inodes])
2802 + [eops->encode_fh() wants child and parent inodes])
2803 ],[
2804 AC_MSG_RESULT(no)
2805 ])
2806 diff --git a/config/kernel-evict-inode.m4 b/config/kernel-evict-inode.m4
2807 index 683cedb6d..cd91c6669 100644
2808 --- a/config/kernel-evict-inode.m4
2809 +++ b/config/kernel-evict-inode.m4
2810 @@ -3,16 +3,19 @@ dnl # 2.6.36 API change
2811 dnl # The sops->delete_inode() and sops->clear_inode() callbacks have
2812 dnl # replaced by a single sops->evict_inode() callback.
2813 dnl #
2814 -AC_DEFUN([ZFS_AC_KERNEL_EVICT_INODE], [
2815 - AC_MSG_CHECKING([whether sops->evict_inode() exists])
2816 - ZFS_LINUX_TRY_COMPILE([
2817 +AC_DEFUN([ZFS_AC_KERNEL_SRC_EVICT_INODE], [
2818 + ZFS_LINUX_TEST_SRC([evict_inode], [
2819 #include <linux/fs.h>
2820 void evict_inode (struct inode * t) { return; }
2821 static struct super_operations sops __attribute__ ((unused)) = {
2822 .evict_inode = evict_inode,
2823 };
2824 - ],[
2825 - ],[
2826 + ],[])
2827 +])
2828 +
2829 +AC_DEFUN([ZFS_AC_KERNEL_EVICT_INODE], [
2830 + AC_MSG_CHECKING([whether sops->evict_inode() exists])
2831 + ZFS_LINUX_TEST_RESULT([evict_inode], [
2832 AC_MSG_RESULT(yes)
2833 AC_DEFINE(HAVE_EVICT_INODE, 1, [sops->evict_inode() exists])
2834 ],[
2835 diff --git a/config/kernel-fallocate-pax.m4 b/config/kernel-fallocate-pax.m4
2836 deleted file mode 100644
2837 index e8948be17..000000000
2838 --- a/config/kernel-fallocate-pax.m4
2839 +++ /dev/null
2840 @@ -1,19 +0,0 @@
2841 -dnl #
2842 -dnl # PaX Linux 2.6.38 - 3.x API
2843 -dnl #
2844 -AC_DEFUN([ZFS_AC_PAX_KERNEL_FILE_FALLOCATE], [
2845 - AC_MSG_CHECKING([whether fops->fallocate() exists])
2846 - ZFS_LINUX_TRY_COMPILE([
2847 - #include <linux/fs.h>
2848 - ],[
2849 - long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
2850 - struct file_operations_no_const fops __attribute__ ((unused)) = {
2851 - .fallocate = fallocate,
2852 - };
2853 - ],[
2854 - AC_MSG_RESULT(yes)
2855 - AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
2856 - ],[
2857 - AC_MSG_RESULT(no)
2858 - ])
2859 -])
2860 diff --git a/config/kernel-fallocate.m4 b/config/kernel-fallocate.m4
2861 index 550906472..302957a6c 100644
2862 --- a/config/kernel-fallocate.m4
2863 +++ b/config/kernel-fallocate.m4
2864 @@ -1,9 +1,11 @@
2865 dnl #
2866 -dnl # Linux 2.6.38 - 3.x API
2867 +dnl # The fallocate callback was moved from the inode_operations
2868 +dnl # structure to the file_operations structure.
2869 dnl #
2870 -AC_DEFUN([ZFS_AC_KERNEL_FILE_FALLOCATE], [
2871 - AC_MSG_CHECKING([whether fops->fallocate() exists])
2872 - ZFS_LINUX_TRY_COMPILE([
2873 +AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [
2874 +
2875 + dnl # Linux 2.6.38 - 3.x API
2876 + ZFS_LINUX_TEST_SRC([file_fallocate], [
2877 #include <linux/fs.h>
2878
2879 long test_fallocate(struct file *file, int mode,
2880 @@ -13,21 +15,10 @@ AC_DEFUN([ZFS_AC_KERNEL_FILE_FALLOCATE], [
2881 fops __attribute__ ((unused)) = {
2882 .fallocate = test_fallocate,
2883 };
2884 - ],[
2885 - ],[
2886 - AC_MSG_RESULT(yes)
2887 - AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
2888 - ],[
2889 - AC_MSG_RESULT(no)
2890 - ])
2891 -])
2892 + ], [])
2893
2894 -dnl #
2895 -dnl # Linux 2.6.x - 2.6.37 API
2896 -dnl #
2897 -AC_DEFUN([ZFS_AC_KERNEL_INODE_FALLOCATE], [
2898 - AC_MSG_CHECKING([whether iops->fallocate() exists])
2899 - ZFS_LINUX_TRY_COMPILE([
2900 + dnl # Linux 2.6.x - 2.6.37 API
2901 + ZFS_LINUX_TEST_SRC([inode_fallocate], [
2902 #include <linux/fs.h>
2903
2904 long test_fallocate(struct inode *inode, int mode,
2905 @@ -37,20 +28,23 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_FALLOCATE], [
2906 fops __attribute__ ((unused)) = {
2907 .fallocate = test_fallocate,
2908 };
2909 + ], [])
2910 +])
2911 +
2912 +AC_DEFUN([ZFS_AC_KERNEL_FALLOCATE], [
2913 + AC_MSG_CHECKING([whether fops->fallocate() exists])
2914 + ZFS_LINUX_TEST_RESULT([file_fallocate], [
2915 + AC_MSG_RESULT(yes)
2916 + AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
2917 ],[
2918 - ],[
2919 + AC_MSG_RESULT(no)
2920 + ])
2921 +
2922 + AC_MSG_CHECKING([whether iops->fallocate() exists])
2923 + ZFS_LINUX_TEST_RESULT([inode_fallocate], [
2924 AC_MSG_RESULT(yes)
2925 AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
2926 ],[
2927 AC_MSG_RESULT(no)
2928 ])
2929 ])
2930 -
2931 -dnl #
2932 -dnl # The fallocate callback was moved from the inode_operations
2933 -dnl # structure to the file_operations structure.
2934 -dnl #
2935 -AC_DEFUN([ZFS_AC_KERNEL_FALLOCATE], [
2936 - ZFS_AC_KERNEL_FILE_FALLOCATE
2937 - ZFS_AC_KERNEL_INODE_FALLOCATE
2938 -])
2939 diff --git a/config/kernel-file-dentry.m4 b/config/kernel-file-dentry.m4
2940 index daf742ee1..9cb5869c3 100644
2941 --- a/config/kernel-file-dentry.m4
2942 +++ b/config/kernel-file-dentry.m4
2943 @@ -4,14 +4,18 @@ dnl # struct access file->f_path.dentry was replaced by accessor function
2944 dnl # since fix torvalds/linux@4bacc9c9234c ("overlayfs: Make f_path always
2945 dnl # point to the overlay and f_inode to the underlay").
2946 dnl #
2947 -AC_DEFUN([ZFS_AC_KERNEL_FILE_DENTRY], [
2948 - AC_MSG_CHECKING([whether file_dentry() is available])
2949 - ZFS_LINUX_TRY_COMPILE([
2950 +AC_DEFUN([ZFS_AC_KERNEL_SRC_FILE_DENTRY], [
2951 + ZFS_LINUX_TEST_SRC([file_dentry], [
2952 #include <linux/fs.h>
2953 ],[
2954 struct file *f = NULL;
2955 file_dentry(f);
2956 - ],[
2957 + ])
2958 +])
2959 +
2960 +AC_DEFUN([ZFS_AC_KERNEL_FILE_DENTRY], [
2961 + AC_MSG_CHECKING([whether file_dentry() is available])
2962 + ZFS_LINUX_TEST_RESULT([file_dentry], [
2963 AC_MSG_RESULT(yes)
2964 AC_DEFINE(HAVE_FILE_DENTRY, 1, [file_dentry() is available])
2965 ],[
2966 diff --git a/config/kernel-file-inode.m4 b/config/kernel-file-inode.m4
2967 index 300188fa3..00a362165 100644
2968 --- a/config/kernel-file-inode.m4
2969 +++ b/config/kernel-file-inode.m4
2970 @@ -3,14 +3,18 @@ dnl # 3.19 API change
2971 dnl # struct access f->f_dentry->d_inode was replaced by accessor function
2972 dnl # file_inode(f)
2973 dnl #
2974 -AC_DEFUN([ZFS_AC_KERNEL_FILE_INODE], [
2975 - AC_MSG_CHECKING([whether file_inode() is available])
2976 - ZFS_LINUX_TRY_COMPILE([
2977 +AC_DEFUN([ZFS_AC_KERNEL_SRC_FILE_INODE], [
2978 + ZFS_LINUX_TEST_SRC([file_inode], [
2979 #include <linux/fs.h>
2980 ],[
2981 struct file *f = NULL;
2982 file_inode(f);
2983 - ],[
2984 + ])
2985 +])
2986 +
2987 +AC_DEFUN([ZFS_AC_KERNEL_FILE_INODE], [
2988 + AC_MSG_CHECKING([whether file_inode() is available])
2989 + ZFS_LINUX_TEST_RESULT([file_inode], [
2990 AC_MSG_RESULT(yes)
2991 AC_DEFINE(HAVE_FILE_INODE, 1, [file_inode() is available])
2992 ],[
2993 diff --git a/config/kernel-fmode-t.m4 b/config/kernel-fmode-t.m4
2994 index 4a23c391d..bc0001b9e 100644
2995 --- a/config/kernel-fmode-t.m4
2996 +++ b/config/kernel-fmode-t.m4
2997 @@ -2,16 +2,19 @@ dnl #
2998 dnl # 2.6.28 API change,
2999 dnl # check if fmode_t typedef is defined
3000 dnl #
3001 -AC_DEFUN([ZFS_AC_KERNEL_TYPE_FMODE_T],
3002 - [AC_MSG_CHECKING([whether kernel defines fmode_t])
3003 - ZFS_LINUX_TRY_COMPILE([
3004 +AC_DEFUN([ZFS_AC_KERNEL_SRC_FMODE_T], [
3005 + ZFS_LINUX_TEST_SRC([type_fmode_t], [
3006 #include <linux/types.h>
3007 ],[
3008 fmode_t *ptr __attribute__ ((unused));
3009 - ],[
3010 + ])
3011 +])
3012 +
3013 +AC_DEFUN([ZFS_AC_KERNEL_FMODE_T], [
3014 + AC_MSG_CHECKING([whether kernel defines fmode_t])
3015 + ZFS_LINUX_TEST_RESULT([type_fmode_t], [
3016 AC_MSG_RESULT([yes])
3017 - AC_DEFINE(HAVE_FMODE_T, 1,
3018 - [kernel defines fmode_t])
3019 + AC_DEFINE(HAVE_FMODE_T, 1, [kernel defines fmode_t])
3020 ],[
3021 AC_MSG_RESULT([no])
3022 ])
3023 diff --git a/config/kernel-follow-down-one.m4 b/config/kernel-follow-down-one.m4
3024 index 63fa779d8..94e4aeb8d 100644
3025 --- a/config/kernel-follow-down-one.m4
3026 +++ b/config/kernel-follow-down-one.m4
3027 @@ -3,14 +3,18 @@ dnl # 2.6.38 API change
3028 dnl # follow_down() renamed follow_down_one(). The original follow_down()
3029 dnl # symbol still exists but will traverse down all the layers.
3030 dnl #
3031 -AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_DOWN_ONE], [
3032 - AC_MSG_CHECKING([whether follow_down_one() is available])
3033 - ZFS_LINUX_TRY_COMPILE([
3034 +AC_DEFUN([ZFS_AC_KERNEL_SRC_FOLLOW_DOWN_ONE], [
3035 + ZFS_LINUX_TEST_SRC([follow_down_one], [
3036 #include <linux/namei.h>
3037 ],[
3038 struct path *p = NULL;
3039 follow_down_one(p);
3040 - ],[
3041 + ])
3042 +])
3043 +
3044 +AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_DOWN_ONE], [
3045 + AC_MSG_CHECKING([whether follow_down_one() is available])
3046 + ZFS_LINUX_TEST_RESULT([follow_down_one], [
3047 AC_MSG_RESULT(yes)
3048 AC_DEFINE(HAVE_FOLLOW_DOWN_ONE, 1,
3049 [follow_down_one() is available])
3050 diff --git a/config/kernel-fpu.m4 b/config/kernel-fpu.m4
3051 index 0e622e859..a2c47d65a 100644
3052 --- a/config/kernel-fpu.m4
3053 +++ b/config/kernel-fpu.m4
3054 @@ -18,8 +18,11 @@ dnl #
3055 dnl # Pre-4.2: Use kernel_fpu_{begin,end}()
3056 dnl # HAVE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU
3057 dnl #
3058 -AC_DEFUN([ZFS_AC_KERNEL_FPU], [
3059 - AC_MSG_CHECKING([which kernel_fpu header to use])
3060 +dnl # N.B. The header check is performed before all other checks since it
3061 +dnl # depends on HAVE_KERNEL_FPU_API_HEADER being set in confdefs.h.
3062 +dnl #
3063 +AC_DEFUN([ZFS_AC_KERNEL_FPU_HEADER], [
3064 + AC_MSG_CHECKING([whether fpu headers are available])
3065 ZFS_LINUX_TRY_COMPILE([
3066 #include <linux/module.h>
3067 #include <asm/fpu/api.h>
3068 @@ -31,66 +34,88 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU], [
3069 ],[
3070 AC_MSG_RESULT(i387.h & xcr.h)
3071 ])
3072 +])
3073
3074 - AC_MSG_CHECKING([which kernel_fpu function to use])
3075 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
3076 - #include <linux/module.h>
3077 +AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
3078 + ZFS_LINUX_TEST_SRC([kernel_fpu], [
3079 #ifdef HAVE_KERNEL_FPU_API_HEADER
3080 #include <asm/fpu/api.h>
3081 #else
3082 #include <asm/i387.h>
3083 #include <asm/xcr.h>
3084 #endif
3085 - MODULE_LICENSE("$ZFS_META_LICENSE");
3086 - ],[
3087 + ], [
3088 kernel_fpu_begin();
3089 kernel_fpu_end();
3090 - ], [kernel_fpu_begin], [arch/x86/kernel/fpu/core.c], [
3091 + ], [], [$ZFS_META_LICENSE])
3092 +
3093 + ZFS_LINUX_TEST_SRC([__kernel_fpu], [
3094 + #ifdef HAVE_KERNEL_FPU_API_HEADER
3095 + #include <asm/fpu/api.h>
3096 + #else
3097 + #include <asm/i387.h>
3098 + #include <asm/xcr.h>
3099 + #endif
3100 + ], [
3101 + __kernel_fpu_begin();
3102 + __kernel_fpu_end();
3103 + ], [], [$ZFS_META_LICENSE])
3104 +
3105 + ZFS_LINUX_TEST_SRC([fpu_initialized], [
3106 + #include <linux/module.h>
3107 + #include <linux/sched.h>
3108 + ],[
3109 + struct fpu *fpu = &current->thread.fpu;
3110 + if (fpu->initialized) { return (0); };
3111 + ])
3112 +
3113 + ZFS_LINUX_TEST_SRC([tif_need_fpu_load], [
3114 + #include <linux/module.h>
3115 + #include <asm/thread_info.h>
3116 +
3117 + #if !defined(TIF_NEED_FPU_LOAD)
3118 + #error "TIF_NEED_FPU_LOAD undefined"
3119 + #endif
3120 + ],[])
3121 +])
3122 +
3123 +AC_DEFUN([ZFS_AC_KERNEL_FPU], [
3124 + dnl #
3125 + dnl # Legacy kernel
3126 + dnl #
3127 + AC_MSG_CHECKING([whether kernel fpu is available])
3128 + ZFS_LINUX_TEST_RESULT_SYMBOL([kernel_fpu_license],
3129 + [kernel_fpu_begin], [arch/x86/kernel/fpu/core.c], [
3130 AC_MSG_RESULT(kernel_fpu_*)
3131 AC_DEFINE(HAVE_KERNEL_FPU, 1,
3132 [kernel has kernel_fpu_* functions])
3133 AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
3134 [kernel exports FPU functions])
3135 ],[
3136 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
3137 - #include <linux/module.h>
3138 - #ifdef HAVE_KERNEL_FPU_API_HEADER
3139 - #include <asm/fpu/api.h>
3140 - #else
3141 - #include <asm/i387.h>
3142 - #include <asm/xcr.h>
3143 - #endif
3144 - MODULE_LICENSE("$ZFS_META_LICENSE");
3145 - ],[
3146 - __kernel_fpu_begin();
3147 - __kernel_fpu_end();
3148 - ], [__kernel_fpu_begin], [arch/x86/kernel/fpu/core.c arch/x86/kernel/i387.c], [
3149 + dnl #
3150 + dnl # Linux 4.2 kernel
3151 + dnl #
3152 + ZFS_LINUX_TEST_RESULT_SYMBOL([__kernel_fpu_license],
3153 + [__kernel_fpu_begin],
3154 + [arch/x86/kernel/fpu/core.c arch/x86/kernel/i387.c], [
3155 AC_MSG_RESULT(__kernel_fpu_*)
3156 AC_DEFINE(HAVE_UNDERSCORE_KERNEL_FPU, 1,
3157 [kernel has __kernel_fpu_* functions])
3158 AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
3159 [kernel exports FPU functions])
3160 ],[
3161 - ZFS_LINUX_TRY_COMPILE([
3162 - #include <linux/module.h>
3163 - #include <linux/sched.h>
3164 - ],[
3165 - struct fpu *fpu = &current->thread.fpu;
3166 - if (fpu->initialized) { return (0); };
3167 - ],[
3168 + dnl #
3169 + dnl # Linux 5.0 kernel
3170 + dnl #
3171 + ZFS_LINUX_TEST_RESULT([fpu_initialized], [
3172 AC_MSG_RESULT(fpu.initialized)
3173 AC_DEFINE(HAVE_KERNEL_FPU_INITIALIZED, 1,
3174 [kernel fpu.initialized exists])
3175 ],[
3176 - ZFS_LINUX_TRY_COMPILE([
3177 - #include <linux/module.h>
3178 - #include <asm/thread_info.h>
3179 -
3180 - #if !defined(TIF_NEED_FPU_LOAD)
3181 - #error "TIF_NEED_FPU_LOAD undefined"
3182 - #endif
3183 - ],[
3184 - ],[
3185 + dnl #
3186 + dnl # Linux 5.2 kernel
3187 + dnl #
3188 + ZFS_LINUX_TEST_RESULT([tif_need_fpu_load], [
3189 AC_MSG_RESULT(TIF_NEED_FPU_LOAD)
3190 AC_DEFINE(
3191 HAVE_KERNEL_TIF_NEED_FPU_LOAD, 1,
3192 diff --git a/config/kernel-fst-mount.m4 b/config/kernel-fst-mount.m4
3193 index a8ac50bdd..cec1ed4d6 100644
3194 --- a/config/kernel-fst-mount.m4
3195 +++ b/config/kernel-fst-mount.m4
3196 @@ -3,9 +3,8 @@ dnl # 2.6.38 API change
3197 dnl # The .get_sb callback has been replaced by a .mount callback
3198 dnl # in the file_system_type structure.
3199 dnl #
3200 -AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [
3201 - AC_MSG_CHECKING([whether fst->mount() exists])
3202 - ZFS_LINUX_TRY_COMPILE([
3203 +AC_DEFUN([ZFS_AC_KERNEL_SRC_FST_MOUNT], [
3204 + ZFS_LINUX_TEST_SRC([file_system_type_mount], [
3205 #include <linux/fs.h>
3206
3207 static struct dentry *
3208 @@ -18,8 +17,12 @@ AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [
3209 static struct file_system_type fst __attribute__ ((unused)) = {
3210 .mount = mount,
3211 };
3212 - ],[
3213 - ],[
3214 + ],[])
3215 +])
3216 +
3217 +AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [
3218 + AC_MSG_CHECKING([whether fst->mount() exists])
3219 + ZFS_LINUX_TEST_RESULT([file_system_type_mount], [
3220 AC_MSG_RESULT(yes)
3221 AC_DEFINE(HAVE_FST_MOUNT, 1, [fst->mount() exists])
3222 ],[
3223 diff --git a/config/kernel-fsync.m4 b/config/kernel-fsync.m4
3224 index e1f2d68b9..0494e31ad 100644
3225 --- a/config/kernel-fsync.m4
3226 +++ b/config/kernel-fsync.m4
3227 @@ -1,8 +1,8 @@
3228 dnl #
3229 -dnl # Linux 2.6.x - 2.6.34 API
3230 +dnl # Check file_operations->fsync interface.
3231 dnl #
3232 -AC_DEFUN([ZFS_AC_KERNEL_FSYNC_WITH_DENTRY], [
3233 - ZFS_LINUX_TRY_COMPILE([
3234 +AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [
3235 + ZFS_LINUX_TEST_SRC([fsync_with_dentry], [
3236 #include <linux/fs.h>
3237
3238 int test_fsync(struct file *f, struct dentry *dentry, int x)
3239 @@ -12,20 +12,9 @@ AC_DEFUN([ZFS_AC_KERNEL_FSYNC_WITH_DENTRY], [
3240 fops __attribute__ ((unused)) = {
3241 .fsync = test_fsync,
3242 };
3243 - ],[
3244 - ],[
3245 - AC_MSG_RESULT([dentry])
3246 - AC_DEFINE(HAVE_FSYNC_WITH_DENTRY, 1,
3247 - [fops->fsync() with dentry])
3248 - ],[
3249 - ])
3250 -])
3251 + ],[])
3252
3253 -dnl #
3254 -dnl # Linux 2.6.35 - Linux 3.0 API
3255 -dnl #
3256 -AC_DEFUN([ZFS_AC_KERNEL_FSYNC_WITHOUT_DENTRY], [
3257 - ZFS_LINUX_TRY_COMPILE([
3258 + ZFS_LINUX_TEST_SRC([fsync_without_dentry], [
3259 #include <linux/fs.h>
3260
3261 int test_fsync(struct file *f, int x) { return 0; }
3262 @@ -34,20 +23,9 @@ AC_DEFUN([ZFS_AC_KERNEL_FSYNC_WITHOUT_DENTRY], [
3263 fops __attribute__ ((unused)) = {
3264 .fsync = test_fsync,
3265 };
3266 - ],[
3267 - ],[
3268 - AC_MSG_RESULT([no dentry])
3269 - AC_DEFINE(HAVE_FSYNC_WITHOUT_DENTRY, 1,
3270 - [fops->fsync() without dentry])
3271 - ],[
3272 - ])
3273 -])
3274 + ],[])
3275
3276 -dnl #
3277 -dnl # Linux 3.1 - 3.x API
3278 -dnl #
3279 -AC_DEFUN([ZFS_AC_KERNEL_FSYNC_RANGE], [
3280 - ZFS_LINUX_TRY_COMPILE([
3281 + ZFS_LINUX_TEST_SRC([fsync_range], [
3282 #include <linux/fs.h>
3283
3284 int test_fsync(struct file *f, loff_t a, loff_t b, int c)
3285 @@ -57,18 +35,43 @@ AC_DEFUN([ZFS_AC_KERNEL_FSYNC_RANGE], [
3286 fops __attribute__ ((unused)) = {
3287 .fsync = test_fsync,
3288 };
3289 - ],[
3290 - ],[
3291 - AC_MSG_RESULT([range])
3292 - AC_DEFINE(HAVE_FSYNC_RANGE, 1,
3293 - [fops->fsync() with range])
3294 - ],[
3295 - ])
3296 + ],[])
3297 ])
3298
3299 AC_DEFUN([ZFS_AC_KERNEL_FSYNC], [
3300 - AC_MSG_CHECKING([whether fops->fsync() wants])
3301 - ZFS_AC_KERNEL_FSYNC_WITH_DENTRY
3302 - ZFS_AC_KERNEL_FSYNC_WITHOUT_DENTRY
3303 - ZFS_AC_KERNEL_FSYNC_RANGE
3304 + dnl #
3305 + dnl # Linux 2.6.x - 2.6.34 API
3306 + dnl #
3307 + AC_MSG_CHECKING([whether fops->fsync() wants dentry])
3308 + ZFS_LINUX_TEST_RESULT([fsync_with_dentry], [
3309 + AC_MSG_RESULT([yes])
3310 + AC_DEFINE(HAVE_FSYNC_WITH_DENTRY, 1,
3311 + [fops->fsync() with dentry])
3312 + ],[
3313 + AC_MSG_RESULT([no])
3314 +
3315 + dnl #
3316 + dnl # Linux 2.6.35 - Linux 3.0 API
3317 + dnl #
3318 + AC_MSG_CHECKING([whether fops->fsync() wants no dentry])
3319 + ZFS_LINUX_TEST_RESULT([fsync_without_dentry], [
3320 + AC_MSG_RESULT([yes])
3321 + AC_DEFINE(HAVE_FSYNC_WITHOUT_DENTRY, 1,
3322 + [fops->fsync() without dentry])
3323 + ],[
3324 + AC_MSG_RESULT([no])
3325 +
3326 + dnl #
3327 + dnl # Linux 3.1 - 3.x API
3328 + dnl #
3329 + AC_MSG_CHECKING([whether fops->fsync() wants range])
3330 + ZFS_LINUX_TEST_RESULT([fsync_range], [
3331 + AC_MSG_RESULT([range])
3332 + AC_DEFINE(HAVE_FSYNC_RANGE, 1,
3333 + [fops->fsync() with range])
3334 + ],[
3335 + ZFS_LINUX_TEST_ERROR([fops->fsync])
3336 + ])
3337 + ])
3338 + ])
3339 ])
3340 diff --git a/config/kernel-generic_io_acct.m4 b/config/kernel-generic_io_acct.m4
3341 index 0aa762162..423b3e5a3 100644
3342 --- a/config/kernel-generic_io_acct.m4
3343 +++ b/config/kernel-generic_io_acct.m4
3344 @@ -1,12 +1,8 @@
3345 dnl #
3346 -dnl # 3.19 API addition
3347 +dnl # Check for generic io accounting interface.
3348 dnl #
3349 -dnl # torvalds/linux@394ffa503bc40e32d7f54a9b817264e81ce131b4 allows us to
3350 -dnl # increment iostat counters without generic_make_request().
3351 -dnl #
3352 -AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT_3ARG], [
3353 - AC_MSG_CHECKING([whether 3 arg generic IO accounting symbols are available])
3354 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
3355 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [
3356 + ZFS_LINUX_TEST_SRC([generic_acct_3args], [
3357 #include <linux/bio.h>
3358
3359 void (*generic_start_io_acct_f)(int, unsigned long,
3360 @@ -16,24 +12,9 @@ AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT_3ARG], [
3361 ], [
3362 generic_start_io_acct(0, 0, NULL);
3363 generic_end_io_acct(0, NULL, 0);
3364 - ], [generic_start_io_acct], [block/bio.c], [
3365 - AC_MSG_RESULT(yes)
3366 - AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1,
3367 - [generic_start_io_acct()/generic_end_io_acct() available])
3368 - ], [
3369 - AC_MSG_RESULT(no)
3370 ])
3371 -])
3372
3373 -dnl #
3374 -dnl # Linux 4.14 API,
3375 -dnl #
3376 -dnl # generic_start_io_acct/generic_end_io_acct now require request_queue to be
3377 -dnl # provided. No functional changes, but preparation for inflight accounting
3378 -dnl #
3379 -AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT_4ARG], [
3380 - AC_MSG_CHECKING([whether 4 arg generic IO accounting symbols are available])
3381 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
3382 + ZFS_LINUX_TEST_SRC([generic_acct_4args], [
3383 #include <linux/bio.h>
3384
3385 void (*generic_start_io_acct_f)(struct request_queue *, int,
3386 @@ -43,11 +24,41 @@ AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT_4ARG], [
3387 ], [
3388 generic_start_io_acct(NULL, 0, 0, NULL);
3389 generic_end_io_acct(NULL, 0, NULL, 0);
3390 - ], [generic_start_io_acct], [block/bio.c], [
3391 + ])
3392 +])
3393 +
3394 +AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [
3395 + dnl #
3396 + dnl # 3.19 API addition
3397 + dnl #
3398 + dnl # torvalds/linux@394ffa50 allows us to increment iostat
3399 + dnl # counters without generic_make_request().
3400 + dnl #
3401 + AC_MSG_CHECKING([whether generic IO accounting wants 3 args])
3402 + ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args],
3403 + [generic_start_io_acct], [block/bio.c], [
3404 AC_MSG_RESULT(yes)
3405 - AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1,
3406 - [generic_start_io_acct()/generic_end_io_acct() 4 arg available])
3407 + AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1,
3408 + [generic_start_io_acct()/generic_end_io_acct() available])
3409 ], [
3410 AC_MSG_RESULT(no)
3411 +
3412 + dnl #
3413 + dnl # Linux 4.14 API,
3414 + dnl #
3415 + dnl # generic_start_io_acct/generic_end_io_acct now require
3416 + dnl # request_queue to be provided. No functional changes,
3417 + dnl # but preparation for inflight accounting.
3418 + dnl #
3419 + AC_MSG_CHECKING([whether generic IO accounting wants 4 args])
3420 + ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args],
3421 + [generic_start_io_acct], [block/bio.c], [
3422 + AC_MSG_RESULT(yes)
3423 + AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1,
3424 + [generic_start_io_acct()/generic_end_io_acct() ]
3425 + [4 arg available])
3426 + ], [
3427 + AC_MSG_RESULT(no)
3428 + ])
3429 ])
3430 ])
3431 diff --git a/config/kernel-generic_readlink.m4 b/config/kernel-generic_readlink.m4
3432 index 914431de4..a7a33b408 100644
3433 --- a/config/kernel-generic_readlink.m4
3434 +++ b/config/kernel-generic_readlink.m4
3435 @@ -4,18 +4,21 @@ dnl #
3436 dnl # NULL inode_operations.readlink implies generic_readlink(), which
3437 dnl # has been made static.
3438 dnl #
3439 -AC_DEFUN([ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL], [
3440 - AC_MSG_CHECKING([whether generic_readlink is global])
3441 - ZFS_LINUX_TRY_COMPILE([
3442 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_READLINK_GLOBAL], [
3443 + ZFS_LINUX_TEST_SRC([generic_readlink_global], [
3444 #include <linux/fs.h>
3445 ],[
3446 int i __attribute__ ((unused));
3447 -
3448 i = generic_readlink(NULL, NULL, 0);
3449 - ],[
3450 + ])
3451 +])
3452 +
3453 +AC_DEFUN([ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL], [
3454 + AC_MSG_CHECKING([whether generic_readlink is global])
3455 + ZFS_LINUX_TEST_RESULT([generic_readlink_global], [
3456 AC_MSG_RESULT([yes])
3457 AC_DEFINE(HAVE_GENERIC_READLINK, 1,
3458 - [generic_readlink is global])
3459 + [generic_readlink is global])
3460 ],[
3461 AC_MSG_RESULT([no])
3462 ])
3463 diff --git a/config/kernel-get-disk-and-module.m4 b/config/kernel-get-disk-and-module.m4
3464 index 2a51a5af7..51cf7743c 100644
3465 --- a/config/kernel-get-disk-and-module.m4
3466 +++ b/config/kernel-get-disk-and-module.m4
3467 @@ -2,14 +2,19 @@ dnl #
3468 dnl # 4.16 API change
3469 dnl # Verify if get_disk_and_module() symbol is available.
3470 dnl #
3471 -AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_AND_MODULE],
3472 - [AC_MSG_CHECKING([whether get_disk_and_module() is available])
3473 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
3474 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_DISK_AND_MODULE], [
3475 + ZFS_LINUX_TEST_SRC([get_disk_and_module], [
3476 #include <linux/genhd.h>
3477 ], [
3478 struct gendisk *disk = NULL;
3479 (void) get_disk_and_module(disk);
3480 - ], [get_disk_and_module], [block/genhd.c], [
3481 + ])
3482 +])
3483 +
3484 +AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_AND_MODULE], [
3485 + AC_MSG_CHECKING([whether get_disk_and_module() is available])
3486 + ZFS_LINUX_TEST_RESULT_SYMBOL([get_disk_and_module],
3487 + [get_disk_and_module], [block/genhd.c], [
3488 AC_MSG_RESULT(yes)
3489 AC_DEFINE(HAVE_GET_DISK_AND_MODULE,
3490 1, [get_disk_and_module() is available])
3491 diff --git a/config/kernel-get-disk-ro.m4 b/config/kernel-get-disk-ro.m4
3492 index 13ed81217..1e2abb475 100644
3493 --- a/config/kernel-get-disk-ro.m4
3494 +++ b/config/kernel-get-disk-ro.m4
3495 @@ -1,21 +1,21 @@
3496 dnl #
3497 dnl # 2.6.x API change
3498 dnl #
3499 -AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_RO], [
3500 - AC_MSG_CHECKING([whether get_disk_ro() is available])
3501 - tmp_flags="$EXTRA_KCFLAGS"
3502 - EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
3503 - ZFS_LINUX_TRY_COMPILE([
3504 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_DISK_RO], [
3505 + ZFS_LINUX_TEST_SRC([get_disk_ro], [
3506 #include <linux/blkdev.h>
3507 ],[
3508 struct gendisk *disk = NULL;
3509 (void) get_disk_ro(disk);
3510 - ],[
3511 + ], [$NO_UNUSED_BUT_SET_VARIABLE])
3512 +])
3513 +
3514 +AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_RO], [
3515 + AC_MSG_CHECKING([whether get_disk_ro() is available])
3516 + ZFS_LINUX_TEST_RESULT([get_disk_ro], [
3517 AC_MSG_RESULT(yes)
3518 - AC_DEFINE(HAVE_GET_DISK_RO, 1,
3519 - [blk_disk_ro() is available])
3520 + AC_DEFINE(HAVE_GET_DISK_RO, 1, [blk_disk_ro() is available])
3521 ],[
3522 AC_MSG_RESULT(no)
3523 ])
3524 - EXTRA_KCFLAGS="$tmp_flags"
3525 ])
3526 diff --git a/config/kernel-get-link.m4 b/config/kernel-get-link.m4
3527 index 3cda08c1b..e4f478e37 100644
3528 --- a/config/kernel-get-link.m4
3529 +++ b/config/kernel-get-link.m4
3530 @@ -1,13 +1,29 @@
3531 dnl #
3532 dnl # Supported get_link() interfaces checked newest to oldest.
3533 +dnl # Note this interface used to be named follow_link.
3534 dnl #
3535 -AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_LINK], [
3536 - dnl #
3537 - dnl # 4.2 API change
3538 - dnl # - This kernel retired the nameidata structure.
3539 - dnl #
3540 - AC_MSG_CHECKING([whether iops->follow_link() passes cookie])
3541 - ZFS_LINUX_TRY_COMPILE([
3542 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_LINK], [
3543 + ZFS_LINUX_TEST_SRC([inode_operations_get_link], [
3544 + #include <linux/fs.h>
3545 + const char *get_link(struct dentry *de, struct inode *ip,
3546 + struct delayed_call *done) { return "symlink"; }
3547 + static struct inode_operations
3548 + iops __attribute__ ((unused)) = {
3549 + .get_link = get_link,
3550 + };
3551 + ],[])
3552 +
3553 + ZFS_LINUX_TEST_SRC([inode_operations_get_link_cookie], [
3554 + #include <linux/fs.h>
3555 + const char *get_link(struct dentry *de, struct
3556 + inode *ip, void **cookie) { return "symlink"; }
3557 + static struct inode_operations
3558 + iops __attribute__ ((unused)) = {
3559 + .get_link = get_link,
3560 + };
3561 + ],[])
3562 +
3563 + ZFS_LINUX_TEST_SRC([inode_operations_follow_link], [
3564 #include <linux/fs.h>
3565 const char *follow_link(struct dentry *de,
3566 void **cookie) { return "symlink"; }
3567 @@ -15,35 +31,17 @@ AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_LINK], [
3568 iops __attribute__ ((unused)) = {
3569 .follow_link = follow_link,
3570 };
3571 - ],[
3572 - ],[
3573 - AC_MSG_RESULT(yes)
3574 - AC_DEFINE(HAVE_FOLLOW_LINK_COOKIE, 1,
3575 - [iops->follow_link() cookie])
3576 - ],[
3577 - dnl #
3578 - dnl # 2.6.32 API
3579 - dnl #
3580 - AC_MSG_RESULT(no)
3581 - AC_MSG_CHECKING(
3582 - [whether iops->follow_link() passes nameidata])
3583 - ZFS_LINUX_TRY_COMPILE([
3584 + ],[])
3585 +
3586 + ZFS_LINUX_TEST_SRC([inode_operations_follow_link_nameidata], [
3587 #include <linux/fs.h>
3588 - void *follow_link(struct dentry *de, struct
3589 - nameidata *nd) { return (void *)NULL; }
3590 - static struct inode_operations
3591 - iops __attribute__ ((unused)) = {
3592 - .follow_link = follow_link,
3593 - };
3594 - ],[
3595 - ],[
3596 - AC_MSG_RESULT(yes)
3597 - AC_DEFINE(HAVE_FOLLOW_LINK_NAMEIDATA, 1,
3598 - [iops->follow_link() nameidata])
3599 - ],[
3600 - AC_MSG_ERROR(no; please file a bug report)
3601 - ])
3602 - ])
3603 + void *follow_link(struct dentry *de, struct
3604 + nameidata *nd) { return (void *)NULL; }
3605 + static struct inode_operations
3606 + iops __attribute__ ((unused)) = {
3607 + .follow_link = follow_link,
3608 + };
3609 + ],[])
3610 ])
3611
3612 AC_DEFUN([ZFS_AC_KERNEL_GET_LINK], [
3613 @@ -53,20 +51,12 @@ AC_DEFUN([ZFS_AC_KERNEL_GET_LINK], [
3614 dnl # used it to retire the put_link() interface.
3615 dnl #
3616 AC_MSG_CHECKING([whether iops->get_link() passes delayed])
3617 - ZFS_LINUX_TRY_COMPILE([
3618 - #include <linux/fs.h>
3619 - const char *get_link(struct dentry *de, struct inode *ip,
3620 - struct delayed_call *done) { return "symlink"; }
3621 - static struct inode_operations
3622 - iops __attribute__ ((unused)) = {
3623 - .get_link = get_link,
3624 - };
3625 - ],[
3626 - ],[
3627 + ZFS_LINUX_TEST_RESULT([inode_operations_get_link], [
3628 AC_MSG_RESULT(yes)
3629 - AC_DEFINE(HAVE_GET_LINK_DELAYED, 1,
3630 - [iops->get_link() delayed])
3631 + AC_DEFINE(HAVE_GET_LINK_DELAYED, 1, [iops->get_link() delayed])
3632 ],[
3633 + AC_MSG_RESULT(no)
3634 +
3635 dnl #
3636 dnl # 4.5 API change
3637 dnl # The follow_link() interface has been replaced by
3638 @@ -74,27 +64,41 @@ AC_DEFUN([ZFS_AC_KERNEL_GET_LINK], [
3639 dnl # - An inode is passed as a separate argument
3640 dnl # - When called in RCU mode a NULL dentry is passed.
3641 dnl #
3642 - AC_MSG_RESULT(no)
3643 AC_MSG_CHECKING([whether iops->get_link() passes cookie])
3644 - ZFS_LINUX_TRY_COMPILE([
3645 - #include <linux/fs.h>
3646 - const char *get_link(struct dentry *de, struct
3647 - inode *ip, void **cookie) { return "symlink"; }
3648 - static struct inode_operations
3649 - iops __attribute__ ((unused)) = {
3650 - .get_link = get_link,
3651 - };
3652 - ],[
3653 - ],[
3654 + ZFS_LINUX_TEST_RESULT([inode_operations_get_link_cookie], [
3655 AC_MSG_RESULT(yes)
3656 AC_DEFINE(HAVE_GET_LINK_COOKIE, 1,
3657 [iops->get_link() cookie])
3658 ],[
3659 + AC_MSG_RESULT(no)
3660 +
3661 dnl #
3662 - dnl # Check for the follow_link APIs.
3663 + dnl # 4.2 API change
3664 + dnl # This kernel retired the nameidata structure.
3665 dnl #
3666 - AC_MSG_RESULT(no)
3667 - ZFS_AC_KERNEL_FOLLOW_LINK
3668 + AC_MSG_CHECKING(
3669 + [whether iops->follow_link() passes cookie])
3670 + ZFS_LINUX_TEST_RESULT([inode_operations_follow_link], [
3671 + AC_MSG_RESULT(yes)
3672 + AC_DEFINE(HAVE_FOLLOW_LINK_COOKIE, 1,
3673 + [iops->follow_link() cookie])
3674 + ],[
3675 + AC_MSG_RESULT(no)
3676 +
3677 + dnl #
3678 + dnl # 2.6.32 API
3679 + dnl #
3680 + AC_MSG_CHECKING(
3681 + [whether iops->follow_link() passes nameidata])
3682 + ZFS_LINUX_TEST_RESULT(
3683 + [inode_operations_follow_link_nameidata],[
3684 + AC_MSG_RESULT(yes)
3685 + AC_DEFINE(HAVE_FOLLOW_LINK_NAMEIDATA, 1,
3686 + [iops->follow_link() nameidata])
3687 + ],[
3688 + ZFS_LINUX_TEST_ERROR([get_link])
3689 + ])
3690 + ])
3691 ])
3692 ])
3693 ])
3694 diff --git a/config/kernel-global_page_state.m4 b/config/kernel-global_page_state.m4
3695 index f4a40011f..a0cb9e2c8 100644
3696 --- a/config/kernel-global_page_state.m4
3697 +++ b/config/kernel-global_page_state.m4
3698 @@ -4,16 +4,21 @@ dnl #
3699 dnl # 75ef71840539 mm, vmstat: add infrastructure for per-node vmstats
3700 dnl # 599d0c954f91 mm, vmscan: move LRU lists to node
3701 dnl #
3702 -AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_NODE_PAGE_STATE], [
3703 - AC_MSG_CHECKING([whether global_node_page_state() exists])
3704 - ZFS_LINUX_TRY_COMPILE([
3705 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GLOBAL_NODE_PAGE_STATE], [
3706 + ZFS_LINUX_TEST_SRC([global_node_page_state], [
3707 #include <linux/mm.h>
3708 #include <linux/vmstat.h>
3709 ],[
3710 (void) global_node_page_state(0);
3711 - ],[
3712 + ])
3713 +])
3714 +
3715 +AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_NODE_PAGE_STATE], [
3716 + AC_MSG_CHECKING([whether global_node_page_state() exists])
3717 + ZFS_LINUX_TEST_RESULT([global_node_page_state], [
3718 AC_MSG_RESULT(yes)
3719 - AC_DEFINE(ZFS_GLOBAL_NODE_PAGE_STATE, 1, [global_node_page_state() exists])
3720 + AC_DEFINE(ZFS_GLOBAL_NODE_PAGE_STATE, 1,
3721 + [global_node_page_state() exists])
3722 ],[
3723 AC_MSG_RESULT(no)
3724 ])
3725 @@ -24,16 +29,21 @@ dnl # 4.14 API change
3726 dnl #
3727 dnl # c41f012ade0b mm: rename global_page_state to global_zone_page_state
3728 dnl #
3729 -AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE], [
3730 - AC_MSG_CHECKING([whether global_zone_page_state() exists])
3731 - ZFS_LINUX_TRY_COMPILE([
3732 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GLOBAL_ZONE_PAGE_STATE], [
3733 + ZFS_LINUX_TEST_SRC([global_zone_page_state], [
3734 #include <linux/mm.h>
3735 #include <linux/vmstat.h>
3736 ],[
3737 (void) global_zone_page_state(0);
3738 - ],[
3739 + ])
3740 +])
3741 +
3742 +AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE], [
3743 + AC_MSG_CHECKING([whether global_zone_page_state() exists])
3744 + ZFS_LINUX_TEST_RESULT([global_zone_page_state], [
3745 AC_MSG_RESULT(yes)
3746 - AC_DEFINE(ZFS_GLOBAL_ZONE_PAGE_STATE, 1, [global_zone_page_state() exists])
3747 + AC_DEFINE(ZFS_GLOBAL_ZONE_PAGE_STATE, 1,
3748 + [global_zone_page_state() exists])
3749 ],[
3750 AC_MSG_RESULT(no)
3751 ])
3752 @@ -44,9 +54,11 @@ dnl # Create a define and autoconf variable for an enum member
3753 dnl #
3754 AC_DEFUN([ZFS_AC_KERNEL_ENUM_MEMBER], [
3755 AC_MSG_CHECKING([whether enum $2 contains $1])
3756 - AS_IF([AC_TRY_COMMAND("${srcdir}/scripts/enum-extract.pl" "$2" "$3" | egrep -qx $1)],[
3757 + AS_IF([AC_TRY_COMMAND(
3758 + "${srcdir}/scripts/enum-extract.pl" "$2" "$3" | egrep -qx $1)],[
3759 AC_MSG_RESULT([yes])
3760 - AC_DEFINE(m4_join([_], [ZFS_ENUM], m4_toupper($2), $1), 1, [enum $2 contains $1])
3761 + AC_DEFINE(m4_join([_], [ZFS_ENUM], m4_toupper($2), $1), 1,
3762 + [enum $2 contains $1])
3763 m4_join([_], [ZFS_ENUM], m4_toupper($2), $1)=1
3764 ],[
3765 AC_MSG_RESULT([no])
3766 @@ -59,8 +71,7 @@ dnl #
3767 AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR],[
3768 AC_MSG_RESULT(no)
3769 AC_MSG_RESULT([$1 in either node_stat_item or zone_stat_item: $2])
3770 - AC_MSG_RESULT([configure needs updating, see: config/kernel-global_page_state.m4])
3771 - AC_MSG_FAILURE([SHUT 'ER DOWN CLANCY, SHE'S PUMPIN' MUD!])
3772 + ZFS_LINUX_TEST_ERROR([global page state])
3773 ])
3774
3775 AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK], [
3776 @@ -75,10 +86,10 @@ AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK], [
3777 ])
3778
3779 dnl #
3780 -dnl # Ensure the config tests are finding one and only one of each enum of interest
3781 +dnl # Ensure the config tests are finding one and only one of each enum.
3782 dnl #
3783 AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY], [
3784 - AC_MSG_CHECKING([global_page_state enums are sane])
3785 + AC_MSG_CHECKING([whether global_page_state enums are sane])
3786
3787 ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_FILE_PAGES])
3788 ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_ANON])
3789 @@ -88,6 +99,11 @@ AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY], [
3790 AC_MSG_RESULT(yes)
3791 ])
3792
3793 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GLOBAL_PAGE_STATE], [
3794 + ZFS_AC_KERNEL_SRC_GLOBAL_NODE_PAGE_STATE
3795 + ZFS_AC_KERNEL_SRC_GLOBAL_ZONE_PAGE_STATE
3796 +])
3797 +
3798 dnl #
3799 dnl # enum members in which we're interested
3800 dnl #
3801 @@ -95,15 +111,23 @@ AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE], [
3802 ZFS_AC_KERNEL_GLOBAL_NODE_PAGE_STATE
3803 ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE
3804
3805 - ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES], [node_stat_item], [$LINUX/include/linux/mmzone.h])
3806 - ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON], [node_stat_item], [$LINUX/include/linux/mmzone.h])
3807 - ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE], [node_stat_item], [$LINUX/include/linux/mmzone.h])
3808 - ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE], [node_stat_item], [$LINUX/include/linux/mmzone.h])
3809 + ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES],
3810 + [node_stat_item], [$LINUX/include/linux/mmzone.h])
3811 + ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON],
3812 + [node_stat_item], [$LINUX/include/linux/mmzone.h])
3813 + ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE],
3814 + [node_stat_item], [$LINUX/include/linux/mmzone.h])
3815 + ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE],
3816 + [node_stat_item], [$LINUX/include/linux/mmzone.h])
3817
3818 - ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
3819 - ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
3820 - ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
3821 - ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
3822 + ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES],
3823 + [zone_stat_item], [$LINUX/include/linux/mmzone.h])
3824 + ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON],
3825 + [zone_stat_item], [$LINUX/include/linux/mmzone.h])
3826 + ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE],
3827 + [zone_stat_item], [$LINUX/include/linux/mmzone.h])
3828 + ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE],
3829 + [zone_stat_item], [$LINUX/include/linux/mmzone.h])
3830
3831 ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY
3832 ])
3833 diff --git a/config/kernel-group-info.m4 b/config/kernel-group-info.m4
3834 index 849a1e246..0fee1d36d 100644
3835 --- a/config/kernel-group-info.m4
3836 +++ b/config/kernel-group-info.m4
3837 @@ -2,20 +2,21 @@ dnl #
3838 dnl # 4.9 API change
3839 dnl # group_info changed from 2d array via >blocks to 1d array via ->gid
3840 dnl #
3841 -AC_DEFUN([ZFS_AC_KERNEL_GROUP_INFO_GID], [
3842 - AC_MSG_CHECKING([whether group_info->gid exists])
3843 - tmp_flags="$EXTRA_KCFLAGS"
3844 - EXTRA_KCFLAGS="-Werror"
3845 - ZFS_LINUX_TRY_COMPILE([
3846 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GROUP_INFO_GID], [
3847 + ZFS_LINUX_TEST_SRC([group_info_gid], [
3848 #include <linux/cred.h>
3849 ],[
3850 struct group_info *gi = groups_alloc(1);
3851 gi->gid[0] = KGIDT_INIT(0);
3852 - ],[
3853 + ])
3854 +])
3855 +
3856 +AC_DEFUN([ZFS_AC_KERNEL_GROUP_INFO_GID], [
3857 + AC_MSG_CHECKING([whether group_info->gid exists])
3858 + ZFS_LINUX_TEST_RESULT([group_info_gid], [
3859 AC_MSG_RESULT(yes)
3860 AC_DEFINE(HAVE_GROUP_INFO_GID, 1, [group_info->gid exists])
3861 ],[
3862 AC_MSG_RESULT(no)
3863 ])
3864 - EXTRA_KCFLAGS="$tmp_flags"
3865 ])
3866 diff --git a/config/kernel-in-compat-syscall.m4 b/config/kernel-in-compat-syscall.m4
3867 index 9fca9da20..baaac8c4f 100644
3868 --- a/config/kernel-in-compat-syscall.m4
3869 +++ b/config/kernel-in-compat-syscall.m4
3870 @@ -4,13 +4,17 @@ dnl # Added in_compat_syscall() which can be overridden on a per-
3871 dnl # architecture basis. Prior to this is_compat_task() was the
3872 dnl # provided interface.
3873 dnl #
3874 -AC_DEFUN([ZFS_AC_KERNEL_IN_COMPAT_SYSCALL], [
3875 - AC_MSG_CHECKING([whether in_compat_syscall() is available])
3876 - ZFS_LINUX_TRY_COMPILE([
3877 +AC_DEFUN([ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL], [
3878 + ZFS_LINUX_TEST_SRC([in_compat_syscall], [
3879 #include <linux/compat.h>
3880 ],[
3881 in_compat_syscall();
3882 - ],[
3883 + ])
3884 +])
3885 +
3886 +AC_DEFUN([ZFS_AC_KERNEL_IN_COMPAT_SYSCALL], [
3887 + AC_MSG_CHECKING([whether in_compat_syscall() is available])
3888 + ZFS_LINUX_TEST_RESULT([in_compat_syscall], [
3889 AC_MSG_RESULT(yes)
3890 AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
3891 [in_compat_syscall() is available])
3892 diff --git a/config/kernel-inode-getattr.m4 b/config/kernel-inode-getattr.m4
3893 index f10e0b251..48391d66f 100644
3894 --- a/config/kernel-inode-getattr.m4
3895 +++ b/config/kernel-inode-getattr.m4
3896 @@ -2,9 +2,8 @@ dnl #
3897 dnl # Linux 4.11 API
3898 dnl # See torvalds/linux@a528d35
3899 dnl #
3900 -AC_DEFUN([ZFS_AC_PATH_KERNEL_IOPS_GETATTR], [
3901 - AC_MSG_CHECKING([whether iops->getattr() takes a path])
3902 - ZFS_LINUX_TRY_COMPILE([
3903 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
3904 + ZFS_LINUX_TEST_SRC([inode_operations_getattr_path], [
3905 #include <linux/fs.h>
3906
3907 int test_getattr(
3908 @@ -16,24 +15,9 @@ AC_DEFUN([ZFS_AC_PATH_KERNEL_IOPS_GETATTR], [
3909 iops __attribute__ ((unused)) = {
3910 .getattr = test_getattr,
3911 };
3912 - ],[
3913 - ],[
3914 - AC_MSG_RESULT(yes)
3915 - AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
3916 - [iops->getattr() takes a path])
3917 - ],[
3918 - AC_MSG_RESULT(no)
3919 - ])
3920 -])
3921 -
3922 + ],[])
3923
3924 -
3925 -dnl #
3926 -dnl # Linux 3.9 - 4.10 API
3927 -dnl #
3928 -AC_DEFUN([ZFS_AC_VFSMOUNT_KERNEL_IOPS_GETATTR], [
3929 - AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount])
3930 - ZFS_LINUX_TRY_COMPILE([
3931 + ZFS_LINUX_TEST_SRC([inode_operations_getattr_vfsmount], [
3932 #include <linux/fs.h>
3933
3934 int test_getattr(
3935 @@ -45,23 +29,25 @@ AC_DEFUN([ZFS_AC_VFSMOUNT_KERNEL_IOPS_GETATTR], [
3936 iops __attribute__ ((unused)) = {
3937 .getattr = test_getattr,
3938 };
3939 - ],[
3940 - ],[
3941 + ],[])
3942 +])
3943 +
3944 +AC_DEFUN([ZFS_AC_KERNEL_INODE_GETATTR], [
3945 + AC_MSG_CHECKING([whether iops->getattr() takes a path])
3946 + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [
3947 AC_MSG_RESULT(yes)
3948 - AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1,
3949 - [iops->getattr() takes a vfsmount])
3950 + AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
3951 + [iops->getattr() takes a path])
3952 ],[
3953 AC_MSG_RESULT(no)
3954 - ])
3955 -])
3956 -
3957
3958 -dnl #
3959 -dnl # The interface of the getattr callback from the inode_operations
3960 -dnl # structure changed. Also, the interface of the simple_getattr()
3961 -dnl # function provided by the kernel changed.
3962 -dnl #
3963 -AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GETATTR], [
3964 - ZFS_AC_PATH_KERNEL_IOPS_GETATTR
3965 - ZFS_AC_VFSMOUNT_KERNEL_IOPS_GETATTR
3966 + AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount])
3967 + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [
3968 + AC_MSG_RESULT(yes)
3969 + AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1,
3970 + [iops->getattr() takes a vfsmount])
3971 + ],[
3972 + AC_MSG_RESULT(no)
3973 + ])
3974 + ])
3975 ])
3976 diff --git a/config/kernel-inode-lock.m4 b/config/kernel-inode-lock.m4
3977 index 8dee01422..5eb04af78 100644
3978 --- a/config/kernel-inode-lock.m4
3979 +++ b/config/kernel-inode-lock.m4
3980 @@ -4,20 +4,21 @@ dnl # i_mutex is changed to i_rwsem. Instead of directly using
3981 dnl # i_mutex/i_rwsem, we should use inode_lock() and inode_lock_shared()
3982 dnl # We test inode_lock_shared because inode_lock is introduced earlier.
3983 dnl #
3984 -AC_DEFUN([ZFS_AC_KERNEL_INODE_LOCK], [
3985 - AC_MSG_CHECKING([whether inode_lock_shared() exists])
3986 - tmp_flags="$EXTRA_KCFLAGS"
3987 - EXTRA_KCFLAGS="-Werror"
3988 - ZFS_LINUX_TRY_COMPILE([
3989 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_LOCK], [
3990 + ZFS_LINUX_TEST_SRC([inode_lock], [
3991 #include <linux/fs.h>
3992 ],[
3993 struct inode *inode = NULL;
3994 inode_lock_shared(inode);
3995 - ],[
3996 + ])
3997 +])
3998 +
3999 +AC_DEFUN([ZFS_AC_KERNEL_INODE_LOCK], [
4000 + AC_MSG_CHECKING([whether inode_lock_shared() exists])
4001 + ZFS_LINUX_TEST_RESULT([inode_lock], [
4002 AC_MSG_RESULT(yes)
4003 AC_DEFINE(HAVE_INODE_LOCK_SHARED, 1, [yes])
4004 ],[
4005 AC_MSG_RESULT(no)
4006 ])
4007 - EXTRA_KCFLAGS="$tmp_flags"
4008 ])
4009 diff --git a/config/kernel-inode-set-flags.m4 b/config/kernel-inode-set-flags.m4
4010 index e0ad26796..133f666a9 100644
4011 --- a/config/kernel-inode-set-flags.m4
4012 +++ b/config/kernel-inode-set-flags.m4
4013 @@ -2,14 +2,18 @@ dnl #
4014 dnl # 3.15 API change
4015 dnl # inode_set_flags introduced to set i_flags
4016 dnl #
4017 -AC_DEFUN([ZFS_AC_KERNEL_INODE_SET_FLAGS], [
4018 - AC_MSG_CHECKING([whether inode_set_flags() exists])
4019 - ZFS_LINUX_TRY_COMPILE([
4020 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_SET_FLAGS], [
4021 + ZFS_LINUX_TEST_SRC([inode_set_flags], [
4022 #include <linux/fs.h>
4023 ],[
4024 struct inode inode;
4025 inode_set_flags(&inode, S_IMMUTABLE, S_IMMUTABLE);
4026 - ],[
4027 + ])
4028 +])
4029 +
4030 +AC_DEFUN([ZFS_AC_KERNEL_INODE_SET_FLAGS], [
4031 + AC_MSG_CHECKING([whether inode_set_flags() exists])
4032 + ZFS_LINUX_TEST_RESULT([inode_set_flags], [
4033 AC_MSG_RESULT(yes)
4034 AC_DEFINE(HAVE_INODE_SET_FLAGS, 1, [inode_set_flags() exists])
4035 ],[
4036 diff --git a/config/kernel-inode-set-iversion.m4 b/config/kernel-inode-set-iversion.m4
4037 index 9a7d7890e..dd415de32 100644
4038 --- a/config/kernel-inode-set-iversion.m4
4039 +++ b/config/kernel-inode-set-iversion.m4
4040 @@ -2,14 +2,18 @@ dnl #
4041 dnl # 4.16 API change
4042 dnl # inode_set_iversion introduced to set i_version
4043 dnl #
4044 -AC_DEFUN([ZFS_AC_KERNEL_INODE_SET_IVERSION], [
4045 - AC_MSG_CHECKING([whether inode_set_iversion() exists])
4046 - ZFS_LINUX_TRY_COMPILE([
4047 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_SET_IVERSION], [
4048 + ZFS_LINUX_TEST_SRC([inode_set_iversion], [
4049 #include <linux/iversion.h>
4050 ],[
4051 struct inode inode;
4052 inode_set_iversion(&inode, 1);
4053 - ],[
4054 + ])
4055 +])
4056 +
4057 +AC_DEFUN([ZFS_AC_KERNEL_INODE_SET_IVERSION], [
4058 + AC_MSG_CHECKING([whether inode_set_iversion() exists])
4059 + ZFS_LINUX_TEST_RESULT([inode_set_iversion], [
4060 AC_MSG_RESULT(yes)
4061 AC_DEFINE(HAVE_INODE_SET_IVERSION, 1,
4062 [inode_set_iversion() exists])
4063 diff --git a/config/kernel-inode-times.m4 b/config/kernel-inode-times.m4
4064 index f5818411a..57e7f31fd 100644
4065 --- a/config/kernel-inode-times.m4
4066 +++ b/config/kernel-inode-times.m4
4067 @@ -2,11 +2,8 @@ dnl #
4068 dnl # 4.18 API change
4069 dnl # i_atime, i_mtime, and i_ctime changed from timespec to timespec64.
4070 dnl #
4071 -AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
4072 - AC_MSG_CHECKING([whether inode->i_*time's are timespec64])
4073 - tmp_flags="$EXTRA_KCFLAGS"
4074 - EXTRA_KCFLAGS="-Werror"
4075 - ZFS_LINUX_TRY_COMPILE([
4076 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_TIMES], [
4077 + ZFS_LINUX_TEST_SRC([inode_times], [
4078 #include <linux/fs.h>
4079 ],[
4080 struct inode ip;
4081 @@ -14,12 +11,16 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
4082
4083 memset(&ip, 0, sizeof(ip));
4084 ts = ip.i_mtime;
4085 - ],[
4086 + ])
4087 +])
4088 +
4089 +AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
4090 + AC_MSG_CHECKING([whether inode->i_*time's are timespec64])
4091 + ZFS_LINUX_TEST_RESULT([inode_times], [
4092 AC_MSG_RESULT(no)
4093 ],[
4094 AC_MSG_RESULT(yes)
4095 AC_DEFINE(HAVE_INODE_TIMESPEC64_TIMES, 1,
4096 [inode->i_*time's are timespec64])
4097 ])
4098 - EXTRA_KCFLAGS="$tmp_flags"
4099 ])
4100 diff --git a/config/kernel-insert-inode-locked.m4 b/config/kernel-insert-inode-locked.m4
4101 index da141d180..4990399c3 100644
4102 --- a/config/kernel-insert-inode-locked.m4
4103 +++ b/config/kernel-insert-inode-locked.m4
4104 @@ -2,16 +2,21 @@ dnl #
4105 dnl # 2.6.28 API change
4106 dnl # Added insert_inode_locked() helper function.
4107 dnl #
4108 -AC_DEFUN([ZFS_AC_KERNEL_INSERT_INODE_LOCKED],
4109 - [AC_MSG_CHECKING([whether insert_inode_locked() is available])
4110 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
4111 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INSERT_INODE_LOCKED], [
4112 + ZFS_LINUX_TEST_SRC([insert_inode_locked], [
4113 #include <linux/fs.h>
4114 ], [
4115 insert_inode_locked(NULL);
4116 - ], [insert_inode_locked], [fs/inode.c], [
4117 + ])
4118 +])
4119 +
4120 +AC_DEFUN([ZFS_AC_KERNEL_INSERT_INODE_LOCKED], [
4121 + AC_MSG_CHECKING([whether insert_inode_locked() is available])
4122 + ZFS_LINUX_TEST_RESULT_SYMBOL([insert_inode_locked],
4123 + [insert_inode_locked], [fs/inode.c], [
4124 AC_MSG_RESULT(yes)
4125 AC_DEFINE(HAVE_INSERT_INODE_LOCKED, 1,
4126 - [insert_inode_locked() is available])
4127 + [insert_inode_locked() is available])
4128 ], [
4129 AC_MSG_RESULT(no)
4130 ])
4131 diff --git a/config/kernel-invalidate-bdev-args.m4 b/config/kernel-invalidate-bdev-args.m4
4132 index 09c2ebf26..55a784dd9 100644
4133 --- a/config/kernel-invalidate-bdev-args.m4
4134 +++ b/config/kernel-invalidate-bdev-args.m4
4135 @@ -2,17 +2,21 @@ dnl #
4136 dnl # 2.6.22 API change
4137 dnl # Unused destroy_dirty_buffers arg removed from prototype.
4138 dnl #
4139 -AC_DEFUN([ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS], [
4140 - AC_MSG_CHECKING([whether invalidate_bdev() wants 1 arg])
4141 - ZFS_LINUX_TRY_COMPILE([
4142 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INVALIDATE_BDEV], [
4143 + ZFS_LINUX_TEST_SRC([invalidate_bdev], [
4144 #include <linux/buffer_head.h>
4145 ],[
4146 struct block_device *bdev = NULL;
4147 invalidate_bdev(bdev);
4148 - ],[
4149 + ])
4150 +])
4151 +
4152 +AC_DEFUN([ZFS_AC_KERNEL_INVALIDATE_BDEV], [
4153 + AC_MSG_CHECKING([whether invalidate_bdev() wants 1 arg])
4154 + ZFS_LINUX_TEST_RESULT([invalidate_bdev], [
4155 AC_MSG_RESULT(yes)
4156 AC_DEFINE(HAVE_1ARG_INVALIDATE_BDEV, 1,
4157 - [invalidate_bdev() wants 1 arg])
4158 + [invalidate_bdev() wants 1 arg])
4159 ],[
4160 AC_MSG_RESULT(no)
4161 ])
4162 diff --git a/config/kernel-is_owner_or_cap.m4 b/config/kernel-is_owner_or_cap.m4
4163 index da07e58dd..ab8072409 100644
4164 --- a/config/kernel-is_owner_or_cap.m4
4165 +++ b/config/kernel-is_owner_or_cap.m4
4166 @@ -4,33 +4,40 @@ dnl # The is_owner_or_cap() macro was renamed to inode_owner_or_capable(),
4167 dnl # This is used for permission checks in the xattr and file attribute call
4168 dnl # paths.
4169 dnl #
4170 -AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [
4171 - AC_MSG_CHECKING([whether inode_owner_or_capable() exists])
4172 - ZFS_LINUX_TRY_COMPILE([
4173 +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE], [
4174 + ZFS_LINUX_TEST_SRC([inode_owner_or_capable], [
4175 #include <linux/fs.h>
4176 ],[
4177 struct inode *ip = NULL;
4178 (void) inode_owner_or_capable(ip);
4179 + ])
4180 +
4181 +
4182 + ZFS_LINUX_TEST_SRC([is_owner_or_cap], [
4183 + #include <linux/fs.h>
4184 + #include <linux/sched.h>
4185 ],[
4186 + struct inode *ip = NULL;
4187 + (void) is_owner_or_cap(ip);
4188 + ])
4189 +])
4190 +
4191 +AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [
4192 + AC_MSG_CHECKING([whether inode_owner_or_capable() exists])
4193 + ZFS_LINUX_TEST_RESULT([inode_owner_or_capable], [
4194 AC_MSG_RESULT(yes)
4195 AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
4196 [inode_owner_or_capable() exists])
4197 ],[
4198 AC_MSG_RESULT(no)
4199 AC_MSG_CHECKING([whether is_owner_or_cap() exists])
4200 - ZFS_LINUX_TRY_COMPILE([
4201 - #include <linux/fs.h>
4202 - #include <linux/sched.h>
4203 - ],[
4204 - struct inode *ip = NULL;
4205 - (void) is_owner_or_cap(ip);
4206 - ],[
4207 +
4208 + ZFS_LINUX_TEST_RESULT([is_owner_or_cap], [
4209 AC_MSG_RESULT(yes)
4210 AC_DEFINE(HAVE_IS_OWNER_OR_CAP, 1,
4211 [is_owner_or_cap() exists])
4212 ],[
4213 - AC_MSG_ERROR(no - Please file a bug report at
4214 - https://github.com/zfsonlinux/zfs/issues/new)
4215 + ZFS_LINUX_TEST_ERROR([capability])
4216 ])
4217 ])
4218 ])
4219 diff --git a/config/kernel-kmap-atomic-args.m4 b/config/kernel-kmap-atomic-args.m4
4220 index beb1692e7..d09e93d7f 100644
4221 --- a/config/kernel-kmap-atomic-args.m4
4222 +++ b/config/kernel-kmap-atomic-args.m4
4223 @@ -3,17 +3,21 @@ dnl # 2.6.37 API change
4224 dnl # kmap_atomic changed from assigning hard-coded named slot to using
4225 dnl # push/pop based dynamical allocation.
4226 dnl #
4227 -AC_DEFUN([ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS], [
4228 - AC_MSG_CHECKING([whether kmap_atomic wants 1 args])
4229 - ZFS_LINUX_TRY_COMPILE([
4230 +AC_DEFUN([ZFS_AC_KERNEL_SRC_KMAP_ATOMIC_ARGS], [
4231 + ZFS_LINUX_TEST_SRC([kmap_atomic], [
4232 #include <linux/pagemap.h>
4233 ],[
4234 struct page page;
4235 kmap_atomic(&page);
4236 - ],[
4237 + ])
4238 +])
4239 +
4240 +AC_DEFUN([ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS], [
4241 + AC_MSG_CHECKING([whether kmap_atomic wants 1 args])
4242 + ZFS_LINUX_TEST_RESULT([kmap_atomic], [
4243 AC_MSG_RESULT(yes)
4244 AC_DEFINE(HAVE_1ARG_KMAP_ATOMIC, 1,
4245 - [kmap_atomic wants 1 args])
4246 + [kmap_atomic wants 1 args])
4247 ],[
4248 AC_MSG_RESULT(no)
4249 ])
4250 diff --git a/config/kernel-kmem-cache.m4 b/config/kernel-kmem-cache.m4
4251 index 21cc53d34..7576e6cfd 100644
4252 --- a/config/kernel-kmem-cache.m4
4253 +++ b/config/kernel-kmem-cache.m4
4254 @@ -5,30 +5,36 @@ dnl # private allocation flags which are applied when allocating a new slab
4255 dnl # in kmem_getpages(). Unfortunately there is no public API for setting
4256 dnl # non-default flags.
4257 dnl #
4258 -AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS], [
4259 - AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
4260 - ZFS_LINUX_TRY_COMPILE([
4261 +AC_DEFUN([ZFS_AC_KERNEL_SRC_KMEM_CACHE_ALLOCFLAGS], [
4262 + ZFS_LINUX_TEST_SRC([kmem_cache_allocflags], [
4263 #include <linux/slab.h>
4264 ],[
4265 struct kmem_cache cachep __attribute__ ((unused));
4266 cachep.allocflags = GFP_KERNEL;
4267 + ])
4268 +
4269 + ZFS_LINUX_TEST_SRC([kmem_cache_gfpflags], [
4270 + #include <linux/slab.h>
4271 ],[
4272 + struct kmem_cache cachep __attribute__ ((unused));
4273 + cachep.gfpflags = GFP_KERNEL;
4274 + ])
4275 +])
4276 +
4277 +AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS], [
4278 + AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
4279 + ZFS_LINUX_TEST_RESULT([kmem_cache_allocflags], [
4280 AC_MSG_RESULT(yes)
4281 AC_DEFINE(HAVE_KMEM_CACHE_ALLOCFLAGS, 1,
4282 - [struct kmem_cache has allocflags])
4283 + [struct kmem_cache has allocflags])
4284 ],[
4285 AC_MSG_RESULT(no)
4286
4287 AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
4288 - ZFS_LINUX_TRY_COMPILE([
4289 - #include <linux/slab.h>
4290 - ],[
4291 - struct kmem_cache cachep __attribute__ ((unused));
4292 - cachep.gfpflags = GFP_KERNEL;
4293 - ],[
4294 + ZFS_LINUX_TEST_RESULT([kmem_cache_gfpflags], [
4295 AC_MSG_RESULT(yes)
4296 AC_DEFINE(HAVE_KMEM_CACHE_GFPFLAGS, 1,
4297 - [struct kmem_cache has gfpflags])
4298 + [struct kmem_cache has gfpflags])
4299 ],[
4300 AC_MSG_RESULT(no)
4301 ])
4302 @@ -40,16 +46,10 @@ dnl # grsecurity API change,
4303 dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by
4304 dnl # kmem_cache_create_usercopy().
4305 dnl #
4306 -AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY], [
4307 - AC_MSG_CHECKING([whether kmem_cache_create_usercopy() exists])
4308 - tmp_flags="$EXTRA_KCFLAGS"
4309 - EXTRA_KCFLAGS="-Werror"
4310 - ZFS_LINUX_TRY_COMPILE([
4311 +AC_DEFUN([ZFS_AC_KERNEL_SRC_KMEM_CACHE_CREATE_USERCOPY], [
4312 + ZFS_LINUX_TEST_SRC([kmem_cache_create_usercopy], [
4313 #include <linux/slab.h>
4314 - static void ctor(void *foo)
4315 - {
4316 - // fake ctor
4317 - }
4318 + static void ctor(void *foo) { /* fake ctor */ }
4319 ],[
4320 struct kmem_cache *skc_linux_cache;
4321 const char *name = "test";
4322 @@ -60,13 +60,27 @@ AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY], [
4323 size_t usersize = size - useroffset;
4324
4325 skc_linux_cache = kmem_cache_create_usercopy(
4326 - name, size, align, flags, useroffset, usersize, ctor);
4327 - ],[
4328 + name, size, align, flags, useroffset, usersize, ctor);
4329 + ])
4330 +])
4331 +
4332 +AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY], [
4333 + AC_MSG_CHECKING([whether kmem_cache_create_usercopy() exists])
4334 + ZFS_LINUX_TEST_RESULT([kmem_cache_create_usercopy], [
4335 AC_MSG_RESULT(yes)
4336 AC_DEFINE(HAVE_KMEM_CACHE_CREATE_USERCOPY, 1,
4337 - [kmem_cache_create_usercopy() exists])
4338 + [kmem_cache_create_usercopy() exists])
4339 ],[
4340 AC_MSG_RESULT(no)
4341 ])
4342 - EXTRA_KCFLAGS="$tmp_flags"
4343 +])
4344 +
4345 +AC_DEFUN([ZFS_AC_KERNEL_SRC_KMEM_CACHE], [
4346 + ZFS_AC_KERNEL_SRC_KMEM_CACHE_ALLOCFLAGS
4347 + ZFS_AC_KERNEL_SRC_KMEM_CACHE_CREATE_USERCOPY
4348 +])
4349 +
4350 +AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE], [
4351 + ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS
4352 + ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY
4353 ])
4354 diff --git a/config/kernel-kstrtoul.m4 b/config/kernel-kstrtoul.m4
4355 index 5530e0e2d..ef3c9843c 100644
4356 --- a/config/kernel-kstrtoul.m4
4357 +++ b/config/kernel-kstrtoul.m4
4358 @@ -1,18 +1,20 @@
4359 dnl #
4360 dnl # 2.6.39 API change
4361 dnl #
4362 -dnl # 33ee3b2e2eb9 kstrto*: converting strings to integers done (hopefully) right
4363 -dnl #
4364 dnl # If kstrtoul() doesn't exist, fallback to use strict_strtoul() which has
4365 dnl # existed since 2.6.25.
4366 dnl #
4367 -AC_DEFUN([ZFS_AC_KERNEL_KSTRTOUL], [
4368 - AC_MSG_CHECKING([whether kstrtoul() exists])
4369 - ZFS_LINUX_TRY_COMPILE([
4370 +AC_DEFUN([ZFS_AC_KERNEL_SRC_KSTRTOUL], [
4371 + ZFS_LINUX_TEST_SRC([kstrtoul], [
4372 #include <linux/kernel.h>
4373 ],[
4374 int ret __attribute__ ((unused)) = kstrtoul(NULL, 10, NULL);
4375 - ],[
4376 + ])
4377 +])
4378 +
4379 +AC_DEFUN([ZFS_AC_KERNEL_KSTRTOUL], [
4380 + AC_MSG_CHECKING([whether kstrtoul() exists])
4381 + ZFS_LINUX_TEST_RESULT([kstrtoul], [
4382 AC_MSG_RESULT(yes)
4383 AC_DEFINE(HAVE_KSTRTOUL, 1, [kstrtoul() exists])
4384 ],[
4385 diff --git a/config/kernel-ktime_get_coarse_real_ts64.m4 b/config/kernel-ktime_get_coarse_real_ts64.m4
4386 index d6be8c418..28492bf04 100644
4387 --- a/config/kernel-ktime_get_coarse_real_ts64.m4
4388 +++ b/config/kernel-ktime_get_coarse_real_ts64.m4
4389 @@ -2,16 +2,21 @@ dnl #
4390 dnl # 4.18: ktime_get_coarse_real_ts64() added. Use it in place of
4391 dnl # current_kernel_time64().
4392 dnl #
4393 -AC_DEFUN([ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64],
4394 - [AC_MSG_CHECKING([whether ktime_get_coarse_real_ts64() exists])
4395 - ZFS_LINUX_TRY_COMPILE([
4396 +AC_DEFUN([ZFS_AC_KERNEL_SRC_KTIME_GET_COARSE_REAL_TS64], [
4397 + ZFS_LINUX_TEST_SRC([ktime_get_coarse_real_ts64], [
4398 #include <linux/mm.h>
4399 ], [
4400 struct timespec64 ts;
4401 ktime_get_coarse_real_ts64(&ts);
4402 - ], [
4403 + ])
4404 +])
4405 +
4406 +AC_DEFUN([ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64], [
4407 + AC_MSG_CHECKING([whether ktime_get_coarse_real_ts64() exists])
4408 + ZFS_LINUX_TEST_RESULT([ktime_get_coarse_real_ts64], [
4409 AC_MSG_RESULT(yes)
4410 - AC_DEFINE(HAVE_KTIME_GET_COARSE_REAL_TS64, 1, [ktime_get_coarse_real_ts64() exists])
4411 + AC_DEFINE(HAVE_KTIME_GET_COARSE_REAL_TS64, 1,
4412 + [ktime_get_coarse_real_ts64() exists])
4413 ], [
4414 AC_MSG_RESULT(no)
4415 ])
4416 diff --git a/config/kernel-kuid-helpers.m4 b/config/kernel-kuid-helpers.m4
4417 index 60713b9d3..4bc4e039d 100644
4418 --- a/config/kernel-kuid-helpers.m4
4419 +++ b/config/kernel-kuid-helpers.m4
4420 @@ -5,14 +5,18 @@ dnl # became necessary to go through one more level of indirection
4421 dnl # when dealing with uid/gid - namely the kuid type.
4422 dnl #
4423 dnl #
4424 -AC_DEFUN([ZFS_AC_KERNEL_KUID_HELPERS], [
4425 - AC_MSG_CHECKING([whether i_(uid|gid)_(read|write) exist])
4426 - ZFS_LINUX_TRY_COMPILE([
4427 +AC_DEFUN([ZFS_AC_KERNEL_SRC_KUID_HELPERS], [
4428 + ZFS_LINUX_TEST_SRC([i_uid_read], [
4429 #include <linux/fs.h>
4430 ],[
4431 struct inode *ip = NULL;
4432 (void) i_uid_read(ip);
4433 - ],[
4434 + ])
4435 +])
4436 +
4437 +AC_DEFUN([ZFS_AC_KERNEL_KUID_HELPERS], [
4438 + AC_MSG_CHECKING([whether i_(uid|gid)_(read|write) exist])
4439 + ZFS_LINUX_TEST_RESULT([i_uid_read], [
4440 AC_MSG_RESULT(yes)
4441 AC_DEFINE(HAVE_KUID_HELPERS, 1,
4442 [i_(uid|gid)_(read|write) exist])
4443 diff --git a/config/kernel-kuidgid.m4 b/config/kernel-kuidgid.m4
4444 index 82685d263..15bf98154 100644
4445 --- a/config/kernel-kuidgid.m4
4446 +++ b/config/kernel-kuidgid.m4
4447 @@ -3,20 +3,26 @@ dnl # User namespaces, use kuid_t in place of uid_t
4448 dnl # where available. Not strictly a user namespaces thing
4449 dnl # but it should prevent surprises
4450 dnl #
4451 -AC_DEFUN([ZFS_AC_KERNEL_KUIDGID_T], [
4452 - AC_MSG_CHECKING([whether kuid_t/kgid_t is available])
4453 - ZFS_LINUX_TRY_COMPILE([
4454 +AC_DEFUN([ZFS_AC_KERNEL_SRC_KUIDGID_T], [
4455 + ZFS_LINUX_TEST_SRC([kuidgid_t_init], [
4456 #include <linux/uidgid.h>
4457 ], [
4458 kuid_t userid __attribute__ ((unused)) = KUIDT_INIT(0);
4459 kgid_t groupid __attribute__ ((unused)) = KGIDT_INIT(0);
4460 - ],[
4461 - ZFS_LINUX_TRY_COMPILE([
4462 - #include <linux/uidgid.h>
4463 - ], [
4464 - kuid_t userid __attribute__ ((unused)) = 0;
4465 - kgid_t groupid __attribute__ ((unused)) = 0;
4466 - ],[
4467 + ])
4468 +
4469 + ZFS_LINUX_TEST_SRC([kuidgid_t], [
4470 + #include <linux/uidgid.h>
4471 + ], [
4472 + kuid_t userid __attribute__ ((unused)) = 0;
4473 + kgid_t groupid __attribute__ ((unused)) = 0;
4474 + ])
4475 +])
4476 +
4477 +AC_DEFUN([ZFS_AC_KERNEL_KUIDGID_T], [
4478 + AC_MSG_CHECKING([whether kuid_t/kgid_t is available])
4479 + ZFS_LINUX_TEST_RESULT([kuidgid_t_init], [
4480 + ZFS_LINUX_TEST_RESULT([kuidgid_t], [
4481 AC_MSG_RESULT(yes; optional)
4482 ],[
4483 AC_MSG_RESULT(yes; mandatory)
4484 diff --git a/config/kernel-lookup-bdev.m4 b/config/kernel-lookup-bdev.m4
4485 index abbf55d9b..72b4993e1 100644
4486 --- a/config/kernel-lookup-bdev.m4
4487 +++ b/config/kernel-lookup-bdev.m4
4488 @@ -2,23 +2,33 @@ dnl #
4489 dnl # 2.6.27, lookup_bdev() was exported.
4490 dnl # 4.4.0-6.21 - x.y on Ubuntu, lookup_bdev() takes 2 arguments.
4491 dnl #
4492 -AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_BDEV],
4493 - [AC_MSG_CHECKING([whether lookup_bdev() wants 1 arg])
4494 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
4495 +AC_DEFUN([ZFS_AC_KERNEL_SRC_LOOKUP_BDEV], [
4496 + ZFS_LINUX_TEST_SRC([lookup_bdev_1arg], [
4497 #include <linux/fs.h>
4498 ], [
4499 lookup_bdev(NULL);
4500 - ], [lookup_bdev], [fs/block_dev.c], [
4501 + ])
4502 +
4503 + ZFS_LINUX_TEST_SRC([lookup_bdev_2args], [
4504 + #include <linux/fs.h>
4505 + ], [
4506 + lookup_bdev(NULL, FMODE_READ);
4507 + ])
4508 +])
4509 +
4510 +AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_BDEV], [
4511 + AC_MSG_CHECKING([whether lookup_bdev() wants 1 arg])
4512 + ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_1arg],
4513 + [lookup_bdev], [fs/block_dev.c], [
4514 AC_MSG_RESULT(yes)
4515 - AC_DEFINE(HAVE_1ARG_LOOKUP_BDEV, 1, [lookup_bdev() wants 1 arg])
4516 + AC_DEFINE(HAVE_1ARG_LOOKUP_BDEV, 1,
4517 + [lookup_bdev() wants 1 arg])
4518 ], [
4519 AC_MSG_RESULT(no)
4520 +
4521 AC_MSG_CHECKING([whether lookup_bdev() wants 2 args])
4522 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
4523 - #include <linux/fs.h>
4524 - ], [
4525 - lookup_bdev(NULL, FMODE_READ);
4526 - ], [lookup_bdev], [fs/block_dev.c], [
4527 + ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_2args],
4528 + [lookup_bdev], [fs/block_dev.c], [
4529 AC_MSG_RESULT(yes)
4530 AC_DEFINE(HAVE_2ARGS_LOOKUP_BDEV, 1,
4531 [lookup_bdev() wants 2 args])
4532 @@ -26,4 +36,4 @@ AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_BDEV],
4533 AC_MSG_RESULT(no)
4534 ])
4535 ])
4536 -])
4537 \ No newline at end of file
4538 +])
4539 diff --git a/config/kernel-lookup-nameidata.m4 b/config/kernel-lookup-nameidata.m4
4540 index 5453be5e8..865b8aff8 100644
4541 --- a/config/kernel-lookup-nameidata.m4
4542 +++ b/config/kernel-lookup-nameidata.m4
4543 @@ -1,9 +1,8 @@
4544 dnl #
4545 dnl # 3.6 API change
4546 dnl #
4547 -AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
4548 - AC_MSG_CHECKING([whether iops->lookup() passes nameidata])
4549 - ZFS_LINUX_TRY_COMPILE([
4550 +AC_DEFUN([ZFS_AC_KERNEL_SRC_LOOKUP_NAMEIDATA], [
4551 + ZFS_LINUX_TEST_SRC([lookup_nameidata], [
4552 #include <linux/fs.h>
4553 #include <linux/sched.h>
4554
4555 @@ -15,11 +14,15 @@ AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
4556 __attribute__ ((unused)) = {
4557 .lookup = inode_lookup,
4558 };
4559 - ],[
4560 - ],[
4561 + ],[])
4562 +])
4563 +
4564 +AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
4565 + AC_MSG_CHECKING([whether iops->lookup() passes nameidata])
4566 + ZFS_LINUX_TEST_RESULT([lookup_nameidata], [
4567 AC_MSG_RESULT(yes)
4568 AC_DEFINE(HAVE_LOOKUP_NAMEIDATA, 1,
4569 - [iops->lookup() passes nameidata])
4570 + [iops->lookup() passes nameidata])
4571 ],[
4572 AC_MSG_RESULT(no)
4573 ])
4574 diff --git a/config/kernel-lseek-execute.m4 b/config/kernel-lseek-execute.m4
4575 index 8c4032b92..652f611f8 100644
4576 --- a/config/kernel-lseek-execute.m4
4577 +++ b/config/kernel-lseek-execute.m4
4578 @@ -2,9 +2,8 @@ dnl #
4579 dnl # 3.11 API change
4580 dnl # lseek_execute helper exported
4581 dnl #
4582 -AC_DEFUN([ZFS_AC_KERNEL_LSEEK_EXECUTE],
4583 - [AC_MSG_CHECKING([whether lseek_execute() is available])
4584 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
4585 +AC_DEFUN([ZFS_AC_KERNEL_SRC_LSEEK_EXECUTE], [
4586 + ZFS_LINUX_TEST_SRC([lseek_execute], [
4587 #include <linux/fs.h>
4588 ], [
4589 struct file *fp __attribute__ ((unused)) = NULL;
4590 @@ -13,10 +12,15 @@ AC_DEFUN([ZFS_AC_KERNEL_LSEEK_EXECUTE],
4591 loff_t maxsize __attribute__ ((unused)) = 0;
4592
4593 lseek_execute(fp, ip, offset, maxsize);
4594 - ], [lseek_exclusive], [fs/read_write.c], [
4595 + ])
4596 +])
4597 +
4598 +AC_DEFUN([ZFS_AC_KERNEL_LSEEK_EXECUTE], [
4599 + AC_MSG_CHECKING([whether lseek_execute() is available])
4600 + ZFS_LINUX_TEST_RESULT_SYMBOL([lseek_execute],
4601 + [lseek_exclusive], [fs/read_write.c], [
4602 AC_MSG_RESULT(yes)
4603 - AC_DEFINE(HAVE_LSEEK_EXECUTE, 1,
4604 - [lseek_execute() is available])
4605 + AC_DEFINE(HAVE_LSEEK_EXECUTE, 1, [lseek_execute() is available])
4606 ], [
4607 AC_MSG_RESULT(no)
4608 ])
4609 diff --git a/config/kernel-make-request-fn.m4 b/config/kernel-make-request-fn.m4
4610 new file mode 100644
4611 index 000000000..86339aa04
4612 --- /dev/null
4613 +++ b/config/kernel-make-request-fn.m4
4614 @@ -0,0 +1,77 @@
4615 +dnl #
4616 +dnl # Check for make_request_fn interface.
4617 +dnl #
4618 +AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [
4619 + ZFS_LINUX_TEST_SRC([make_request_fn_int], [
4620 + #include <linux/blkdev.h>
4621 + int make_request(struct request_queue *q,
4622 + struct bio *bio) { return (0); }
4623 + ],[
4624 + blk_queue_make_request(NULL, &make_request);
4625 + ])
4626 +
4627 + ZFS_LINUX_TEST_SRC([make_request_fn_void], [
4628 + #include <linux/blkdev.h>
4629 + void make_request(struct request_queue *q,
4630 + struct bio *bio) { return; }
4631 + ],[
4632 + blk_queue_make_request(NULL, &make_request);
4633 + ])
4634 +
4635 + ZFS_LINUX_TEST_SRC([make_request_fn_blk_qc_t], [
4636 + #include <linux/blkdev.h>
4637 + blk_qc_t make_request(struct request_queue *q,
4638 + struct bio *bio) { return (BLK_QC_T_NONE); }
4639 + ],[
4640 + blk_queue_make_request(NULL, &make_request);
4641 + ])
4642 +])
4643 +
4644 +AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [
4645 + dnl #
4646 + dnl # Legacy API
4647 + dnl # make_request_fn returns int.
4648 + dnl #
4649 + AC_MSG_CHECKING([whether make_request_fn() returns int])
4650 + ZFS_LINUX_TEST_RESULT([make_request_fn_int], [
4651 + AC_MSG_RESULT(yes)
4652 + AC_DEFINE(MAKE_REQUEST_FN_RET, int,
4653 + [make_request_fn() return type])
4654 + AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_INT, 1,
4655 + [Noting that make_request_fn() returns int])
4656 + ],[
4657 + AC_MSG_RESULT(no)
4658 +
4659 + dnl #
4660 + dnl # Linux 3.2 API Change
4661 + dnl # make_request_fn returns void.
4662 + dnl #
4663 + AC_MSG_CHECKING([whether make_request_fn() returns void])
4664 + ZFS_LINUX_TEST_RESULT([make_request_fn_void], [
4665 + AC_MSG_RESULT(yes)
4666 + AC_DEFINE(MAKE_REQUEST_FN_RET, void,
4667 + [make_request_fn() return type])
4668 + AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_VOID, 1,
4669 + [Noting that make_request_fn() returns void])
4670 + ],[
4671 + AC_MSG_RESULT(no)
4672 +
4673 + dnl #
4674 + dnl # Linux 4.4 API Change
4675 + dnl # make_request_fn returns blk_qc_t.
4676 + dnl #
4677 + AC_MSG_CHECKING(
4678 + [whether make_request_fn() returns blk_qc_t])
4679 + ZFS_LINUX_TEST_RESULT([make_request_fn_blk_qc_t], [
4680 + AC_MSG_RESULT(yes)
4681 + AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t,
4682 + [make_request_fn() return type])
4683 + AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1,
4684 + [Noting that make_request_fn() ]
4685 + [returns blk_qc_t])
4686 + ],[
4687 + ZFS_LINUX_TEST_ERROR([make_request_fn])
4688 + ])
4689 + ])
4690 + ])
4691 +])
4692 diff --git a/config/kernel-misc-minor.m4 b/config/kernel-misc-minor.m4
4693 index a020d2ebc..20fe2cd2f 100644
4694 --- a/config/kernel-misc-minor.m4
4695 +++ b/config/kernel-misc-minor.m4
4696 @@ -6,7 +6,7 @@ dnl # number. Start with a large known available unreserved minor and work
4697 dnl # our way down to lower value if a collision is detected.
4698 dnl #
4699 AC_DEFUN([ZFS_AC_KERNEL_MISC_MINOR], [
4700 - AC_MSG_CHECKING([for available /dev/zfs minor])
4701 + AC_MSG_CHECKING([whether /dev/zfs minor is available])
4702
4703 for i in $(seq 249 -1 200); do
4704 if ! grep -q "^#define\s\+.*_MINOR\s\+.*$i" \
4705 diff --git a/config/kernel-mk-request-fn.m4 b/config/kernel-mk-request-fn.m4
4706 deleted file mode 100644
4707 index 57eebe23d..000000000
4708 --- a/config/kernel-mk-request-fn.m4
4709 +++ /dev/null
4710 @@ -1,65 +0,0 @@
4711 -dnl #
4712 -dnl # Linux 3.2 API Change
4713 -dnl # make_request_fn returns void instead of int.
4714 -dnl #
4715 -dnl # Linux 4.4 API Change
4716 -dnl # make_request_fn returns blk_qc_t.
4717 -dnl #
4718 -AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [
4719 - AC_MSG_CHECKING([whether make_request_fn() returns int])
4720 - ZFS_LINUX_TRY_COMPILE([
4721 - #include <linux/blkdev.h>
4722 -
4723 - int make_request(struct request_queue *q, struct bio *bio)
4724 - {
4725 - return (0);
4726 - }
4727 - ],[
4728 - blk_queue_make_request(NULL, &make_request);
4729 - ],[
4730 - AC_MSG_RESULT(yes)
4731 - AC_DEFINE(MAKE_REQUEST_FN_RET, int,
4732 - [make_request_fn() returns int])
4733 - AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_INT, 1,
4734 - [Noting that make_request_fn() returns int])
4735 - ],[
4736 - AC_MSG_RESULT(no)
4737 - AC_MSG_CHECKING([whether make_request_fn() returns void])
4738 - ZFS_LINUX_TRY_COMPILE([
4739 - #include <linux/blkdev.h>
4740 -
4741 - void make_request(struct request_queue *q, struct bio *bio)
4742 - {
4743 - return;
4744 - }
4745 - ],[
4746 - blk_queue_make_request(NULL, &make_request);
4747 - ],[
4748 - AC_MSG_RESULT(yes)
4749 - AC_DEFINE(MAKE_REQUEST_FN_RET, void,
4750 - [make_request_fn() returns void])
4751 - ],[
4752 - AC_MSG_RESULT(no)
4753 - AC_MSG_CHECKING([whether make_request_fn() returns blk_qc_t])
4754 - ZFS_LINUX_TRY_COMPILE([
4755 - #include <linux/blkdev.h>
4756 -
4757 - blk_qc_t make_request(struct request_queue *q, struct bio *bio)
4758 - {
4759 - return (BLK_QC_T_NONE);
4760 - }
4761 - ],[
4762 - blk_queue_make_request(NULL, &make_request);
4763 - ],[
4764 - AC_MSG_RESULT(yes)
4765 - AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t,
4766 - [make_request_fn() returns blk_qc_t])
4767 - AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1,
4768 - [Noting that make_request_fn() returns blk_qc_t])
4769 - ],[
4770 - AC_MSG_ERROR(no - Please file a bug report at
4771 - https://github.com/zfsonlinux/zfs/issues/new)
4772 - ])
4773 - ])
4774 - ])
4775 -])
4776 diff --git a/config/kernel-mkdir-umode-t.m4 b/config/kernel-mkdir-umode-t.m4
4777 index ebc21be9e..4cbfc0c31 100644
4778 --- a/config/kernel-mkdir-umode-t.m4
4779 +++ b/config/kernel-mkdir-umode-t.m4
4780 @@ -6,9 +6,8 @@ dnl # would also change all three prototypes. However, if it turns out that
4781 dnl # some distribution doesn't backport the whole thing this could be
4782 dnl # broken apart in to three separate checks.
4783 dnl #
4784 -AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [
4785 - AC_MSG_CHECKING([whether iops->create()/mkdir()/mknod() take umode_t])
4786 - ZFS_LINUX_TRY_COMPILE([
4787 +AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T], [
4788 + ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [
4789 #include <linux/fs.h>
4790
4791 int mkdir(struct inode *inode, struct dentry *dentry,
4792 @@ -18,8 +17,12 @@ AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [
4793 iops __attribute__ ((unused)) = {
4794 .mkdir = mkdir,
4795 };
4796 - ],[
4797 - ],[
4798 + ],[])
4799 +])
4800 +
4801 +AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [
4802 + AC_MSG_CHECKING([whether iops->create()/mkdir()/mknod() take umode_t])
4803 + ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [
4804 AC_MSG_RESULT(yes)
4805 AC_DEFINE(HAVE_MKDIR_UMODE_T, 1,
4806 [iops->create()/mkdir()/mknod() take umode_t])
4807 diff --git a/config/kernel-mod-param.m4 b/config/kernel-mod-param.m4
4808 index b72be684a..e00f19d61 100644
4809 --- a/config/kernel-mod-param.m4
4810 +++ b/config/kernel-mod-param.m4
4811 @@ -2,9 +2,8 @@ dnl #
4812 dnl # Grsecurity kernel API change
4813 dnl # constified parameters of module_param_call() methods
4814 dnl #
4815 -AC_DEFUN([ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST], [
4816 - AC_MSG_CHECKING([whether module_param_call() is hardened])
4817 - ZFS_LINUX_TRY_COMPILE([
4818 +AC_DEFUN([ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST], [
4819 + ZFS_LINUX_TEST_SRC([module_param_call], [
4820 #include <linux/module.h>
4821 #include <linux/moduleparam.h>
4822
4823 @@ -19,8 +18,12 @@ AC_DEFUN([ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST], [
4824 }
4825
4826 module_param_call(p, param_set, param_get, NULL, 0644);
4827 - ],[
4828 - ],[
4829 + ],[])
4830 +])
4831 +
4832 +AC_DEFUN([ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST], [
4833 + AC_MSG_CHECKING([whether module_param_call() is hardened])
4834 + ZFS_LINUX_TEST_RESULT([module_param_call], [
4835 AC_MSG_RESULT(yes)
4836 AC_DEFINE(MODULE_PARAM_CALL_CONST, 1,
4837 [hardened module_param_call])
4838 diff --git a/config/kernel-objtool.m4 b/config/kernel-objtool.m4
4839 index 467329b25..bf60e7869 100644
4840 --- a/config/kernel-objtool.m4
4841 +++ b/config/kernel-objtool.m4
4842 @@ -1,41 +1,44 @@
4843 dnl #
4844 -dnl # 4.6 API for compile-time stack validation
4845 +dnl # Check for objtool support.
4846 dnl #
4847 -AC_DEFUN([ZFS_AC_KERNEL_OBJTOOL], [
4848 - AC_MSG_CHECKING([for compile-time stack validation (objtool)])
4849 - ZFS_LINUX_TRY_COMPILE([
4850 +AC_DEFUN([ZFS_AC_KERNEL_SRC_OBJTOOL], [
4851 +
4852 + dnl # 4.6 API for compile-time stack validation
4853 + ZFS_LINUX_TEST_SRC([objtool], [
4854 #undef __ASSEMBLY__
4855 #include <asm/frame.h>
4856 ],[
4857 #if !defined(FRAME_BEGIN)
4858 CTASSERT(1);
4859 #endif
4860 - ],[
4861 - AC_MSG_RESULT(yes)
4862 - AC_DEFINE(HAVE_KERNEL_OBJTOOL, 1,
4863 - [kernel does stack verification])
4864 -
4865 - ZFS_AC_KERNEL_STACK_FRAME_NON_STANDARD
4866 - ],[
4867 - AC_MSG_RESULT(no)
4868 ])
4869 -])
4870
4871 -dnl #
4872 -dnl # 4.6 API added STACK_FRAME_NON_STANDARD macro
4873 -dnl #
4874 -AC_DEFUN([ZFS_AC_KERNEL_STACK_FRAME_NON_STANDARD], [
4875 - AC_MSG_CHECKING([whether STACK_FRAME_NON_STANDARD is defined])
4876 - ZFS_LINUX_TRY_COMPILE([
4877 + dnl # 4.6 API added STACK_FRAME_NON_STANDARD macro
4878 + ZFS_LINUX_TEST_SRC([stack_frame_non_standard], [
4879 #include <linux/frame.h>
4880 ],[
4881 #if !defined(STACK_FRAME_NON_STANDARD)
4882 CTASSERT(1);
4883 #endif
4884 - ],[
4885 + ])
4886 +])
4887 +
4888 +AC_DEFUN([ZFS_AC_KERNEL_OBJTOOL], [
4889 + AC_MSG_CHECKING(
4890 + [whether compile-time stack validation (objtool) is available])
4891 + ZFS_LINUX_TEST_RESULT([objtool], [
4892 AC_MSG_RESULT(yes)
4893 - AC_DEFINE(HAVE_STACK_FRAME_NON_STANDARD, 1,
4894 - [STACK_FRAME_NON_STANDARD is defined])
4895 + AC_DEFINE(HAVE_KERNEL_OBJTOOL, 1,
4896 + [kernel does stack verification])
4897 +
4898 + AC_MSG_CHECKING([whether STACK_FRAME_NON_STANDARD is defined])
4899 + ZFS_LINUX_TEST_RESULT([stack_frame_non_standard], [
4900 + AC_MSG_RESULT(yes)
4901 + AC_DEFINE(HAVE_STACK_FRAME_NON_STANDARD, 1,
4902 + [STACK_FRAME_NON_STANDARD is defined])
4903 + ],[
4904 + AC_MSG_RESULT(no)
4905 + ])
4906 ],[
4907 AC_MSG_RESULT(no)
4908 ])
4909 diff --git a/config/kernel-open-bdev-exclusive.m4 b/config/kernel-open-bdev-exclusive.m4
4910 index 0661315a6..2e46b8876 100644
4911 --- a/config/kernel-open-bdev-exclusive.m4
4912 +++ b/config/kernel-open-bdev-exclusive.m4
4913 @@ -2,16 +2,21 @@ dnl #
4914 dnl # 2.6.28 API change
4915 dnl # open/close_bdev_excl() renamed to open/close_bdev_exclusive()
4916 dnl #
4917 -AC_DEFUN([ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE],
4918 - [AC_MSG_CHECKING([whether open_bdev_exclusive() is available])
4919 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
4920 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_OPEN_EXCLUSIVE], [
4921 + ZFS_LINUX_TEST_SRC([open_bdev_exclusive], [
4922 #include <linux/fs.h>
4923 ], [
4924 open_bdev_exclusive(NULL, 0, NULL);
4925 - ], [open_bdev_exclusive], [fs/block_dev.c], [
4926 + ])
4927 +])
4928 +
4929 +AC_DEFUN([ZFS_AC_KERNEL_BDEV_OPEN_EXCLUSIVE], [
4930 + AC_MSG_CHECKING([whether open_bdev_exclusive() is available])
4931 + ZFS_LINUX_TEST_RESULT_SYMBOL([open_bdev_exclusive],
4932 + [open_bdev_exclusive], [fs/block_dev.c], [
4933 AC_MSG_RESULT(yes)
4934 AC_DEFINE(HAVE_OPEN_BDEV_EXCLUSIVE, 1,
4935 - [open_bdev_exclusive() is available])
4936 + [open_bdev_exclusive() is available])
4937 ], [
4938 AC_MSG_RESULT(no)
4939 ])
4940 diff --git a/config/kernel-pde-data.m4 b/config/kernel-pde-data.m4
4941 index 8aa4c2204..928c5ef0d 100644
4942 --- a/config/kernel-pde-data.m4
4943 +++ b/config/kernel-pde-data.m4
4944 @@ -2,15 +2,19 @@ dnl #
4945 dnl # 3.10 API change,
4946 dnl # PDE is replaced by PDE_DATA
4947 dnl #
4948 -AC_DEFUN([ZFS_AC_KERNEL_PDE_DATA], [
4949 - AC_MSG_CHECKING([whether PDE_DATA() is available])
4950 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
4951 +AC_DEFUN([ZFS_AC_KERNEL_SRC_PDE_DATA], [
4952 + ZFS_LINUX_TEST_SRC([pde_data], [
4953 #include <linux/proc_fs.h>
4954 ], [
4955 PDE_DATA(NULL);
4956 - ], [PDE_DATA], [], [
4957 + ])
4958 +])
4959 +
4960 +AC_DEFUN([ZFS_AC_KERNEL_PDE_DATA], [
4961 + AC_MSG_CHECKING([whether PDE_DATA() is available])
4962 + ZFS_LINUX_TEST_RESULT_SYMBOL([pde_data], [PDE_DATA], [], [
4963 AC_MSG_RESULT(yes)
4964 - AC_DEFINE(HAVE_PDE_DATA, 1, [yes])
4965 + AC_DEFINE(HAVE_PDE_DATA, 1, [PDE_DATA is available])
4966 ],[
4967 AC_MSG_RESULT(no)
4968 ])
4969 diff --git a/config/kernel-put-link.m4 b/config/kernel-put-link.m4
4970 index a0bb36ef2..f03df9e99 100644
4971 --- a/config/kernel-put-link.m4
4972 +++ b/config/kernel-put-link.m4
4973 @@ -1,17 +1,35 @@
4974 dnl #
4975 dnl # Supported symlink APIs
4976 dnl #
4977 +AC_DEFUN([ZFS_AC_KERNEL_SRC_PUT_LINK], [
4978 + ZFS_LINUX_TEST_SRC([put_link_cookie], [
4979 + #include <linux/fs.h>
4980 + void put_link(struct inode *ip, void *cookie)
4981 + { return; }
4982 + static struct inode_operations
4983 + iops __attribute__ ((unused)) = {
4984 + .put_link = put_link,
4985 + };
4986 + ],[])
4987 +
4988 + ZFS_LINUX_TEST_SRC([put_link_nameidata], [
4989 + #include <linux/fs.h>
4990 + void put_link(struct dentry *de, struct
4991 + nameidata *nd, void *ptr) { return; }
4992 + static struct inode_operations
4993 + iops __attribute__ ((unused)) = {
4994 + .put_link = put_link,
4995 + };
4996 + ],[])
4997 +])
4998 +
4999 AC_DEFUN([ZFS_AC_KERNEL_PUT_LINK], [
5000 dnl #
5001 dnl # 4.5 API change
5002 dnl # get_link() uses delayed done, there is no put_link() interface.
5003 + dnl # This check intially uses the inode_operations_get_link result
5004 dnl #
5005 - ZFS_LINUX_TRY_COMPILE([
5006 - #if !defined(HAVE_GET_LINK_DELAYED)
5007 - #error "Expecting get_link() delayed done"
5008 - #endif
5009 - ],[
5010 - ],[
5011 + ZFS_LINUX_TEST_RESULT([inode_operations_get_link], [
5012 AC_DEFINE(HAVE_PUT_LINK_DELAYED, 1, [iops->put_link() delayed])
5013 ],[
5014 dnl #
5015 @@ -19,41 +37,24 @@ AC_DEFUN([ZFS_AC_KERNEL_PUT_LINK], [
5016 dnl # This kernel retired the nameidata structure.
5017 dnl #
5018 AC_MSG_CHECKING([whether iops->put_link() passes cookie])
5019 - ZFS_LINUX_TRY_COMPILE([
5020 - #include <linux/fs.h>
5021 - void put_link(struct inode *ip, void *cookie)
5022 - { return; }
5023 - static struct inode_operations
5024 - iops __attribute__ ((unused)) = {
5025 - .put_link = put_link,
5026 - };
5027 - ],[
5028 - ],[
5029 + ZFS_LINUX_TEST_RESULT([put_link_cookie], [
5030 AC_MSG_RESULT(yes)
5031 AC_DEFINE(HAVE_PUT_LINK_COOKIE, 1,
5032 [iops->put_link() cookie])
5033 ],[
5034 + AC_MSG_RESULT(no)
5035 +
5036 dnl #
5037 dnl # 2.6.32 API
5038 dnl #
5039 - AC_MSG_RESULT(no)
5040 AC_MSG_CHECKING(
5041 [whether iops->put_link() passes nameidata])
5042 - ZFS_LINUX_TRY_COMPILE([
5043 - #include <linux/fs.h>
5044 - void put_link(struct dentry *de, struct
5045 - nameidata *nd, void *ptr) { return; }
5046 - static struct inode_operations
5047 - iops __attribute__ ((unused)) = {
5048 - .put_link = put_link,
5049 - };
5050 - ],[
5051 - ],[
5052 + ZFS_LINUX_TEST_RESULT([put_link_nameidata], [
5053 AC_MSG_RESULT(yes)
5054 AC_DEFINE(HAVE_PUT_LINK_NAMEIDATA, 1,
5055 [iops->put_link() nameidata])
5056 ],[
5057 - AC_MSG_ERROR(no; please file a bug report)
5058 + ZFS_LINUX_TEST_ERROR([put_link])
5059 ])
5060 ])
5061 ])
5062 diff --git a/config/kernel-rename.m4 b/config/kernel-rename.m4
5063 index 9f894fb4d..f70739153 100644
5064 --- a/config/kernel-rename.m4
5065 +++ b/config/kernel-rename.m4
5066 @@ -3,9 +3,8 @@ dnl # 4.9 API change,
5067 dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants
5068 dnl # flags.
5069 dnl #
5070 -AC_DEFUN([ZFS_AC_KERNEL_RENAME_WANTS_FLAGS], [
5071 - AC_MSG_CHECKING([whether iops->rename() wants flags])
5072 - ZFS_LINUX_TRY_COMPILE([
5073 +AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [
5074 + ZFS_LINUX_TEST_SRC([inode_operations_rename], [
5075 #include <linux/fs.h>
5076 int rename_fn(struct inode *sip, struct dentry *sdp,
5077 struct inode *tip, struct dentry *tdp,
5078 @@ -15,10 +14,15 @@ AC_DEFUN([ZFS_AC_KERNEL_RENAME_WANTS_FLAGS], [
5079 iops __attribute__ ((unused)) = {
5080 .rename = rename_fn,
5081 };
5082 - ],[
5083 - ],[
5084 + ],[])
5085 +])
5086 +
5087 +AC_DEFUN([ZFS_AC_KERNEL_RENAME_WANTS_FLAGS], [
5088 + AC_MSG_CHECKING([whether iops->rename() wants flags])
5089 + ZFS_LINUX_TEST_RESULT([inode_operations_rename], [
5090 AC_MSG_RESULT(yes)
5091 - AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1, [iops->rename() wants flags])
5092 + AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1,
5093 + [iops->rename() wants flags])
5094 ],[
5095 AC_MSG_RESULT(no)
5096 ])
5097 diff --git a/config/kernel-rw.m4 b/config/kernel-rw.m4
5098 index 1c8a265e0..85b47d5c6 100644
5099 --- a/config/kernel-rw.m4
5100 +++ b/config/kernel-rw.m4
5101 @@ -3,11 +3,8 @@ dnl # 4.14 API change
5102 dnl # kernel_write() which was introduced in 3.9 was updated to take
5103 dnl # the offset as a pointer which is needed by vn_rdwr().
5104 dnl #
5105 -AC_DEFUN([ZFS_AC_KERNEL_WRITE], [
5106 - AC_MSG_CHECKING([whether kernel_write() takes loff_t pointer])
5107 - tmp_flags="$EXTRA_KCFLAGS"
5108 - EXTRA_KCFLAGS="-Werror"
5109 - ZFS_LINUX_TRY_COMPILE([
5110 +AC_DEFUN([ZFS_AC_KERNEL_SRC_WRITE], [
5111 + ZFS_LINUX_TEST_SRC([kernel_write], [
5112 #include <linux/fs.h>
5113 ],[
5114 struct file *file = NULL;
5115 @@ -17,14 +14,18 @@ AC_DEFUN([ZFS_AC_KERNEL_WRITE], [
5116 ssize_t ret;
5117
5118 ret = kernel_write(file, buf, count, pos);
5119 - ],[
5120 + ])
5121 +])
5122 +
5123 +AC_DEFUN([ZFS_AC_KERNEL_WRITE], [
5124 + AC_MSG_CHECKING([whether kernel_write() takes loff_t pointer])
5125 + ZFS_LINUX_TEST_RESULT([kernel_write], [
5126 AC_MSG_RESULT(yes)
5127 AC_DEFINE(HAVE_KERNEL_WRITE_PPOS, 1,
5128 [kernel_write() take loff_t pointer])
5129 ],[
5130 AC_MSG_RESULT(no)
5131 ])
5132 - EXTRA_KCFLAGS="$tmp_flags"
5133 ])
5134
5135 dnl #
5136 @@ -32,11 +33,8 @@ dnl # 4.14 API change
5137 dnl # kernel_read() which has existed for forever was updated to take
5138 dnl # the offset as a pointer which is needed by vn_rdwr().
5139 dnl #
5140 -AC_DEFUN([ZFS_AC_KERNEL_READ], [
5141 - AC_MSG_CHECKING([whether kernel_read() takes loff_t pointer])
5142 - tmp_flags="$EXTRA_KCFLAGS"
5143 - EXTRA_KCFLAGS="-Werror"
5144 - ZFS_LINUX_TRY_COMPILE([
5145 +AC_DEFUN([ZFS_AC_KERNEL_SRC_READ], [
5146 + ZFS_LINUX_TEST_SRC([kernel_read], [
5147 #include <linux/fs.h>
5148 ],[
5149 struct file *file = NULL;
5150 @@ -46,12 +44,26 @@ AC_DEFUN([ZFS_AC_KERNEL_READ], [
5151 ssize_t ret;
5152
5153 ret = kernel_read(file, buf, count, pos);
5154 - ],[
5155 + ])
5156 +])
5157 +
5158 +AC_DEFUN([ZFS_AC_KERNEL_READ], [
5159 + AC_MSG_CHECKING([whether kernel_read() takes loff_t pointer])
5160 + ZFS_LINUX_TEST_RESULT([kernel_read], [
5161 AC_MSG_RESULT(yes)
5162 AC_DEFINE(HAVE_KERNEL_READ_PPOS, 1,
5163 [kernel_read() take loff_t pointer])
5164 ],[
5165 AC_MSG_RESULT(no)
5166 ])
5167 - EXTRA_KCFLAGS="$tmp_flags"
5168 +])
5169 +
5170 +AC_DEFUN([ZFS_AC_KERNEL_SRC_RW], [
5171 + ZFS_AC_KERNEL_SRC_WRITE
5172 + ZFS_AC_KERNEL_SRC_READ
5173 +])
5174 +
5175 +AC_DEFUN([ZFS_AC_KERNEL_RW], [
5176 + ZFS_AC_KERNEL_WRITE
5177 + ZFS_AC_KERNEL_READ
5178 ])
5179 diff --git a/config/kernel-rwsem.m4 b/config/kernel-rwsem.m4
5180 index 532c22718..67c5cf908 100644
5181 --- a/config/kernel-rwsem.m4
5182 +++ b/config/kernel-rwsem.m4
5183 @@ -4,25 +4,26 @@ dnl #
5184 dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to
5185 dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1.
5186 dnl #
5187 -AC_DEFUN([ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW], [
5188 - AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
5189 - tmp_flags="$EXTRA_KCFLAGS"
5190 - EXTRA_KCFLAGS="-Werror"
5191 - ZFS_LINUX_TRY_COMPILE([
5192 +AC_DEFUN([ZFS_AC_KERNEL_SRC_RWSEM_SPINLOCK_IS_RAW], [
5193 + ZFS_LINUX_TEST_SRC([rwsem_spinlock_is_raw], [
5194 #include <linux/rwsem.h>
5195 ],[
5196 struct rw_semaphore dummy_semaphore __attribute__ ((unused));
5197 raw_spinlock_t dummy_lock __attribute__ ((unused)) =
5198 __RAW_SPIN_LOCK_INITIALIZER(dummy_lock);
5199 dummy_semaphore.wait_lock = dummy_lock;
5200 - ],[
5201 + ])
5202 +])
5203 +
5204 +AC_DEFUN([ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW], [
5205 + AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
5206 + ZFS_LINUX_TEST_RESULT([rwsem_spinlock_is_raw], [
5207 AC_MSG_RESULT(yes)
5208 AC_DEFINE(RWSEM_SPINLOCK_IS_RAW, 1,
5209 - [struct rw_semaphore member wait_lock is raw_spinlock_t])
5210 + [struct rw_semaphore member wait_lock is raw_spinlock_t])
5211 ],[
5212 AC_MSG_RESULT(no)
5213 ])
5214 - EXTRA_KCFLAGS="$tmp_flags"
5215 ])
5216
5217 dnl #
5218 @@ -30,23 +31,24 @@ dnl # 3.16 API Change
5219 dnl #
5220 dnl # rwsem-spinlock "->activity" changed to "->count"
5221 dnl #
5222 -AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ACTIVITY], [
5223 - AC_MSG_CHECKING([whether struct rw_semaphore has member activity])
5224 - tmp_flags="$EXTRA_KCFLAGS"
5225 - EXTRA_KCFLAGS="-Werror"
5226 - ZFS_LINUX_TRY_COMPILE([
5227 +AC_DEFUN([ZFS_AC_KERNEL_SRC_RWSEM_ACTIVITY], [
5228 + ZFS_LINUX_TEST_SRC([rwsem_activity], [
5229 #include <linux/rwsem.h>
5230 ],[
5231 struct rw_semaphore dummy_semaphore __attribute__ ((unused));
5232 dummy_semaphore.activity = 0;
5233 - ],[
5234 + ])
5235 +])
5236 +
5237 +AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ACTIVITY], [
5238 + AC_MSG_CHECKING([whether struct rw_semaphore has member activity])
5239 + ZFS_LINUX_TEST_RESULT([rwsem_activity], [
5240 AC_MSG_RESULT(yes)
5241 AC_DEFINE(HAVE_RWSEM_ACTIVITY, 1,
5242 - [struct rw_semaphore has member activity])
5243 + [struct rw_semaphore has member activity])
5244 ],[
5245 AC_MSG_RESULT(no)
5246 ])
5247 - EXTRA_KCFLAGS="$tmp_flags"
5248 ])
5249
5250 dnl #
5251 @@ -54,22 +56,35 @@ dnl # 4.8 API Change
5252 dnl #
5253 dnl # rwsem "->count" changed to atomic_long_t type
5254 dnl #
5255 -AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT], [
5256 - AC_MSG_CHECKING(
5257 - [whether struct rw_semaphore has atomic_long_t member count])
5258 - tmp_flags="$EXTRA_KCFLAGS"
5259 - EXTRA_KCFLAGS="-Werror"
5260 - ZFS_LINUX_TRY_COMPILE([
5261 +AC_DEFUN([ZFS_AC_KERNEL_SRC_RWSEM_ATOMIC_LONG_COUNT], [
5262 + ZFS_LINUX_TEST_SRC([rwsem_atomic_long_count], [
5263 #include <linux/rwsem.h>
5264 ],[
5265 DECLARE_RWSEM(dummy_semaphore);
5266 (void) atomic_long_read(&dummy_semaphore.count);
5267 - ],[
5268 + ])
5269 +])
5270 +
5271 +AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT], [
5272 + AC_MSG_CHECKING(
5273 + [whether struct rw_semaphore has atomic_long_t member count])
5274 + ZFS_LINUX_TEST_RESULT([rwsem_atomic_long_count], [
5275 AC_MSG_RESULT(yes)
5276 AC_DEFINE(HAVE_RWSEM_ATOMIC_LONG_COUNT, 1,
5277 - [struct rw_semaphore has atomic_long_t member count])
5278 + [struct rw_semaphore has atomic_long_t member count])
5279 ],[
5280 AC_MSG_RESULT(no)
5281 ])
5282 - EXTRA_KCFLAGS="$tmp_flags"
5283 +])
5284 +
5285 +AC_DEFUN([ZFS_AC_KERNEL_SRC_RWSEM], [
5286 + ZFS_AC_KERNEL_SRC_RWSEM_SPINLOCK_IS_RAW
5287 + ZFS_AC_KERNEL_SRC_RWSEM_ACTIVITY
5288 + ZFS_AC_KERNEL_SRC_RWSEM_ATOMIC_LONG_COUNT
5289 +])
5290 +
5291 +AC_DEFUN([ZFS_AC_KERNEL_RWSEM], [
5292 + ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW
5293 + ZFS_AC_KERNEL_RWSEM_ACTIVITY
5294 + ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT
5295 ])
5296 diff --git a/config/kernel-sched.m4 b/config/kernel-sched.m4
5297 index 640b008aa..4a7db970a 100644
5298 --- a/config/kernel-sched.m4
5299 +++ b/config/kernel-sched.m4
5300 @@ -2,14 +2,18 @@ dnl #
5301 dnl # 3.9 API change,
5302 dnl # Moved things from linux/sched.h to linux/sched/rt.h
5303 dnl #
5304 -AC_DEFUN([ZFS_AC_KERNEL_SCHED_RT_HEADER],
5305 - [AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
5306 - ZFS_LINUX_TRY_COMPILE([
5307 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SCHED_RT_HEADER], [
5308 + ZFS_LINUX_TEST_SRC([sched_rt_header], [
5309 #include <linux/sched.h>
5310 #include <linux/sched/rt.h>
5311 ],[
5312 return 0;
5313 - ],[
5314 + ])
5315 +])
5316 +
5317 +AC_DEFUN([ZFS_AC_KERNEL_SCHED_RT_HEADER], [
5318 + AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
5319 + ZFS_LINUX_TEST_RESULT([sched_rt_header], [
5320 AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists])
5321 AC_MSG_RESULT(yes)
5322 ],[
5323 @@ -21,36 +25,59 @@ dnl #
5324 dnl # 4.11 API change,
5325 dnl # Moved things from linux/sched.h to linux/sched/signal.h
5326 dnl #
5327 -AC_DEFUN([ZFS_AC_KERNEL_SCHED_SIGNAL_HEADER],
5328 - [AC_MSG_CHECKING([whether header linux/sched/signal.h exists])
5329 - ZFS_LINUX_TRY_COMPILE([
5330 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SCHED_SIGNAL_HEADER], [
5331 + ZFS_LINUX_TEST_SRC([sched_signal_header], [
5332 #include <linux/sched.h>
5333 #include <linux/sched/signal.h>
5334 ],[
5335 return 0;
5336 - ],[
5337 - AC_DEFINE(HAVE_SCHED_SIGNAL_HEADER, 1, [linux/sched/signal.h exists])
5338 + ])
5339 +])
5340 +
5341 +AC_DEFUN([ZFS_AC_KERNEL_SCHED_SIGNAL_HEADER], [
5342 + AC_MSG_CHECKING([whether header linux/sched/signal.h exists])
5343 + ZFS_LINUX_TEST_RESULT([sched_signal_header], [
5344 + AC_DEFINE(HAVE_SCHED_SIGNAL_HEADER, 1,
5345 + [linux/sched/signal.h exists])
5346 AC_MSG_RESULT(yes)
5347 ],[
5348 AC_MSG_RESULT(no)
5349 ])
5350 ])
5351 +
5352 dnl #
5353 dnl # 3.19 API change
5354 dnl # The io_schedule_timeout() function is present in all 2.6.32 kernels
5355 dnl # but it was not exported until Linux 3.19. The RHEL 7.x kernels which
5356 dnl # are based on a 3.10 kernel do export this symbol.
5357 dnl #
5358 -AC_DEFUN([ZFS_AC_KERNEL_IO_SCHEDULE_TIMEOUT], [
5359 - AC_MSG_CHECKING([whether io_schedule_timeout() is available])
5360 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
5361 +AC_DEFUN([ZFS_AC_KERNEL_SRC_IO_SCHEDULE_TIMEOUT], [
5362 + ZFS_LINUX_TEST_SRC([io_schedule_timeout], [
5363 #include <linux/sched.h>
5364 ], [
5365 (void) io_schedule_timeout(1);
5366 - ], [io_schedule_timeout], [], [
5367 + ])
5368 +])
5369 +
5370 +AC_DEFUN([ZFS_AC_KERNEL_IO_SCHEDULE_TIMEOUT], [
5371 + AC_MSG_CHECKING([whether io_schedule_timeout() is available])
5372 + ZFS_LINUX_TEST_RESULT_SYMBOL([io_schedule_timeout],
5373 + [io_schedule_timeout], [], [
5374 AC_MSG_RESULT(yes)
5375 AC_DEFINE(HAVE_IO_SCHEDULE_TIMEOUT, 1, [yes])
5376 ],[
5377 AC_MSG_RESULT(no)
5378 ])
5379 ])
5380 +
5381 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SCHED], [
5382 + ZFS_AC_KERNEL_SRC_SCHED_RT_HEADER
5383 + ZFS_AC_KERNEL_SRC_SCHED_SIGNAL_HEADER
5384 + ZFS_AC_KERNEL_SRC_IO_SCHEDULE_TIMEOUT
5385 +])
5386 +
5387 +AC_DEFUN([ZFS_AC_KERNEL_SCHED], [
5388 + ZFS_AC_KERNEL_SCHED_RT_HEADER
5389 + ZFS_AC_KERNEL_SCHED_SIGNAL_HEADER
5390 + ZFS_AC_KERNEL_IO_SCHEDULE_TIMEOUT
5391 +])
5392 diff --git a/config/kernel-security-inode-init.m4 b/config/kernel-security-inode-init.m4
5393 index a62176d42..0dea7e392 100644
5394 --- a/config/kernel-security-inode-init.m4
5395 +++ b/config/kernel-security-inode-init.m4
5396 @@ -5,9 +5,8 @@ dnl # qstr argument which must be passed in from the dentry if available.
5397 dnl # Passing a NULL is safe when no qstr is available the relevant
5398 dnl # security checks will just be skipped.
5399 dnl #
5400 -AC_DEFUN([ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY], [
5401 - AC_MSG_CHECKING([whether security_inode_init_security wants 6 args])
5402 - ZFS_LINUX_TRY_COMPILE([
5403 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SECURITY_INODE_INIT_SECURITY_6ARGS], [
5404 + ZFS_LINUX_TEST_SRC([security_inode_init_security_6args], [
5405 #include <linux/security.h>
5406 ],[
5407 struct inode *ip __attribute__ ((unused)) = NULL;
5408 @@ -18,10 +17,15 @@ AC_DEFUN([ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY], [
5409 size_t len __attribute__ ((unused)) = 0;
5410
5411 security_inode_init_security(ip, dip, str, &name, &value, &len);
5412 - ],[
5413 + ])
5414 +])
5415 +
5416 +AC_DEFUN([ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_6ARGS], [
5417 + AC_MSG_CHECKING([whether security_inode_init_security wants 6 args])
5418 + ZFS_LINUX_TEST_RESULT([security_inode_init_security_6args], [
5419 AC_MSG_RESULT(yes)
5420 AC_DEFINE(HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY, 1,
5421 - [security_inode_init_security wants 6 args])
5422 + [security_inode_init_security wants 6 args])
5423 ],[
5424 AC_MSG_RESULT(no)
5425 ])
5426 @@ -34,9 +38,8 @@ dnl # a filesystem specific callback to write security extended attributes.
5427 dnl # This was done to support the initialization of multiple LSM xattrs
5428 dnl # and the EVM xattr.
5429 dnl #
5430 -AC_DEFUN([ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY], [
5431 - AC_MSG_CHECKING([whether security_inode_init_security wants callback])
5432 - ZFS_LINUX_TRY_COMPILE([
5433 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SECURITY_INODE_INIT_SECURITY_CALLBACK], [
5434 + ZFS_LINUX_TEST_SRC([security_inode_init_security], [
5435 #include <linux/security.h>
5436 ],[
5437 struct inode *ip __attribute__ ((unused)) = NULL;
5438 @@ -45,11 +48,26 @@ AC_DEFUN([ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY], [
5439 initxattrs func __attribute__ ((unused)) = NULL;
5440
5441 security_inode_init_security(ip, dip, str, func, NULL);
5442 - ],[
5443 + ])
5444 +])
5445 +
5446 +AC_DEFUN([ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_CALLBACK], [
5447 + AC_MSG_CHECKING([whether security_inode_init_security wants callback])
5448 + ZFS_LINUX_TEST_RESULT([security_inode_init_security], [
5449 AC_MSG_RESULT(yes)
5450 AC_DEFINE(HAVE_CALLBACK_SECURITY_INODE_INIT_SECURITY, 1,
5451 - [security_inode_init_security wants callback])
5452 + [security_inode_init_security wants callback])
5453 ],[
5454 AC_MSG_RESULT(no)
5455 ])
5456 ])
5457 +
5458 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SECURITY_INODE], [
5459 + ZFS_AC_KERNEL_SRC_SECURITY_INODE_INIT_SECURITY_6ARGS
5460 + ZFS_AC_KERNEL_SRC_SECURITY_INODE_INIT_SECURITY_CALLBACK
5461 +])
5462 +
5463 +AC_DEFUN([ZFS_AC_KERNEL_SECURITY_INODE], [
5464 + ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_6ARGS
5465 + ZFS_AC_KERNEL_SECURITY_INODE_INIT_SECURITY_CALLBACK
5466 +])
5467 diff --git a/config/kernel-set-nlink.m4 b/config/kernel-set-nlink.m4
5468 index f7ffc0d3a..63a5a8c0d 100644
5469 --- a/config/kernel-set-nlink.m4
5470 +++ b/config/kernel-set-nlink.m4
5471 @@ -2,18 +2,21 @@ dnl #
5472 dnl # Linux v3.2-rc1 API change
5473 dnl # SHA: bfe8684869601dacfcb2cd69ef8cfd9045f62170
5474 dnl #
5475 -AC_DEFUN([ZFS_AC_KERNEL_SET_NLINK], [
5476 - AC_MSG_CHECKING([whether set_nlink() is available])
5477 - ZFS_LINUX_TRY_COMPILE([
5478 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_NLINK], [
5479 + ZFS_LINUX_TEST_SRC([set_nlink], [
5480 #include <linux/fs.h>
5481 ],[
5482 struct inode node;
5483 unsigned int link = 0;
5484 (void) set_nlink(&node, link);
5485 - ],[
5486 + ])
5487 +])
5488 +
5489 +AC_DEFUN([ZFS_AC_KERNEL_SET_NLINK], [
5490 + AC_MSG_CHECKING([whether set_nlink() is available])
5491 + ZFS_LINUX_TEST_RESULT([set_nlink], [
5492 AC_MSG_RESULT(yes)
5493 - AC_DEFINE(HAVE_SET_NLINK, 1,
5494 - [set_nlink() is available])
5495 + AC_DEFINE(HAVE_SET_NLINK, 1, [set_nlink() is available])
5496 ],[
5497 AC_MSG_RESULT(no)
5498 ])
5499 diff --git a/config/kernel-setattr-prepare.m4 b/config/kernel-setattr-prepare.m4
5500 index 32f7deb77..45408c45c 100644
5501 --- a/config/kernel-setattr-prepare.m4
5502 +++ b/config/kernel-setattr-prepare.m4
5503 @@ -3,17 +3,21 @@ dnl # 4.9 API change
5504 dnl # The inode_change_ok() function has been renamed setattr_prepare()
5505 dnl # and updated to take a dentry rather than an inode.
5506 dnl #
5507 -AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE],
5508 - [AC_MSG_CHECKING([whether setattr_prepare() is available])
5509 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
5510 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SETATTR_PREPARE], [
5511 + ZFS_LINUX_TEST_SRC([setattr_prepare], [
5512 #include <linux/fs.h>
5513 ], [
5514 struct dentry *dentry = NULL;
5515 struct iattr *attr = NULL;
5516 - int error;
5517 + int error __attribute__ ((unused)) =
5518 + setattr_prepare(dentry, attr);
5519 + ])
5520 +])
5521
5522 - error = setattr_prepare(dentry, attr);
5523 - ], [setattr_prepare], [fs/attr.c], [
5524 +AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE], [
5525 + AC_MSG_CHECKING([whether setattr_prepare() is available])
5526 + ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare],
5527 + [setattr_prepare], [fs/attr.c], [
5528 AC_MSG_RESULT(yes)
5529 AC_DEFINE(HAVE_SETATTR_PREPARE, 1,
5530 [setattr_prepare() is available])
5531 diff --git a/config/kernel-sget-args.m4 b/config/kernel-sget-args.m4
5532 index 9d1745925..13581399e 100644
5533 --- a/config/kernel-sget-args.m4
5534 +++ b/config/kernel-sget-args.m4
5535 @@ -2,9 +2,8 @@ dnl #
5536 dnl # 3.6 API change,
5537 dnl # 'sget' now takes the mount flags as an argument.
5538 dnl #
5539 -AC_DEFUN([ZFS_AC_KERNEL_5ARG_SGET],
5540 - [AC_MSG_CHECKING([whether sget() wants 5 args])
5541 - ZFS_LINUX_TRY_COMPILE([
5542 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SGET], [
5543 + ZFS_LINUX_TEST_SRC([sget_5args], [
5544 #include <linux/fs.h>
5545 ],[
5546 struct file_system_type *type = NULL;
5547 @@ -13,11 +12,15 @@ AC_DEFUN([ZFS_AC_KERNEL_5ARG_SGET],
5548 int flags = 0;
5549 void *data = NULL;
5550 (void) sget(type, test, set, flags, data);
5551 - ],[
5552 + ])
5553 +])
5554 +
5555 +AC_DEFUN([ZFS_AC_KERNEL_SGET], [
5556 + AC_MSG_CHECKING([whether sget() wants 5 args])
5557 + ZFS_LINUX_TEST_RESULT([sget_5args], [
5558 AC_MSG_RESULT(yes)
5559 AC_DEFINE(HAVE_5ARG_SGET, 1, [sget() wants 5 args])
5560 ],[
5561 AC_MSG_RESULT(no)
5562 ])
5563 ])
5564 -
5565 diff --git a/config/kernel-show-options.m4 b/config/kernel-show-options.m4
5566 index 67d683c55..9e426bc39 100644
5567 --- a/config/kernel-show-options.m4
5568 +++ b/config/kernel-show-options.m4
5569 @@ -1,21 +1,26 @@
5570 dnl #
5571 dnl # Linux 3.3 API
5572 dnl #
5573 -AC_DEFUN([ZFS_AC_KERNEL_SHOW_OPTIONS], [
5574 - AC_MSG_CHECKING([whether sops->show_options() wants dentry])
5575 -
5576 - ZFS_LINUX_TRY_COMPILE([
5577 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SHOW_OPTIONS], [
5578 + ZFS_LINUX_TEST_SRC([super_operations_show_options], [
5579 #include <linux/fs.h>
5580
5581 - int show_options (struct seq_file * x, struct dentry * y) { return 0; };
5582 + int show_options(struct seq_file * x, struct dentry * y) {
5583 + return 0;
5584 + };
5585 +
5586 static struct super_operations sops __attribute__ ((unused)) = {
5587 .show_options = show_options,
5588 };
5589 - ],[
5590 - ],[
5591 + ],[])
5592 +])
5593 +
5594 +AC_DEFUN([ZFS_AC_KERNEL_SHOW_OPTIONS], [
5595 + AC_MSG_CHECKING([whether sops->show_options() wants dentry])
5596 + ZFS_LINUX_TEST_RESULT([super_operations_show_options], [
5597 AC_MSG_RESULT([yes])
5598 AC_DEFINE(HAVE_SHOW_OPTIONS_WITH_DENTRY, 1,
5599 - [sops->show_options() with dentry])
5600 + [sops->show_options() with dentry])
5601 ],[
5602 AC_MSG_RESULT([no])
5603 ])
5604 diff --git a/config/kernel-shrink.m4 b/config/kernel-shrink.m4
5605 index 405cbf42c..45b4b5d4b 100644
5606 --- a/config/kernel-shrink.m4
5607 +++ b/config/kernel-shrink.m4
5608 @@ -4,9 +4,8 @@ dnl # The super_block structure now stores a per-filesystem shrinker.
5609 dnl # This interface is preferable because it can be used to specifically
5610 dnl # target only the zfs filesystem for pruning.
5611 dnl #
5612 -AC_DEFUN([ZFS_AC_KERNEL_SHRINK], [
5613 - AC_MSG_CHECKING([whether super_block has s_shrink])
5614 - ZFS_LINUX_TRY_COMPILE([
5615 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK], [
5616 + ZFS_LINUX_TEST_SRC([super_block_s_shrink], [
5617 #include <linux/fs.h>
5618
5619 int shrink(struct shrinker *s, struct shrink_control *sc)
5620 @@ -18,8 +17,12 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK], [
5621 .s_shrink.seeks = DEFAULT_SEEKS,
5622 .s_shrink.batch = 0,
5623 };
5624 - ],[
5625 - ],[
5626 + ],[])
5627 +])
5628 +
5629 +AC_DEFUN([ZFS_AC_KERNEL_SUPER_BLOCK_S_SHRINK], [
5630 + AC_MSG_CHECKING([whether super_block has s_shrink])
5631 + ZFS_LINUX_TEST_RESULT([super_block_s_shrink], [
5632 AC_MSG_RESULT(yes)
5633 AC_DEFINE(HAVE_SHRINK, 1, [struct super_block has s_shrink])
5634
5635 @@ -50,15 +53,18 @@ dnl # a list_head is used. Then to prevent the spinning from occurring
5636 dnl # the .next pointer is set to the fs_supers list_head which ensures
5637 dnl # the iterate_supers_type() function will always terminate.
5638 dnl #
5639 -AC_DEFUN([ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD], [
5640 - AC_MSG_CHECKING([whether super_block has s_instances list_head])
5641 - ZFS_LINUX_TRY_COMPILE([
5642 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_INSTANCES_LIST_HEAD], [
5643 + ZFS_LINUX_TEST_SRC([super_block_s_instances_list_head], [
5644 #include <linux/fs.h>
5645 ],[
5646 struct super_block sb __attribute__ ((unused));
5647 -
5648 INIT_LIST_HEAD(&sb.s_instances);
5649 - ],[
5650 + ])
5651 +])
5652 +
5653 +AC_DEFUN([ZFS_AC_KERNEL_SUPER_BLOCK_S_INSTANCES_LIST_HEAD], [
5654 + AC_MSG_CHECKING([whether super_block has s_instances list_head])
5655 + ZFS_LINUX_TEST_RESULT([super_block_s_instances_list_head], [
5656 AC_MSG_RESULT(yes)
5657 AC_DEFINE(HAVE_S_INSTANCES_LIST_HEAD, 1,
5658 [struct super_block has s_instances list_head])
5659 @@ -67,9 +73,8 @@ AC_DEFUN([ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD], [
5660 ])
5661 ])
5662
5663 -AC_DEFUN([ZFS_AC_KERNEL_NR_CACHED_OBJECTS], [
5664 - AC_MSG_CHECKING([whether sops->nr_cached_objects() exists])
5665 - ZFS_LINUX_TRY_COMPILE([
5666 +AC_DEFUN([ZFS_AC_KERNEL_SRC_NR_CACHED_OBJECTS], [
5667 + ZFS_LINUX_TEST_SRC([nr_cached_objects], [
5668 #include <linux/fs.h>
5669
5670 int nr_cached_objects(struct super_block *sb) { return 0; }
5671 @@ -78,19 +83,22 @@ AC_DEFUN([ZFS_AC_KERNEL_NR_CACHED_OBJECTS], [
5672 sops __attribute__ ((unused)) = {
5673 .nr_cached_objects = nr_cached_objects,
5674 };
5675 - ],[
5676 - ],[
5677 + ],[])
5678 +])
5679 +
5680 +AC_DEFUN([ZFS_AC_KERNEL_NR_CACHED_OBJECTS], [
5681 + AC_MSG_CHECKING([whether sops->nr_cached_objects() exists])
5682 + ZFS_LINUX_TEST_RESULT([nr_cached_objects], [
5683 AC_MSG_RESULT(yes)
5684 AC_DEFINE(HAVE_NR_CACHED_OBJECTS, 1,
5685 - [sops->nr_cached_objects() exists])
5686 + [sops->nr_cached_objects() exists])
5687 ],[
5688 AC_MSG_RESULT(no)
5689 ])
5690 ])
5691
5692 -AC_DEFUN([ZFS_AC_KERNEL_FREE_CACHED_OBJECTS], [
5693 - AC_MSG_CHECKING([whether sops->free_cached_objects() exists])
5694 - ZFS_LINUX_TRY_COMPILE([
5695 +AC_DEFUN([ZFS_AC_KERNEL_SRC_FREE_CACHED_OBJECTS], [
5696 + ZFS_LINUX_TEST_SRC([free_cached_objects], [
5697 #include <linux/fs.h>
5698
5699 void free_cached_objects(struct super_block *sb, int x)
5700 @@ -100,11 +108,15 @@ AC_DEFUN([ZFS_AC_KERNEL_FREE_CACHED_OBJECTS], [
5701 sops __attribute__ ((unused)) = {
5702 .free_cached_objects = free_cached_objects,
5703 };
5704 - ],[
5705 - ],[
5706 + ],[])
5707 +])
5708 +
5709 +AC_DEFUN([ZFS_AC_KERNEL_FREE_CACHED_OBJECTS], [
5710 + AC_MSG_CHECKING([whether sops->free_cached_objects() exists])
5711 + ZFS_LINUX_TEST_RESULT([free_cached_objects], [
5712 AC_MSG_RESULT(yes)
5713 AC_DEFINE(HAVE_FREE_CACHED_OBJECTS, 1,
5714 - [sops->free_cached_objects() exists])
5715 + [sops->free_cached_objects() exists])
5716 ],[
5717 AC_MSG_RESULT(no)
5718 ])
5719 @@ -115,15 +127,19 @@ dnl # 3.12 API change
5720 dnl # The nid member was added to struct shrink_control to support
5721 dnl # NUMA-aware shrinkers.
5722 dnl #
5723 -AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID], [
5724 - AC_MSG_CHECKING([whether shrink_control has nid])
5725 - ZFS_LINUX_TRY_COMPILE([
5726 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_HAS_NID], [
5727 + ZFS_LINUX_TEST_SRC([shrink_control_nid], [
5728 #include <linux/fs.h>
5729 ],[
5730 struct shrink_control sc __attribute__ ((unused));
5731 unsigned long scnidsize __attribute__ ((unused)) =
5732 sizeof(sc.nid);
5733 - ],[
5734 + ])
5735 +])
5736 +
5737 +AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID], [
5738 + AC_MSG_CHECKING([whether shrink_control has nid])
5739 + ZFS_LINUX_TEST_RESULT([shrink_control_nid], [
5740 AC_MSG_RESULT(yes)
5741 AC_DEFINE(SHRINK_CONTROL_HAS_NID, 1,
5742 [struct shrink_control has nid])
5743 @@ -132,84 +148,96 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID], [
5744 ])
5745 ])
5746
5747 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK], [
5748 + ZFS_LINUX_TEST_SRC([shrinker_cb_2arg], [
5749 + #include <linux/mm.h>
5750 + int shrinker_cb(int nr_to_scan, gfp_t gfp_mask) { return 0; }
5751 + ],[
5752 + struct shrinker cache_shrinker = {
5753 + .shrink = shrinker_cb,
5754 + .seeks = DEFAULT_SEEKS,
5755 + };
5756 + register_shrinker(&cache_shrinker);
5757 + ])
5758
5759 -AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[
5760 - tmp_flags="$EXTRA_KCFLAGS"
5761 - EXTRA_KCFLAGS="-Werror"
5762 - dnl #
5763 - dnl # 2.6.23 to 2.6.34 API change
5764 - dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask)
5765 - dnl #
5766 - AC_MSG_CHECKING([whether old 2-argument shrinker exists])
5767 - ZFS_LINUX_TRY_COMPILE([
5768 + ZFS_LINUX_TEST_SRC([shrinker_cb_3arg], [
5769 #include <linux/mm.h>
5770 + int shrinker_cb(struct shrinker *shrink, int nr_to_scan,
5771 + gfp_t gfp_mask) { return 0; }
5772 + ],[
5773 + struct shrinker cache_shrinker = {
5774 + .shrink = shrinker_cb,
5775 + .seeks = DEFAULT_SEEKS,
5776 + };
5777 + register_shrinker(&cache_shrinker);
5778 + ])
5779
5780 - int shrinker_cb(int nr_to_scan, gfp_t gfp_mask) {
5781 - return 0;
5782 - }
5783 + ZFS_LINUX_TEST_SRC([shrinker_cb_shrink_control], [
5784 + #include <linux/mm.h>
5785 + int shrinker_cb(struct shrinker *shrink,
5786 + struct shrink_control *sc) { return 0; }
5787 ],[
5788 struct shrinker cache_shrinker = {
5789 .shrink = shrinker_cb,
5790 .seeks = DEFAULT_SEEKS,
5791 };
5792 register_shrinker(&cache_shrinker);
5793 + ])
5794 +
5795 + ZFS_LINUX_TEST_SRC([shrinker_cb_shrink_control_split], [
5796 + #include <linux/mm.h>
5797 + unsigned long shrinker_cb(struct shrinker *shrink,
5798 + struct shrink_control *sc) { return 0; }
5799 ],[
5800 + struct shrinker cache_shrinker = {
5801 + .count_objects = shrinker_cb,
5802 + .scan_objects = shrinker_cb,
5803 + .seeks = DEFAULT_SEEKS,
5804 + };
5805 + register_shrinker(&cache_shrinker);
5806 + ])
5807 +])
5808 +
5809 +AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[
5810 + dnl #
5811 + dnl # 2.6.23 to 2.6.34 API change
5812 + dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask)
5813 + dnl #
5814 + AC_MSG_CHECKING([whether old 2-argument shrinker exists])
5815 + ZFS_LINUX_TEST_RESULT([shrinker_cb_2arg], [
5816 AC_MSG_RESULT(yes)
5817 AC_DEFINE(HAVE_2ARGS_OLD_SHRINKER_CALLBACK, 1,
5818 - [old shrinker callback wants 2 args])
5819 + [old shrinker callback wants 2 args])
5820 ],[
5821 AC_MSG_RESULT(no)
5822 +
5823 dnl #
5824 dnl # 2.6.35 - 2.6.39 API change
5825 dnl # ->shrink(struct shrinker *,
5826 dnl # int nr_to_scan, gfp_t gfp_mask)
5827 dnl #
5828 AC_MSG_CHECKING([whether old 3-argument shrinker exists])
5829 - ZFS_LINUX_TRY_COMPILE([
5830 - #include <linux/mm.h>
5831 -
5832 - int shrinker_cb(struct shrinker *shrink, int nr_to_scan,
5833 - gfp_t gfp_mask) {
5834 - return 0;
5835 - }
5836 - ],[
5837 - struct shrinker cache_shrinker = {
5838 - .shrink = shrinker_cb,
5839 - .seeks = DEFAULT_SEEKS,
5840 - };
5841 - register_shrinker(&cache_shrinker);
5842 - ],[
5843 + ZFS_LINUX_TEST_RESULT([shrinker_cb_3arg], [
5844 AC_MSG_RESULT(yes)
5845 AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
5846 [old shrinker callback wants 3 args])
5847 ],[
5848 AC_MSG_RESULT(no)
5849 +
5850 dnl #
5851 dnl # 3.0 - 3.11 API change
5852 dnl # ->shrink(struct shrinker *,
5853 dnl # struct shrink_control *sc)
5854 dnl #
5855 AC_MSG_CHECKING(
5856 - [whether new 2-argument shrinker exists])
5857 - ZFS_LINUX_TRY_COMPILE([
5858 - #include <linux/mm.h>
5859 -
5860 - int shrinker_cb(struct shrinker *shrink,
5861 - struct shrink_control *sc) {
5862 - return 0;
5863 - }
5864 - ],[
5865 - struct shrinker cache_shrinker = {
5866 - .shrink = shrinker_cb,
5867 - .seeks = DEFAULT_SEEKS,
5868 - };
5869 - register_shrinker(&cache_shrinker);
5870 - ],[
5871 + [whether new 2-argument shrinker exists])
5872 + ZFS_LINUX_TEST_RESULT([shrinker_cb_shrink_control], [
5873 AC_MSG_RESULT(yes)
5874 AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1,
5875 [new shrinker callback wants 2 args])
5876 ],[
5877 AC_MSG_RESULT(no)
5878 +
5879 dnl #
5880 dnl # 3.12 API change,
5881 dnl # ->shrink() is logically split in to
5882 @@ -217,52 +245,61 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[
5883 dnl #
5884 AC_MSG_CHECKING(
5885 [whether ->count_objects callback exists])
5886 - ZFS_LINUX_TRY_COMPILE([
5887 - #include <linux/mm.h>
5888 -
5889 - unsigned long shrinker_cb(
5890 - struct shrinker *shrink,
5891 - struct shrink_control *sc) {
5892 - return 0;
5893 - }
5894 - ],[
5895 - struct shrinker cache_shrinker = {
5896 - .count_objects = shrinker_cb,
5897 - .scan_objects = shrinker_cb,
5898 - .seeks = DEFAULT_SEEKS,
5899 - };
5900 - register_shrinker(&cache_shrinker);
5901 - ],[
5902 + ZFS_LINUX_TEST_RESULT(
5903 + [shrinker_cb_shrink_control_split], [
5904 AC_MSG_RESULT(yes)
5905 AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK,
5906 1, [->count_objects exists])
5907 ],[
5908 - AC_MSG_ERROR(error)
5909 + ZFS_LINUX_TEST_ERROR([shrinker])
5910 ])
5911 ])
5912 ])
5913 ])
5914 - EXTRA_KCFLAGS="$tmp_flags"
5915 ])
5916
5917 dnl #
5918 dnl # 2.6.39 API change,
5919 dnl # Shrinker adjust to use common shrink_control structure.
5920 dnl #
5921 -AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT], [
5922 - AC_MSG_CHECKING([whether struct shrink_control exists])
5923 - ZFS_LINUX_TRY_COMPILE([
5924 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_STRUCT], [
5925 + ZFS_LINUX_TEST_SRC([shrink_control_struct], [
5926 #include <linux/mm.h>
5927 ],[
5928 struct shrink_control sc __attribute__ ((unused));
5929
5930 sc.nr_to_scan = 0;
5931 sc.gfp_mask = GFP_KERNEL;
5932 - ],[
5933 + ])
5934 +])
5935 +
5936 +AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT], [
5937 + AC_MSG_CHECKING([whether struct shrink_control exists])
5938 + ZFS_LINUX_TEST_RESULT([shrink_control_struct], [
5939 AC_MSG_RESULT(yes)
5940 AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
5941 - [struct shrink_control exists])
5942 + [struct shrink_control exists])
5943 ],[
5944 AC_MSG_RESULT(no)
5945 ])
5946 ])
5947 +
5948 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER], [
5949 + ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK
5950 + ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_INSTANCES_LIST_HEAD
5951 + ZFS_AC_KERNEL_SRC_NR_CACHED_OBJECTS
5952 + ZFS_AC_KERNEL_SRC_FREE_CACHED_OBJECTS
5953 + ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_HAS_NID
5954 + ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK
5955 + ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_STRUCT
5956 +])
5957 +
5958 +AC_DEFUN([ZFS_AC_KERNEL_SHRINKER], [
5959 + ZFS_AC_KERNEL_SUPER_BLOCK_S_SHRINK
5960 + ZFS_AC_KERNEL_SUPER_BLOCK_S_INSTANCES_LIST_HEAD
5961 + ZFS_AC_KERNEL_NR_CACHED_OBJECTS
5962 + ZFS_AC_KERNEL_FREE_CACHED_OBJECTS
5963 + ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID
5964 + ZFS_AC_KERNEL_SHRINKER_CALLBACK
5965 + ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT
5966 +])
5967 diff --git a/config/kernel-submit_bio.m4 b/config/kernel-submit_bio.m4
5968 index da5f85ca7..cf80e9b83 100644
5969 --- a/config/kernel-submit_bio.m4
5970 +++ b/config/kernel-submit_bio.m4
5971 @@ -3,15 +3,19 @@ dnl # 4.8 API change
5972 dnl # The rw argument has been removed from submit_bio/submit_bio_wait.
5973 dnl # Callers are now expected to set bio->bi_rw instead of passing it in.
5974 dnl #
5975 -AC_DEFUN([ZFS_AC_KERNEL_SUBMIT_BIO], [
5976 - AC_MSG_CHECKING([whether submit_bio() wants 1 arg])
5977 - ZFS_LINUX_TRY_COMPILE([
5978 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SUBMIT_BIO], [
5979 + ZFS_LINUX_TEST_SRC([submit_bio], [
5980 #include <linux/bio.h>
5981 ],[
5982 blk_qc_t blk_qc;
5983 struct bio *bio = NULL;
5984 blk_qc = submit_bio(bio);
5985 - ],[
5986 + ])
5987 +])
5988 +
5989 +AC_DEFUN([ZFS_AC_KERNEL_SUBMIT_BIO], [
5990 + AC_MSG_CHECKING([whether submit_bio() wants 1 arg])
5991 + ZFS_LINUX_TEST_RESULT([submit_bio], [
5992 AC_MSG_RESULT(yes)
5993 AC_DEFINE(HAVE_1ARG_SUBMIT_BIO, 1, [submit_bio() wants 1 arg])
5994 ],[
5995 diff --git a/config/kernel-super-userns.m4 b/config/kernel-super-userns.m4
5996 index de94ad967..1ad35f2d1 100644
5997 --- a/config/kernel-super-userns.m4
5998 +++ b/config/kernel-super-userns.m4
5999 @@ -3,15 +3,19 @@ dnl # 4.8 API change
6000 dnl # struct user_namespace was added to struct super_block as
6001 dnl # super->s_user_ns member
6002 dnl #
6003 -AC_DEFUN([ZFS_AC_KERNEL_SUPER_USER_NS], [
6004 - AC_MSG_CHECKING([whether super_block->s_user_ns exists])
6005 - ZFS_LINUX_TRY_COMPILE([
6006 +AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_USER_NS], [
6007 + ZFS_LINUX_TEST_SRC([super_user_ns], [
6008 #include <linux/fs.h>
6009 #include <linux/user_namespace.h>
6010 - ],[
6011 + ], [
6012 struct super_block super;
6013 super.s_user_ns = (struct user_namespace *)NULL;
6014 - ],[
6015 + ])
6016 +])
6017 +
6018 +AC_DEFUN([ZFS_AC_KERNEL_SUPER_USER_NS], [
6019 + AC_MSG_CHECKING([whether super_block->s_user_ns exists])
6020 + ZFS_LINUX_TEST_RESULT([super_user_ns], [
6021 AC_MSG_RESULT(yes)
6022 AC_DEFINE(HAVE_SUPER_USER_NS, 1,
6023 [super_block->s_user_ns exists])
6024 diff --git a/config/kernel-timer.m4 b/config/kernel-timer.m4
6025 index b0e1afa15..5e8fc0d3a 100644
6026 --- a/config/kernel-timer.m4
6027 +++ b/config/kernel-timer.m4
6028 @@ -8,13 +8,9 @@ dnl # kernels that support the new timer_list.func signature.
6029 dnl #
6030 dnl # Also check for the existance of flags in struct timer_list, they were
6031 dnl # added in 4.1-rc8 via 0eeda71bc30d.
6032 -
6033 -AC_DEFUN([ZFS_AC_KERNEL_TIMER_SETUP], [
6034 - AC_MSG_CHECKING([whether timer_setup() is available])
6035 - tmp_flags="$EXTRA_KCFLAGS"
6036 - EXTRA_KCFLAGS="-Werror"
6037 -
6038 - ZFS_LINUX_TRY_COMPILE([
6039 +dnl #
6040 +AC_DEFUN([ZFS_AC_KERNEL_SRC_TIMER_SETUP], [
6041 + ZFS_LINUX_TEST_SRC([timer_setup], [
6042 #include <linux/timer.h>
6043
6044 struct my_task_timer {
6045 @@ -24,13 +20,34 @@ AC_DEFUN([ZFS_AC_KERNEL_TIMER_SETUP], [
6046
6047 void task_expire(struct timer_list *tl)
6048 {
6049 - struct my_task_timer *task_timer = from_timer(task_timer, tl, timer);
6050 + struct my_task_timer *task_timer =
6051 + from_timer(task_timer, tl, timer);
6052 task_timer->data = 42;
6053 }
6054 ],[
6055 struct my_task_timer task_timer;
6056 timer_setup(&task_timer.timer, task_expire, 0);
6057 + ])
6058 +
6059 + ZFS_LINUX_TEST_SRC([timer_list_function], [
6060 + #include <linux/timer.h>
6061 + void task_expire(struct timer_list *tl) {}
6062 ],[
6063 + struct timer_list tl;
6064 + tl.function = task_expire;
6065 + ])
6066 +
6067 + ZFS_LINUX_TEST_SRC([timer_list_flags], [
6068 + #include <linux/timer.h>
6069 + ],[
6070 + struct timer_list tl;
6071 + tl.flags = 2;
6072 + ])
6073 +])
6074 +
6075 +AC_DEFUN([ZFS_AC_KERNEL_TIMER_SETUP], [
6076 + AC_MSG_CHECKING([whether timer_setup() is available])
6077 + ZFS_LINUX_TEST_RESULT([timer_setup], [
6078 AC_MSG_RESULT(yes)
6079 AC_DEFINE(HAVE_KERNEL_TIMER_SETUP, 1,
6080 [timer_setup() is available])
6081 @@ -39,14 +56,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TIMER_SETUP], [
6082 ])
6083
6084 AC_MSG_CHECKING([whether timer function expects timer_list])
6085 -
6086 - ZFS_LINUX_TRY_COMPILE([
6087 - #include <linux/timer.h>
6088 - void task_expire(struct timer_list *tl) {}
6089 - ],[
6090 - struct timer_list tl;
6091 - tl.function = task_expire;
6092 - ],[
6093 + ZFS_LINUX_TEST_RESULT([timer_list_function], [
6094 AC_MSG_RESULT(yes)
6095 AC_DEFINE(HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST, 1,
6096 [timer_list.function gets a timer_list])
6097 @@ -55,19 +65,11 @@ AC_DEFUN([ZFS_AC_KERNEL_TIMER_SETUP], [
6098 ])
6099
6100 AC_MSG_CHECKING([whether struct timer_list has flags])
6101 -
6102 - ZFS_LINUX_TRY_COMPILE([
6103 - #include <linux/timer.h>
6104 - ],[
6105 - struct timer_list tl;
6106 - tl.flags = 2;
6107 - ],[
6108 + ZFS_LINUX_TEST_RESULT([timer_list_flags], [
6109 AC_MSG_RESULT(yes)
6110 AC_DEFINE(HAVE_KERNEL_TIMER_LIST_FLAGS, 1,
6111 [struct timer_list has a flags member])
6112 ],[
6113 AC_MSG_RESULT(no)
6114 ])
6115 -
6116 - EXTRA_KCFLAGS="$tmp_flags"
6117 ])
6118 diff --git a/config/kernel-tmpfile.m4 b/config/kernel-tmpfile.m4
6119 index 5aad90450..f510bfe6b 100644
6120 --- a/config/kernel-tmpfile.m4
6121 +++ b/config/kernel-tmpfile.m4
6122 @@ -2,9 +2,8 @@ dnl #
6123 dnl # 3.11 API change
6124 dnl # Add support for i_op->tmpfile
6125 dnl #
6126 -AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
6127 - AC_MSG_CHECKING([whether i_op->tmpfile() exists])
6128 - ZFS_LINUX_TRY_COMPILE([
6129 +AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
6130 + ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
6131 #include <linux/fs.h>
6132 int tmpfile(struct inode *inode, struct dentry *dentry,
6133 umode_t mode) { return 0; }
6134 @@ -12,11 +11,14 @@ AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
6135 iops __attribute__ ((unused)) = {
6136 .tmpfile = tmpfile,
6137 };
6138 - ],[
6139 - ],[
6140 + ],[])
6141 +])
6142 +
6143 +AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
6144 + AC_MSG_CHECKING([whether i_op->tmpfile() exists])
6145 + ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
6146 AC_MSG_RESULT(yes)
6147 - AC_DEFINE(HAVE_TMPFILE, 1,
6148 - [i_op->tmpfile() exists])
6149 + AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
6150 ],[
6151 AC_MSG_RESULT(no)
6152 ])
6153 diff --git a/config/kernel-totalhigh_pages.m4 b/config/kernel-totalhigh_pages.m4
6154 index b22e86d4d..4ecb03a50 100644
6155 --- a/config/kernel-totalhigh_pages.m4
6156 +++ b/config/kernel-totalhigh_pages.m4
6157 @@ -1,16 +1,18 @@
6158 dnl #
6159 dnl # 5.0 API change
6160 dnl #
6161 -dnl # ca79b0c211af mm: convert totalram_pages and totalhigh_pages variables to atomic
6162 -dnl #
6163 -AC_DEFUN([ZFS_AC_KERNEL_TOTALHIGH_PAGES], [
6164 - AC_MSG_CHECKING([whether totalhigh_pages() exists])
6165 - ZFS_LINUX_TRY_COMPILE([
6166 +AC_DEFUN([ZFS_AC_KERNEL_SRC_TOTALHIGH_PAGES], [
6167 + ZFS_LINUX_TEST_SRC([totalhigh_pages], [
6168 #include <linux/highmem.h>
6169 ],[
6170 unsigned long pages __attribute__ ((unused));
6171 pages = totalhigh_pages();
6172 - ],[
6173 + ])
6174 +])
6175 +
6176 +AC_DEFUN([ZFS_AC_KERNEL_TOTALHIGH_PAGES], [
6177 + AC_MSG_CHECKING([whether totalhigh_pages() exists])
6178 + ZFS_LINUX_TEST_RESULT([totalhigh_pages], [
6179 AC_MSG_RESULT(yes)
6180 AC_DEFINE(HAVE_TOTALHIGH_PAGES, 1, [totalhigh_pages() exists])
6181 ],[
6182 diff --git a/config/kernel-totalram-pages-func.m4 b/config/kernel-totalram-pages-func.m4
6183 index a6eac6454..d0e812a8d 100644
6184 --- a/config/kernel-totalram-pages-func.m4
6185 +++ b/config/kernel-totalram-pages-func.m4
6186 @@ -2,16 +2,21 @@ dnl #
6187 dnl # Linux 5.0: totalram_pages is no longer a global variable, and must be
6188 dnl # read via the totalram_pages() helper function.
6189 dnl #
6190 -AC_DEFUN([ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNC], [
6191 - AC_MSG_CHECKING([whether totalram_pages() exists])
6192 - ZFS_LINUX_TRY_COMPILE([
6193 +AC_DEFUN([ZFS_AC_KERNEL_SRC_TOTALRAM_PAGES_FUNC], [
6194 + ZFS_LINUX_TEST_SRC([totalram_pages], [
6195 #include <linux/mm.h>
6196 ],[
6197 unsigned long pages __attribute__ ((unused));
6198 pages = totalram_pages();
6199 - ],[
6200 + ])
6201 +])
6202 +
6203 +AC_DEFUN([ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNC], [
6204 + AC_MSG_CHECKING([whether totalram_pages() exists])
6205 + ZFS_LINUX_TEST_RESULT([totalram_pages], [
6206 AC_MSG_RESULT(yes)
6207 - AC_DEFINE(HAVE_TOTALRAM_PAGES_FUNC, 1, [kernel has totalram_pages()])
6208 + AC_DEFINE(HAVE_TOTALRAM_PAGES_FUNC, 1,
6209 + [kernel has totalram_pages()])
6210 ],[
6211 AC_MSG_RESULT(no)
6212 ])
6213 diff --git a/config/kernel-truncate-range.m4 b/config/kernel-truncate-range.m4
6214 index da2cb50fc..8fdbb1086 100644
6215 --- a/config/kernel-truncate-range.m4
6216 +++ b/config/kernel-truncate-range.m4
6217 @@ -4,17 +4,20 @@ dnl # torvalds/linux@17cf28afea2a1112f240a3a2da8af883be024811 removed
6218 dnl # truncate_range(). The file hole punching functionality is now
6219 dnl # provided by fallocate()
6220 dnl #
6221 -AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_RANGE], [
6222 - AC_MSG_CHECKING([whether iops->truncate_range() exists])
6223 - ZFS_LINUX_TRY_COMPILE([
6224 +AC_DEFUN([ZFS_AC_KERNEL_SRC_TRUNCATE_RANGE], [
6225 + ZFS_LINUX_TEST_SRC([inode_operations_truncate_range], [
6226 #include <linux/fs.h>
6227 void truncate_range(struct inode *inode, loff_t start,
6228 loff_t end) { return; }
6229 static struct inode_operations iops __attribute__ ((unused)) = {
6230 .truncate_range = truncate_range,
6231 };
6232 - ],[
6233 - ],[
6234 + ],[])
6235 +])
6236 +
6237 +AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_RANGE], [
6238 + AC_MSG_CHECKING([whether iops->truncate_range() exists])
6239 + ZFS_LINUX_TEST_RESULT([inode_operations_truncate_range], [
6240 AC_MSG_RESULT(yes)
6241 AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1,
6242 [iops->truncate_range() exists])
6243 diff --git a/config/kernel-truncate-setsize.m4 b/config/kernel-truncate-setsize.m4
6244 index 7e4aff479..e719c1444 100644
6245 --- a/config/kernel-truncate-setsize.m4
6246 +++ b/config/kernel-truncate-setsize.m4
6247 @@ -2,16 +2,21 @@ dnl #
6248 dnl # 2.6.35 API change
6249 dnl # Added truncate_setsize() helper function.
6250 dnl #
6251 -AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_SETSIZE],
6252 - [AC_MSG_CHECKING([whether truncate_setsize() is available])
6253 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
6254 +AC_DEFUN([ZFS_AC_KERNEL_SRC_TRUNCATE_SETSIZE], [
6255 + ZFS_LINUX_TEST_SRC([truncate_setsize], [
6256 #include <linux/mm.h>
6257 ], [
6258 truncate_setsize(NULL, 0);
6259 - ], [truncate_setsize], [mm/truncate.c], [
6260 + ])
6261 +])
6262 +
6263 +AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_SETSIZE], [
6264 + AC_MSG_CHECKING([whether truncate_setsize() is available])
6265 + ZFS_LINUX_TEST_RESULT_SYMBOL([truncate_setsize],
6266 + [truncate_setsize], [mm/truncate.c], [
6267 AC_MSG_RESULT(yes)
6268 AC_DEFINE(HAVE_TRUNCATE_SETSIZE, 1,
6269 - [truncate_setsize() is available])
6270 + [truncate_setsize() is available])
6271 ], [
6272 AC_MSG_RESULT(no)
6273 ])
6274 diff --git a/config/kernel-userns-capabilities.m4 b/config/kernel-userns-capabilities.m4
6275 index fa3381978..5dcbc03d3 100644
6276 --- a/config/kernel-userns-capabilities.m4
6277 +++ b/config/kernel-userns-capabilities.m4
6278 @@ -2,16 +2,19 @@ dnl #
6279 dnl # 2.6.38 API change
6280 dnl # ns_capable() was introduced
6281 dnl #
6282 -AC_DEFUN([ZFS_AC_KERNEL_NS_CAPABLE], [
6283 - AC_MSG_CHECKING([whether ns_capable exists])
6284 - ZFS_LINUX_TRY_COMPILE([
6285 +AC_DEFUN([ZFS_AC_KERNEL_SRC_NS_CAPABLE], [
6286 + ZFS_LINUX_TEST_SRC([ns_capable], [
6287 #include <linux/capability.h>
6288 ],[
6289 ns_capable((struct user_namespace *)NULL, CAP_SYS_ADMIN);
6290 - ],[
6291 + ])
6292 +])
6293 +
6294 +AC_DEFUN([ZFS_AC_KERNEL_NS_CAPABLE], [
6295 + AC_MSG_CHECKING([whether ns_capable exists])
6296 + ZFS_LINUX_TEST_RESULT([ns_capable], [
6297 AC_MSG_RESULT(yes)
6298 - AC_DEFINE(HAVE_NS_CAPABLE, 1,
6299 - [ns_capable exists])
6300 + AC_DEFINE(HAVE_NS_CAPABLE, 1, [ns_capable exists])
6301 ],[
6302 AC_MSG_RESULT(no)
6303 ])
6304 @@ -23,17 +26,20 @@ dnl # struct user_namespace was added to struct cred_t as
6305 dnl # cred->user_ns member
6306 dnl # Note that current_user_ns() was added in 2.6.28.
6307 dnl #
6308 -AC_DEFUN([ZFS_AC_KERNEL_CRED_USER_NS], [
6309 - AC_MSG_CHECKING([whether cred_t->user_ns exists])
6310 - ZFS_LINUX_TRY_COMPILE([
6311 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CRED_USER_NS], [
6312 + ZFS_LINUX_TEST_SRC([cred_user_ns], [
6313 #include <linux/cred.h>
6314 ],[
6315 struct cred cr;
6316 cr.user_ns = (struct user_namespace *)NULL;
6317 - ],[
6318 + ])
6319 +])
6320 +
6321 +AC_DEFUN([ZFS_AC_KERNEL_CRED_USER_NS], [
6322 + AC_MSG_CHECKING([whether cred_t->user_ns exists])
6323 + ZFS_LINUX_TEST_RESULT([cred_user_ns], [
6324 AC_MSG_RESULT(yes)
6325 - AC_DEFINE(HAVE_CRED_USER_NS, 1,
6326 - [cred_t->user_ns exists])
6327 + AC_DEFINE(HAVE_CRED_USER_NS, 1, [cred_t->user_ns exists])
6328 ],[
6329 AC_MSG_RESULT(no)
6330 ])
6331 @@ -44,14 +50,18 @@ dnl # 3.4 API change
6332 dnl # kuid_has_mapping() and kgid_has_mapping() were added to distinguish
6333 dnl # between internal kernel uids/gids and user namespace uids/gids.
6334 dnl #
6335 -AC_DEFUN([ZFS_AC_KERNEL_KUID_HAS_MAPPING], [
6336 - AC_MSG_CHECKING([whether kuid_has_mapping/kgid_has_mapping exist])
6337 - ZFS_LINUX_TRY_COMPILE([
6338 +AC_DEFUN([ZFS_AC_KERNEL_SRC_KUID_HAS_MAPPING], [
6339 + ZFS_LINUX_TEST_SRC([kuid_has_mapping], [
6340 #include <linux/uidgid.h>
6341 ],[
6342 kuid_has_mapping((struct user_namespace *)NULL, KUIDT_INIT(0));
6343 kgid_has_mapping((struct user_namespace *)NULL, KGIDT_INIT(0));
6344 - ],[
6345 + ])
6346 +])
6347 +
6348 +AC_DEFUN([ZFS_AC_KERNEL_KUID_HAS_MAPPING], [
6349 + AC_MSG_CHECKING([whether kuid_has_mapping/kgid_has_mapping exist])
6350 + ZFS_LINUX_TEST_RESULT([kuid_has_mapping], [
6351 AC_MSG_RESULT(yes)
6352 AC_DEFINE(HAVE_KUID_HAS_MAPPING, 1,
6353 [kuid_has_mapping/kgid_has_mapping exist])
6354 @@ -60,6 +70,12 @@ AC_DEFUN([ZFS_AC_KERNEL_KUID_HAS_MAPPING], [
6355 ])
6356 ])
6357
6358 +AC_DEFUN([ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES], [
6359 + ZFS_AC_KERNEL_SRC_NS_CAPABLE
6360 + ZFS_AC_KERNEL_SRC_CRED_USER_NS
6361 + ZFS_AC_KERNEL_SRC_KUID_HAS_MAPPING
6362 +])
6363 +
6364 AC_DEFUN([ZFS_AC_KERNEL_USERNS_CAPABILITIES], [
6365 ZFS_AC_KERNEL_NS_CAPABLE
6366 ZFS_AC_KERNEL_CRED_USER_NS
6367 diff --git a/config/kernel-urange-sleep.m4 b/config/kernel-usleep_range.m4
6368 similarity index 60%
6369 rename from config/kernel-urange-sleep.m4
6370 rename to config/kernel-usleep_range.m4
6371 index b5764de3e..5bf051ab4 100644
6372 --- a/config/kernel-urange-sleep.m4
6373 +++ b/config/kernel-usleep_range.m4
6374 @@ -1,20 +1,23 @@
6375 dnl #
6376 -dnl # 2.6.36 API compatibility.
6377 -dnl # Added usleep_range timer.
6378 +dnl # 2.6.36 API compatibility- Added usleep_range timer.
6379 +dnl #
6380 dnl # usleep_range is a finer precision implementation of msleep
6381 dnl # designed to be a drop-in replacement for udelay where a precise
6382 dnl # sleep / busy-wait is unnecessary.
6383 dnl #
6384 -AC_DEFUN([ZFS_AC_KERNEL_USLEEP_RANGE], [
6385 - AC_MSG_CHECKING([whether usleep_range() is available])
6386 - ZFS_LINUX_TRY_COMPILE([
6387 +AC_DEFUN([ZFS_AC_KERNEL_SRC_USLEEP_RANGE], [
6388 + ZFS_LINUX_TEST_SRC([usleep_range], [
6389 #include <linux/delay.h>
6390 ],[
6391 usleep_range(0, 0);
6392 - ],[
6393 + ])
6394 +])
6395 +
6396 +AC_DEFUN([ZFS_AC_KERNEL_USLEEP_RANGE], [
6397 + AC_MSG_CHECKING([whether usleep_range() is available])
6398 + ZFS_LINUX_TEST_RESULT([usleep_range], [
6399 AC_MSG_RESULT(yes)
6400 - AC_DEFINE(HAVE_USLEEP_RANGE, 1,
6401 - [usleep_range is available])
6402 + AC_DEFINE(HAVE_USLEEP_RANGE, 1, [usleep_range is available])
6403 ],[
6404 AC_MSG_RESULT(no)
6405 ])
6406 diff --git a/config/kernel-vfs-direct_IO.m4 b/config/kernel-vfs-direct_IO.m4
6407 index cc50bfbe4..82583d52f 100644
6408 --- a/config/kernel-vfs-direct_IO.m4
6409 +++ b/config/kernel-vfs-direct_IO.m4
6410 @@ -1,9 +1,8 @@
6411 dnl #
6412 -dnl # Linux 4.6.x API change
6413 +dnl # Check for direct IO interfaces.
6414 dnl #
6415 -AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER], [
6416 - AC_MSG_CHECKING([whether aops->direct_IO() uses iov_iter])
6417 - ZFS_LINUX_TRY_COMPILE([
6418 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO], [
6419 + ZFS_LINUX_TEST_SRC([direct_io_iter], [
6420 #include <linux/fs.h>
6421
6422 ssize_t test_direct_IO(struct kiocb *kiocb,
6423 @@ -13,24 +12,9 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER], [
6424 aops __attribute__ ((unused)) = {
6425 .direct_IO = test_direct_IO,
6426 };
6427 - ],[
6428 - ],[
6429 - AC_MSG_RESULT([yes])
6430 - AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER, 1,
6431 - [aops->direct_IO() uses iov_iter without rw])
6432 - zfs_ac_direct_io="yes"
6433 - ],[
6434 - AC_MSG_RESULT([no])
6435 - ])
6436 -])
6437 + ],[])
6438
6439 -dnl #
6440 -dnl # Linux 4.1.x API change
6441 -dnl #
6442 -AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_OFFSET], [
6443 - AC_MSG_CHECKING(
6444 - [whether aops->direct_IO() uses iov_iter with offset])
6445 - ZFS_LINUX_TRY_COMPILE([
6446 + ZFS_LINUX_TEST_SRC([direct_io_iter_offset], [
6447 #include <linux/fs.h>
6448
6449 ssize_t test_direct_IO(struct kiocb *kiocb,
6450 @@ -40,24 +24,9 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_OFFSET], [
6451 aops __attribute__ ((unused)) = {
6452 .direct_IO = test_direct_IO,
6453 };
6454 - ],[
6455 - ],[
6456 - AC_MSG_RESULT([yes])
6457 - AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER_OFFSET, 1,
6458 - [aops->direct_IO() uses iov_iter with offset])
6459 - zfs_ac_direct_io="yes"
6460 - ],[
6461 - AC_MSG_RESULT([no])
6462 - ])
6463 -])
6464 + ],[])
6465
6466 -dnl #
6467 -dnl # Linux 3.16.x API change
6468 -dnl #
6469 -AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_RW_OFFSET], [
6470 - AC_MSG_CHECKING(
6471 - [whether aops->direct_IO() uses iov_iter with rw and offset])
6472 - ZFS_LINUX_TRY_COMPILE([
6473 + ZFS_LINUX_TEST_SRC([direct_io_iter_rw_offset], [
6474 #include <linux/fs.h>
6475
6476 ssize_t test_direct_IO(int rw, struct kiocb *kiocb,
6477 @@ -67,23 +36,9 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_RW_OFFSET], [
6478 aops __attribute__ ((unused)) = {
6479 .direct_IO = test_direct_IO,
6480 };
6481 - ],[
6482 - ],[
6483 - AC_MSG_RESULT([yes])
6484 - AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET, 1,
6485 - [aops->direct_IO() uses iov_iter with rw and offset])
6486 - zfs_ac_direct_io="yes"
6487 - ],[
6488 - AC_MSG_RESULT([no])
6489 - ])
6490 -])
6491 + ],[])
6492
6493 -dnl #
6494 -dnl # Ancient Linux API (predates git)
6495 -dnl #
6496 -AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_IOVEC], [
6497 - AC_MSG_CHECKING([whether aops->direct_IO() uses iovec])
6498 - ZFS_LINUX_TRY_COMPILE([
6499 + ZFS_LINUX_TEST_SRC([direct_io_iovec], [
6500 #include <linux/fs.h>
6501
6502 ssize_t test_direct_IO(int rw, struct kiocb *kiocb,
6503 @@ -94,37 +49,61 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_IOVEC], [
6504 aops __attribute__ ((unused)) = {
6505 .direct_IO = test_direct_IO,
6506 };
6507 - ],[
6508 - ],[
6509 - AC_MSG_RESULT([yes])
6510 - AC_DEFINE(HAVE_VFS_DIRECT_IO_IOVEC, 1,
6511 - [aops->direct_IO() uses iovec])
6512 - zfs_ac_direct_io="yes"
6513 - ],[
6514 - AC_MSG_RESULT([no])
6515 - ])
6516 + ],[])
6517 ])
6518
6519 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO], [
6520 - zfs_ac_direct_io="no"
6521 -
6522 - if test "$zfs_ac_direct_io" = "no"; then
6523 - ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER
6524 - fi
6525 -
6526 - if test "$zfs_ac_direct_io" = "no"; then
6527 - ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_OFFSET
6528 - fi
6529 -
6530 - if test "$zfs_ac_direct_io" = "no"; then
6531 - ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_RW_OFFSET
6532 - fi
6533 -
6534 - if test "$zfs_ac_direct_io" = "no"; then
6535 - ZFS_AC_KERNEL_VFS_DIRECT_IO_IOVEC
6536 - fi
6537 + dnl #
6538 + dnl # Linux 4.6.x API change
6539 + dnl #
6540 + AC_MSG_CHECKING([whether aops->direct_IO() uses iov_iter])
6541 + ZFS_LINUX_TEST_RESULT([direct_io_iter], [
6542 + AC_MSG_RESULT([yes])
6543 + AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER, 1,
6544 + [aops->direct_IO() uses iov_iter without rw])
6545 + ],[
6546 + AC_MSG_RESULT([no])
6547
6548 - if test "$zfs_ac_direct_io" = "no"; then
6549 - AC_MSG_ERROR([no; unknown direct IO interface])
6550 - fi
6551 + dnl #
6552 + dnl # Linux 4.1.x API change
6553 + dnl #
6554 + AC_MSG_CHECKING(
6555 + [whether aops->direct_IO() uses offset])
6556 + ZFS_LINUX_TEST_RESULT([direct_io_iter_offset], [
6557 + AC_MSG_RESULT([yes])
6558 + AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER_OFFSET, 1,
6559 + [aops->direct_IO() uses iov_iter with offset])
6560 +
6561 + ],[
6562 + AC_MSG_RESULT([no])
6563 +
6564 + dnl #
6565 + dnl # Linux 3.16.x API change
6566 + dnl #
6567 + AC_MSG_CHECKING(
6568 + [whether aops->direct_IO() uses rw and offset])
6569 + ZFS_LINUX_TEST_RESULT([direct_io_iter_rw_offset], [
6570 + AC_MSG_RESULT([yes])
6571 + AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET, 1,
6572 + [aops->direct_IO() uses iov_iter with ]
6573 + [rw and offset])
6574 + ],[
6575 + AC_MSG_RESULT([no])
6576 +
6577 + dnl #
6578 + dnl # Ancient Linux API (predates git)
6579 + dnl #
6580 + AC_MSG_CHECKING(
6581 + [whether aops->direct_IO() uses iovec])
6582 + ZFS_LINUX_TEST_RESULT([direct_io_iovec], [
6583 + AC_MSG_RESULT([yes])
6584 + AC_DEFINE(HAVE_VFS_DIRECT_IO_IOVEC, 1,
6585 + [aops->direct_IO() uses iovec])
6586 + ],[
6587 + ZFS_LINUX_TEST_ERROR([direct IO])
6588 + AC_MSG_RESULT([no])
6589 + ])
6590 + ])
6591 + ])
6592 + ])
6593 ])
6594 diff --git a/config/kernel-vfs-fsync.m4 b/config/kernel-vfs-fsync.m4
6595 index a474f9f17..18a60d29a 100644
6596 --- a/config/kernel-vfs-fsync.m4
6597 +++ b/config/kernel-vfs-fsync.m4
6598 @@ -2,13 +2,17 @@ dnl #
6599 dnl # 2.6.35 API change,
6600 dnl # Unused 'struct dentry *' removed from vfs_fsync() prototype.
6601 dnl #
6602 -AC_DEFUN([ZFS_AC_KERNEL_2ARGS_VFS_FSYNC], [
6603 - AC_MSG_CHECKING([whether vfs_fsync() wants 2 args])
6604 - ZFS_LINUX_TRY_COMPILE([
6605 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_FSYNC_2ARGS], [
6606 + ZFS_LINUX_TEST_SRC([vfs_fsync_2args], [
6607 #include <linux/fs.h>
6608 ],[
6609 vfs_fsync(NULL, 0);
6610 - ],[
6611 + ])
6612 +])
6613 +
6614 +AC_DEFUN([ZFS_AC_KERNEL_VFS_FSYNC_2ARGS], [
6615 + AC_MSG_CHECKING([whether vfs_fsync() wants 2 args])
6616 + ZFS_LINUX_TEST_RESULT([vfs_fsync_2args], [
6617 AC_MSG_RESULT(yes)
6618 AC_DEFINE(HAVE_2ARGS_VFS_FSYNC, 1, [vfs_fsync() wants 2 args])
6619 ],[
6620 diff --git a/config/kernel-vfs-getattr.m4 b/config/kernel-vfs-getattr.m4
6621 index b13723538..eb07853cc 100644
6622 --- a/config/kernel-vfs-getattr.m4
6623 +++ b/config/kernel-vfs-getattr.m4
6624 @@ -2,19 +2,23 @@ dnl #
6625 dnl # 4.11 API, a528d35e@torvalds/linux
6626 dnl # vfs_getattr(const struct path *p, struct kstat *s, u32 m, unsigned int f)
6627 dnl #
6628 -AC_DEFUN([ZFS_AC_KERNEL_4ARGS_VFS_GETATTR], [
6629 - AC_MSG_CHECKING([whether vfs_getattr() wants 4 args])
6630 - ZFS_LINUX_TRY_COMPILE([
6631 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_GETATTR_4ARGS], [
6632 + ZFS_LINUX_TEST_SRC([vfs_getattr_4args], [
6633 #include <linux/fs.h>
6634 ],[
6635 vfs_getattr((const struct path *)NULL,
6636 (struct kstat *)NULL,
6637 (u32)0,
6638 (unsigned int)0);
6639 - ],[
6640 + ])
6641 +])
6642 +
6643 +AC_DEFUN([ZFS_AC_KERNEL_VFS_GETATTR_4ARGS], [
6644 + AC_MSG_CHECKING([whether vfs_getattr() wants 4 args])
6645 + ZFS_LINUX_TEST_RESULT([vfs_getattr_4args], [
6646 AC_MSG_RESULT(yes)
6647 AC_DEFINE(HAVE_4ARGS_VFS_GETATTR, 1,
6648 - [vfs_getattr wants 4 args])
6649 + [vfs_getattr wants 4 args])
6650 ],[
6651 AC_MSG_RESULT(no)
6652 ])
6653 @@ -24,17 +28,21 @@ dnl #
6654 dnl # 3.9 API
6655 dnl # vfs_getattr(struct path *p, struct kstat *s)
6656 dnl #
6657 -AC_DEFUN([ZFS_AC_KERNEL_2ARGS_VFS_GETATTR], [
6658 - AC_MSG_CHECKING([whether vfs_getattr() wants 2 args])
6659 - ZFS_LINUX_TRY_COMPILE([
6660 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_GETATTR_2ARGS], [
6661 + ZFS_LINUX_TEST_SRC([vfs_getattr_2args], [
6662 #include <linux/fs.h>
6663 ],[
6664 vfs_getattr((struct path *) NULL,
6665 (struct kstat *)NULL);
6666 - ],[
6667 + ])
6668 +])
6669 +
6670 +AC_DEFUN([ZFS_AC_KERNEL_VFS_GETATTR_2ARGS], [
6671 + AC_MSG_CHECKING([whether vfs_getattr() wants 2 args])
6672 + ZFS_LINUX_TEST_RESULT([vfs_getattr_2args], [
6673 AC_MSG_RESULT(yes)
6674 AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
6675 - [vfs_getattr wants 2 args])
6676 + [vfs_getattr wants 2 args])
6677 ],[
6678 AC_MSG_RESULT(no)
6679 ])
6680 @@ -44,19 +52,35 @@ dnl #
6681 dnl # <3.9 API
6682 dnl # vfs_getattr(struct vfsmount *v, struct dentry *d, struct kstat *k)
6683 dnl #
6684 -AC_DEFUN([ZFS_AC_KERNEL_3ARGS_VFS_GETATTR], [
6685 - AC_MSG_CHECKING([whether vfs_getattr() wants 3 args])
6686 - ZFS_LINUX_TRY_COMPILE([
6687 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_GETATTR_3ARGS], [
6688 + ZFS_LINUX_TEST_SRC([vfs_getattr_3args], [
6689 #include <linux/fs.h>
6690 ],[
6691 vfs_getattr((struct vfsmount *)NULL,
6692 (struct dentry *)NULL,
6693 (struct kstat *)NULL);
6694 - ],[
6695 + ])
6696 +])
6697 +
6698 +AC_DEFUN([ZFS_AC_KERNEL_VFS_GETATTR_3ARGS], [
6699 + AC_MSG_CHECKING([whether vfs_getattr() wants 3 args])
6700 + ZFS_LINUX_TEST_RESULT([vfs_getattr_3args], [
6701 AC_MSG_RESULT(yes)
6702 AC_DEFINE(HAVE_3ARGS_VFS_GETATTR, 1,
6703 - [vfs_getattr wants 3 args])
6704 + [vfs_getattr wants 3 args])
6705 ],[
6706 AC_MSG_RESULT(no)
6707 ])
6708 ])
6709 +
6710 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_GETATTR], [
6711 + ZFS_AC_KERNEL_SRC_VFS_GETATTR_4ARGS
6712 + ZFS_AC_KERNEL_SRC_VFS_GETATTR_2ARGS
6713 + ZFS_AC_KERNEL_SRC_VFS_GETATTR_3ARGS
6714 +])
6715 +
6716 +AC_DEFUN([ZFS_AC_KERNEL_VFS_GETATTR], [
6717 + ZFS_AC_KERNEL_VFS_GETATTR_4ARGS
6718 + ZFS_AC_KERNEL_VFS_GETATTR_2ARGS
6719 + ZFS_AC_KERNEL_VFS_GETATTR_3ARGS
6720 +])
6721 diff --git a/config/kernel-vfs-iterate.m4 b/config/kernel-vfs-iterate.m4
6722 index 5de901d44..172118eac 100644
6723 --- a/config/kernel-vfs-iterate.m4
6724 +++ b/config/kernel-vfs-iterate.m4
6725 @@ -1,9 +1,5 @@
6726 -AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
6727 - dnl #
6728 - dnl # 4.7 API change
6729 - dnl #
6730 - AC_MSG_CHECKING([whether fops->iterate_shared() is available])
6731 - ZFS_LINUX_TRY_COMPILE([
6732 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_ITERATE], [
6733 + ZFS_LINUX_TEST_SRC([file_operations_iterate_shared], [
6734 #include <linux/fs.h>
6735 int iterate(struct file *filp, struct dir_context * context)
6736 { return 0; }
6737 @@ -12,11 +8,44 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
6738 __attribute__ ((unused)) = {
6739 .iterate_shared = iterate,
6740 };
6741 - ],[
6742 - ],[
6743 + ],[])
6744 +
6745 + ZFS_LINUX_TEST_SRC([file_operations_iterate], [
6746 + #include <linux/fs.h>
6747 + int iterate(struct file *filp,
6748 + struct dir_context *context) { return 0; }
6749 +
6750 + static const struct file_operations fops
6751 + __attribute__ ((unused)) = {
6752 + .iterate = iterate,
6753 + };
6754 +
6755 + #if defined(FMODE_KABI_ITERATE)
6756 + #error "RHEL 7.5, FMODE_KABI_ITERATE interface"
6757 + #endif
6758 + ],[])
6759 +
6760 + ZFS_LINUX_TEST_SRC([file_operations_readdir], [
6761 + #include <linux/fs.h>
6762 + int readdir(struct file *filp, void *entry,
6763 + filldir_t func) { return 0; }
6764 +
6765 + static const struct file_operations fops
6766 + __attribute__ ((unused)) = {
6767 + .readdir = readdir,
6768 + };
6769 + ],[])
6770 +])
6771 +
6772 +AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
6773 + dnl #
6774 + dnl # 4.7 API change
6775 + dnl #
6776 + AC_MSG_CHECKING([whether fops->iterate_shared() is available])
6777 + ZFS_LINUX_TEST_RESULT([file_operations_iterate_shared], [
6778 AC_MSG_RESULT(yes)
6779 AC_DEFINE(HAVE_VFS_ITERATE_SHARED, 1,
6780 - [fops->iterate_shared() is available])
6781 + [fops->iterate_shared() is available])
6782 ],[
6783 AC_MSG_RESULT(no)
6784
6785 @@ -31,44 +60,23 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
6786 dnl # to using fops.readdir() to retain KABI compatibility.
6787 dnl #
6788 AC_MSG_CHECKING([whether fops->iterate() is available])
6789 - ZFS_LINUX_TRY_COMPILE([
6790 - #include <linux/fs.h>
6791 - int iterate(struct file *filp,
6792 - struct dir_context *context) { return 0; }
6793 -
6794 - static const struct file_operations fops
6795 - __attribute__ ((unused)) = {
6796 - .iterate = iterate,
6797 - };
6798 -
6799 - #if defined(FMODE_KABI_ITERATE)
6800 - #error "RHEL 7.5, FMODE_KABI_ITERATE interface"
6801 - #endif
6802 - ],[
6803 - ],[
6804 + ZFS_LINUX_TEST_RESULT([file_operations_iterate], [
6805 AC_MSG_RESULT(yes)
6806 AC_DEFINE(HAVE_VFS_ITERATE, 1,
6807 - [fops->iterate() is available])
6808 + [fops->iterate() is available])
6809 ],[
6810 AC_MSG_RESULT(no)
6811
6812 + dnl #
6813 + dnl # readdir interface introduced
6814 + dnl #
6815 AC_MSG_CHECKING([whether fops->readdir() is available])
6816 - ZFS_LINUX_TRY_COMPILE([
6817 - #include <linux/fs.h>
6818 - int readdir(struct file *filp, void *entry,
6819 - filldir_t func) { return 0; }
6820 -
6821 - static const struct file_operations fops
6822 - __attribute__ ((unused)) = {
6823 - .readdir = readdir,
6824 - };
6825 - ],[
6826 - ],[
6827 + ZFS_LINUX_TEST_RESULT([file_operations_readdir], [
6828 AC_MSG_RESULT(yes)
6829 AC_DEFINE(HAVE_VFS_READDIR, 1,
6830 - [fops->readdir() is available])
6831 + [fops->readdir() is available])
6832 ],[
6833 - AC_MSG_ERROR(no; file a bug report with ZoL)
6834 + ZFS_LINUX_TEST_ERROR([vfs_iterate])
6835 ])
6836 ])
6837 ])
6838 diff --git a/config/kernel-vfs-rw-iterate.m4 b/config/kernel-vfs-rw-iterate.m4
6839 index ace54f707..000353ec1 100644
6840 --- a/config/kernel-vfs-rw-iterate.m4
6841 +++ b/config/kernel-vfs-rw-iterate.m4
6842 @@ -1,9 +1,8 @@
6843 dnl #
6844 dnl # Linux 3.16 API
6845 dnl #
6846 -AC_DEFUN([ZFS_AC_KERNEL_VFS_RW_ITERATE],
6847 - [AC_MSG_CHECKING([whether fops->read/write_iter() are available])
6848 - ZFS_LINUX_TRY_COMPILE([
6849 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE], [
6850 + ZFS_LINUX_TEST_SRC([file_operations_rw], [
6851 #include <linux/fs.h>
6852
6853 ssize_t test_read(struct kiocb *kiocb, struct iov_iter *to)
6854 @@ -16,39 +15,41 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_RW_ITERATE],
6855 .read_iter = test_read,
6856 .write_iter = test_write,
6857 };
6858 - ],[
6859 - ],[
6860 - AC_MSG_RESULT(yes)
6861 - AC_DEFINE(HAVE_VFS_RW_ITERATE, 1,
6862 - [fops->read/write_iter() are available])
6863 + ],[])
6864
6865 - ZFS_AC_KERNEL_NEW_SYNC_READ
6866 + ZFS_LINUX_TEST_SRC([new_sync_rw], [
6867 + #include <linux/fs.h>
6868 ],[
6869 - AC_MSG_RESULT(no)
6870 + ssize_t ret __attribute__ ((unused));
6871 + struct file *filp = NULL;
6872 + char __user *rbuf = NULL;
6873 + const char __user *wbuf = NULL;
6874 + size_t len = 0;
6875 + loff_t ppos;
6876 +
6877 + ret = new_sync_read(filp, rbuf, len, &ppos);
6878 + ret = new_sync_write(filp, wbuf, len, &ppos);
6879 ])
6880 ])
6881
6882 -dnl #
6883 -dnl # Linux 4.1 API
6884 -dnl #
6885 -AC_DEFUN([ZFS_AC_KERNEL_NEW_SYNC_READ],
6886 - [AC_MSG_CHECKING([whether new_sync_read/write() are available])
6887 - ZFS_LINUX_TRY_COMPILE([
6888 - #include <linux/fs.h>
6889 - ],[
6890 - ssize_t ret __attribute__ ((unused));
6891 - struct file *filp = NULL;
6892 - char __user *rbuf = NULL;
6893 - const char __user *wbuf = NULL;
6894 - size_t len = 0;
6895 - loff_t ppos;
6896 -
6897 - ret = new_sync_read(filp, rbuf, len, &ppos);
6898 - ret = new_sync_write(filp, wbuf, len, &ppos);
6899 - ],[
6900 +AC_DEFUN([ZFS_AC_KERNEL_VFS_RW_ITERATE], [
6901 + AC_MSG_CHECKING([whether fops->read/write_iter() are available])
6902 + ZFS_LINUX_TEST_RESULT([file_operations_rw], [
6903 AC_MSG_RESULT(yes)
6904 - AC_DEFINE(HAVE_NEW_SYNC_READ, 1,
6905 - [new_sync_read()/new_sync_write() are available])
6906 + AC_DEFINE(HAVE_VFS_RW_ITERATE, 1,
6907 + [fops->read/write_iter() are available])
6908 +
6909 + dnl #
6910 + dnl # Linux 4.1 API
6911 + dnl #
6912 + AC_MSG_CHECKING([whether new_sync_read/write() are available])
6913 + ZFS_LINUX_TEST_RESULT([new_sync_rw], [
6914 + AC_MSG_RESULT(yes)
6915 + AC_DEFINE(HAVE_NEW_SYNC_READ, 1,
6916 + [new_sync_read()/new_sync_write() are available])
6917 + ],[
6918 + AC_MSG_RESULT(no)
6919 + ])
6920 ],[
6921 AC_MSG_RESULT(no)
6922 ])
6923 @@ -57,19 +58,22 @@ AC_DEFUN([ZFS_AC_KERNEL_NEW_SYNC_READ],
6924 dnl #
6925 dnl # Linux 4.1.x API
6926 dnl #
6927 -AC_DEFUN([ZFS_AC_KERNEL_GENERIC_WRITE_CHECKS],
6928 - [AC_MSG_CHECKING([whether generic_write_checks() takes kiocb])
6929 - ZFS_LINUX_TRY_COMPILE([
6930 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_GENERIC_WRITE_CHECKS], [
6931 + ZFS_LINUX_TEST_SRC([generic_write_checks], [
6932 #include <linux/fs.h>
6933 -
6934 ],[
6935 struct kiocb *iocb = NULL;
6936 struct iov_iter *iov = NULL;
6937 generic_write_checks(iocb, iov);
6938 - ],[
6939 + ])
6940 +])
6941 +
6942 +AC_DEFUN([ZFS_AC_KERNEL_VFS_GENERIC_WRITE_CHECKS], [
6943 + AC_MSG_CHECKING([whether generic_write_checks() takes kiocb])
6944 + ZFS_LINUX_TEST_RESULT([generic_write_checks], [
6945 AC_MSG_RESULT(yes)
6946 AC_DEFINE(HAVE_GENERIC_WRITE_CHECKS_KIOCB, 1,
6947 - [generic_write_checks() takes kiocb])
6948 + [generic_write_checks() takes kiocb])
6949 ],[
6950 AC_MSG_RESULT(no)
6951 ])
6952 diff --git a/config/kernel-wait.m4 b/config/kernel-wait.m4
6953 index d6442c1df..0414242bf 100644
6954 --- a/config/kernel-wait.m4
6955 +++ b/config/kernel-wait.m4
6956 @@ -1,3 +1,26 @@
6957 +dnl #
6958 +dnl # 4.13 API change
6959 +dnl # Renamed struct wait_queue -> struct wait_queue_entry.
6960 +dnl #
6961 +dnl # N.B. The type check is performed before all other checks
6962 +dnl # since ZFS_AC_KERNEL_SRC_WAIT_QUEUE_HEAD_ENTRY depends on
6963 +dnl # HAVE_WAIT_QUEUE_ENTRY_T being set in confdefs.h.
6964 +dnl #
6965 +AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T], [
6966 + AC_MSG_CHECKING([whether wait_queue_entry_t exists])
6967 + ZFS_LINUX_TRY_COMPILE([
6968 + #include <linux/wait.h>
6969 + ],[
6970 + wait_queue_entry_t *entry __attribute__ ((unused));
6971 + ],[
6972 + AC_MSG_RESULT(yes)
6973 + AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY_T, 1,
6974 + [wait_queue_entry_t exists])
6975 + ],[
6976 + AC_MSG_RESULT(no)
6977 + ])
6978 +])
6979 +
6980 dnl #
6981 dnl # 3.17 API change,
6982 dnl # wait_on_bit() no longer requires an action argument. The former
6983 @@ -8,34 +31,20 @@ dnl # of just two functions: one which uses io_schedule() and one which just
6984 dnl # uses schedule(). This API change was made to consolidate all of those
6985 dnl # redundant wait functions.
6986 dnl #
6987 -AC_DEFUN([ZFS_AC_KERNEL_WAIT_ON_BIT], [
6988 - AC_MSG_CHECKING([whether wait_on_bit() takes an action])
6989 - ZFS_LINUX_TRY_COMPILE([
6990 +AC_DEFUN([ZFS_AC_KERNEL_SRC_WAIT_ON_BIT], [
6991 + ZFS_LINUX_TEST_SRC([wait_on_bit], [
6992 #include <linux/wait.h>
6993 ],[
6994 int (*action)(void *) = NULL;
6995 wait_on_bit(NULL, 0, action, 0);
6996 - ],[
6997 - AC_MSG_RESULT(yes)
6998 - AC_DEFINE(HAVE_WAIT_ON_BIT_ACTION, 1, [yes])
6999 - ],[
7000 - AC_MSG_RESULT(no)
7001 ])
7002 ])
7003 -dnl #
7004 -dnl # 4.13 API change
7005 -dnl # Renamed struct wait_queue -> struct wait_queue_entry.
7006 -dnl #
7007 -AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T], [
7008 - AC_MSG_CHECKING([whether wait_queue_entry_t exists])
7009 - ZFS_LINUX_TRY_COMPILE([
7010 - #include <linux/wait.h>
7011 - ],[
7012 - wait_queue_entry_t *entry __attribute__ ((unused));
7013 - ],[
7014 +
7015 +AC_DEFUN([ZFS_AC_KERNEL_WAIT_ON_BIT], [
7016 + AC_MSG_CHECKING([whether wait_on_bit() takes an action])
7017 + ZFS_LINUX_TEST_RESULT([wait_on_bit], [
7018 AC_MSG_RESULT(yes)
7019 - AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY_T, 1,
7020 - [wait_queue_entry_t exists])
7021 + AC_DEFINE(HAVE_WAIT_ON_BIT_ACTION, 1, [yes])
7022 ],[
7023 AC_MSG_RESULT(no)
7024 ])
7025 @@ -46,9 +55,8 @@ dnl # 4.13 API change
7026 dnl # Renamed wait_queue_head::task_list -> wait_queue_head::head
7027 dnl # Renamed wait_queue_entry::task_list -> wait_queue_entry::entry
7028 dnl #
7029 -AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY], [
7030 - AC_MSG_CHECKING([whether wq_head->head and wq_entry->entry exist])
7031 - ZFS_LINUX_TRY_COMPILE([
7032 +AC_DEFUN([ZFS_AC_KERNEL_SRC_WAIT_QUEUE_HEAD_ENTRY], [
7033 + ZFS_LINUX_TEST_SRC([wait_queue_head_entry], [
7034 #include <linux/wait.h>
7035
7036 #ifdef HAVE_WAIT_QUEUE_ENTRY_T
7037 @@ -66,7 +74,12 @@ AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY], [
7038
7039 head = &wq_head.head;
7040 entry = &wq_entry.entry;
7041 - ],[
7042 + ])
7043 +])
7044 +
7045 +AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY], [
7046 + AC_MSG_CHECKING([whether wq_head->head and wq_entry->entry exist])
7047 + ZFS_LINUX_TEST_RESULT([wait_queue_head_entry], [
7048 AC_MSG_RESULT(yes)
7049 AC_DEFINE(HAVE_WAIT_QUEUE_HEAD_ENTRY, 1,
7050 [wq_head->head and wq_entry->entry exist])
7051 @@ -74,3 +87,13 @@ AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY], [
7052 AC_MSG_RESULT(no)
7053 ])
7054 ])
7055 +
7056 +AC_DEFUN([ZFS_AC_KERNEL_SRC_WAIT], [
7057 + ZFS_AC_KERNEL_SRC_WAIT_ON_BIT
7058 + ZFS_AC_KERNEL_SRC_WAIT_QUEUE_HEAD_ENTRY
7059 +])
7060 +
7061 +AC_DEFUN([ZFS_AC_KERNEL_WAIT], [
7062 + ZFS_AC_KERNEL_WAIT_ON_BIT
7063 + ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY
7064 +])
7065 diff --git a/config/kernel-xattr-handler.m4 b/config/kernel-xattr-handler.m4
7066 index 0b61b85b1..ed84c6390 100644
7067 --- a/config/kernel-xattr-handler.m4
7068 +++ b/config/kernel-xattr-handler.m4
7069 @@ -3,9 +3,8 @@ dnl # 2.6.35 API change,
7070 dnl # The 'struct xattr_handler' was constified in the generic
7071 dnl # super_block structure.
7072 dnl #
7073 -AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [
7074 - AC_MSG_CHECKING([whether super_block uses const struct xattr_handler])
7075 - ZFS_LINUX_TRY_COMPILE([
7076 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER], [
7077 + ZFS_LINUX_TEST_SRC([const_xattr_handler], [
7078 #include <linux/fs.h>
7079 #include <linux/xattr.h>
7080
7081 @@ -22,11 +21,15 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [
7082 const struct super_block sb __attribute__ ((unused)) = {
7083 .s_xattr = xattr_handlers,
7084 };
7085 - ],[
7086 - ],[
7087 + ],[])
7088 +])
7089 +
7090 +AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [
7091 + AC_MSG_CHECKING([whether super_block uses const struct xattr_handler])
7092 + ZFS_LINUX_TEST_RESULT([const_xattr_handler], [
7093 AC_MSG_RESULT([yes])
7094 AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1,
7095 - [super_block uses const struct xattr_handler])
7096 + [super_block uses const struct xattr_handler])
7097 ],[
7098 AC_MSG_RESULT([no])
7099 ])
7100 @@ -38,17 +41,20 @@ dnl # struct xattr_handler added new member "name".
7101 dnl # xattr_handler which matches to whole name rather than prefix should use
7102 dnl # "name" instead of "prefix", e.g. "system.posix_acl_access"
7103 dnl #
7104 -AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_NAME], [
7105 - AC_MSG_CHECKING([whether xattr_handler has name])
7106 - ZFS_LINUX_TRY_COMPILE([
7107 +AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME], [
7108 + ZFS_LINUX_TEST_SRC([xattr_handler_name], [
7109 #include <linux/xattr.h>
7110
7111 static const struct xattr_handler
7112 xops __attribute__ ((unused)) = {
7113 .name = XATTR_NAME_POSIX_ACL_ACCESS,
7114 };
7115 - ],[
7116 - ],[
7117 + ],[])
7118 +])
7119 +
7120 +AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_NAME], [
7121 + AC_MSG_CHECKING([whether xattr_handler has name])
7122 + ZFS_LINUX_TEST_RESULT([xattr_handler_name], [
7123 AC_MSG_RESULT(yes)
7124 AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1,
7125 [xattr_handler has name])
7126 @@ -58,52 +64,65 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_NAME], [
7127 ])
7128
7129 dnl #
7130 -dnl # 4.9 API change,
7131 -dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are
7132 -dnl # removed. xattr operations will directly go through sb->s_xattr.
7133 +dnl # Supported xattr handler get() interfaces checked newest to oldest.
7134 dnl #
7135 -AC_DEFUN([ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR], [
7136 - AC_MSG_CHECKING([whether generic_setxattr() exists])
7137 - ZFS_LINUX_TRY_COMPILE([
7138 - #include <linux/fs.h>
7139 +AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [
7140 + ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode], [
7141 #include <linux/xattr.h>
7142
7143 - static const struct inode_operations
7144 - iops __attribute__ ((unused)) = {
7145 - .setxattr = generic_setxattr
7146 + int get(const struct xattr_handler *handler,
7147 + struct dentry *dentry, struct inode *inode,
7148 + const char *name, void *buffer, size_t size) { return 0; }
7149 + static const struct xattr_handler
7150 + xops __attribute__ ((unused)) = {
7151 + .get = get,
7152 };
7153 - ],[
7154 - ],[
7155 - AC_MSG_RESULT(yes)
7156 - AC_DEFINE(HAVE_GENERIC_SETXATTR, 1,
7157 - [generic_setxattr() exists])
7158 - ],[
7159 - AC_MSG_RESULT(no)
7160 - ])
7161 -])
7162 + ],[])
7163
7164 -dnl #
7165 -dnl # Supported xattr handler get() interfaces checked newest to oldest.
7166 -dnl #
7167 -AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
7168 - dnl #
7169 - dnl # 4.7 API change,
7170 - dnl # The xattr_handler->get() callback was changed to take both
7171 - dnl # dentry and inode.
7172 - dnl #
7173 - AC_MSG_CHECKING([whether xattr_handler->get() wants both dentry and inode])
7174 - ZFS_LINUX_TRY_COMPILE([
7175 + ZFS_LINUX_TEST_SRC([xattr_handler_get_xattr_handler], [
7176 #include <linux/xattr.h>
7177
7178 int get(const struct xattr_handler *handler,
7179 - struct dentry *dentry, struct inode *inode,
7180 - const char *name, void *buffer, size_t size) { return 0; }
7181 + struct dentry *dentry, const char *name,
7182 + void *buffer, size_t size) { return 0; }
7183 static const struct xattr_handler
7184 xops __attribute__ ((unused)) = {
7185 .get = get,
7186 };
7187 - ],[
7188 - ],[
7189 + ],[])
7190 +
7191 + ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry], [
7192 + #include <linux/xattr.h>
7193 +
7194 + int get(struct dentry *dentry, const char *name,
7195 + void *buffer, size_t size, int handler_flags)
7196 + { return 0; }
7197 + static const struct xattr_handler
7198 + xops __attribute__ ((unused)) = {
7199 + .get = get,
7200 + };
7201 + ],[])
7202 +
7203 + ZFS_LINUX_TEST_SRC([xattr_handler_get_inode], [
7204 + #include <linux/xattr.h>
7205 +
7206 + int get(struct inode *ip, const char *name,
7207 + void *buffer, size_t size) { return 0; }
7208 + static const struct xattr_handler
7209 + xops __attribute__ ((unused)) = {
7210 + .get = get,
7211 + };
7212 + ],[])
7213 +])
7214 +
7215 +AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
7216 + dnl #
7217 + dnl # 4.7 API change,
7218 + dnl # The xattr_handler->get() callback was changed to take both
7219 + dnl # dentry and inode.
7220 + dnl #
7221 + AC_MSG_CHECKING([whether xattr_handler->get() wants dentry and inode])
7222 + ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode], [
7223 AC_MSG_RESULT(yes)
7224 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1,
7225 [xattr_handler->get() wants both dentry and inode])
7226 @@ -115,69 +134,40 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
7227 dnl # should be accessed by handler->flags.
7228 dnl #
7229 AC_MSG_RESULT(no)
7230 - AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
7231 - ZFS_LINUX_TRY_COMPILE([
7232 - #include <linux/xattr.h>
7233 -
7234 - int get(const struct xattr_handler *handler,
7235 - struct dentry *dentry, const char *name,
7236 - void *buffer, size_t size) { return 0; }
7237 - static const struct xattr_handler
7238 - xops __attribute__ ((unused)) = {
7239 - .get = get,
7240 - };
7241 - ],[
7242 - ],[
7243 + AC_MSG_CHECKING(
7244 + [whether xattr_handler->get() wants xattr_handler])
7245 + ZFS_LINUX_TEST_RESULT([xattr_handler_get_xattr_handler], [
7246 AC_MSG_RESULT(yes)
7247 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
7248 [xattr_handler->get() wants xattr_handler])
7249 ],[
7250 dnl #
7251 dnl # 2.6.33 API change,
7252 - dnl # The xattr_handler->get() callback was changed to take
7253 - dnl # a dentry instead of an inode, and a handler_flags
7254 - dnl # argument was added.
7255 + dnl # The xattr_handler->get() callback was changed
7256 + dnl # to take a dentry instead of an inode, and a
7257 + dnl # handler_flags argument was added.
7258 dnl #
7259 AC_MSG_RESULT(no)
7260 - AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
7261 - ZFS_LINUX_TRY_COMPILE([
7262 - #include <linux/xattr.h>
7263 -
7264 - int get(struct dentry *dentry, const char *name,
7265 - void *buffer, size_t size, int handler_flags)
7266 - { return 0; }
7267 - static const struct xattr_handler
7268 - xops __attribute__ ((unused)) = {
7269 - .get = get,
7270 - };
7271 - ],[
7272 - ],[
7273 + AC_MSG_CHECKING(
7274 + [whether xattr_handler->get() wants dentry])
7275 + ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry], [
7276 AC_MSG_RESULT(yes)
7277 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
7278 [xattr_handler->get() wants dentry])
7279 ],[
7280 dnl #
7281 - dnl # 2.6.32 API
7282 + dnl # Legacy 2.6.32 API
7283 dnl #
7284 AC_MSG_RESULT(no)
7285 AC_MSG_CHECKING(
7286 [whether xattr_handler->get() wants inode])
7287 - ZFS_LINUX_TRY_COMPILE([
7288 - #include <linux/xattr.h>
7289 -
7290 - int get(struct inode *ip, const char *name,
7291 - void *buffer, size_t size) { return 0; }
7292 - static const struct xattr_handler
7293 - xops __attribute__ ((unused)) = {
7294 - .get = get,
7295 - };
7296 - ],[
7297 - ],[
7298 + ZFS_LINUX_TEST_RESULT(
7299 + [xattr_handler_get_inode], [
7300 AC_MSG_RESULT(yes)
7301 AC_DEFINE(HAVE_XATTR_GET_INODE, 1,
7302 [xattr_handler->get() wants inode])
7303 ],[
7304 - AC_MSG_ERROR([no; please file a bug report])
7305 + ZFS_LINUX_TEST_ERROR([xattr get()])
7306 ])
7307 ])
7308 ])
7309 @@ -187,14 +177,8 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
7310 dnl #
7311 dnl # Supported xattr handler set() interfaces checked newest to oldest.
7312 dnl #
7313 -AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
7314 - dnl #
7315 - dnl # 4.7 API change,
7316 - dnl # The xattr_handler->set() callback was changed to take both
7317 - dnl # dentry and inode.
7318 - dnl #
7319 - AC_MSG_CHECKING([whether xattr_handler->set() wants both dentry and inode])
7320 - ZFS_LINUX_TRY_COMPILE([
7321 +AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
7322 + ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [
7323 #include <linux/xattr.h>
7324
7325 int set(const struct xattr_handler *handler,
7326 @@ -206,8 +190,54 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
7327 xops __attribute__ ((unused)) = {
7328 .set = set,
7329 };
7330 - ],[
7331 - ],[
7332 + ],[])
7333 +
7334 + ZFS_LINUX_TEST_SRC([xattr_handler_set_xattr_handler], [
7335 + #include <linux/xattr.h>
7336 +
7337 + int set(const struct xattr_handler *handler,
7338 + struct dentry *dentry, const char *name,
7339 + const void *buffer, size_t size, int flags)
7340 + { return 0; }
7341 + static const struct xattr_handler
7342 + xops __attribute__ ((unused)) = {
7343 + .set = set,
7344 + };
7345 + ],[])
7346 +
7347 + ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry], [
7348 + #include <linux/xattr.h>
7349 +
7350 + int set(struct dentry *dentry, const char *name,
7351 + const void *buffer, size_t size, int flags,
7352 + int handler_flags) { return 0; }
7353 + static const struct xattr_handler
7354 + xops __attribute__ ((unused)) = {
7355 + .set = set,
7356 + };
7357 + ],[])
7358 +
7359 + ZFS_LINUX_TEST_SRC([xattr_handler_set_inode], [
7360 + #include <linux/xattr.h>
7361 +
7362 + int set(struct inode *ip, const char *name,
7363 + const void *buffer, size_t size, int flags)
7364 + { return 0; }
7365 + static const struct xattr_handler
7366 + xops __attribute__ ((unused)) = {
7367 + .set = set,
7368 + };
7369 + ],[])
7370 +])
7371 +
7372 +AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
7373 + dnl #
7374 + dnl # 4.7 API change,
7375 + dnl # The xattr_handler->set() callback was changed to take both
7376 + dnl # dentry and inode.
7377 + dnl #
7378 + AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode])
7379 + ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [
7380 AC_MSG_RESULT(yes)
7381 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
7382 [xattr_handler->set() wants both dentry and inode])
7383 @@ -219,71 +249,40 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
7384 dnl # should be accessed by handler->flags.
7385 dnl #
7386 AC_MSG_RESULT(no)
7387 - AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
7388 - ZFS_LINUX_TRY_COMPILE([
7389 - #include <linux/xattr.h>
7390 -
7391 - int set(const struct xattr_handler *handler,
7392 - struct dentry *dentry, const char *name,
7393 - const void *buffer, size_t size, int flags)
7394 - { return 0; }
7395 - static const struct xattr_handler
7396 - xops __attribute__ ((unused)) = {
7397 - .set = set,
7398 - };
7399 - ],[
7400 - ],[
7401 + AC_MSG_CHECKING(
7402 + [whether xattr_handler->set() wants xattr_handler])
7403 + ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [
7404 AC_MSG_RESULT(yes)
7405 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
7406 [xattr_handler->set() wants xattr_handler])
7407 ],[
7408 dnl #
7409 dnl # 2.6.33 API change,
7410 - dnl # The xattr_handler->set() callback was changed to take a
7411 - dnl # dentry instead of an inode, and a handler_flags
7412 - dnl # argument was added.
7413 + dnl # The xattr_handler->set() callback was changed
7414 + dnl # to take a dentry instead of an inode, and a
7415 + dnl # handler_flags argument was added.
7416 dnl #
7417 AC_MSG_RESULT(no)
7418 - AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
7419 - ZFS_LINUX_TRY_COMPILE([
7420 - #include <linux/xattr.h>
7421 -
7422 - int set(struct dentry *dentry, const char *name,
7423 - const void *buffer, size_t size, int flags,
7424 - int handler_flags) { return 0; }
7425 - static const struct xattr_handler
7426 - xops __attribute__ ((unused)) = {
7427 - .set = set,
7428 - };
7429 - ],[
7430 - ],[
7431 + AC_MSG_CHECKING(
7432 + [whether xattr_handler->set() wants dentry])
7433 + ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [
7434 AC_MSG_RESULT(yes)
7435 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
7436 [xattr_handler->set() wants dentry])
7437 ],[
7438 dnl #
7439 - dnl # 2.6.32 API
7440 + dnl # Legacy 2.6.32 API
7441 dnl #
7442 AC_MSG_RESULT(no)
7443 AC_MSG_CHECKING(
7444 [whether xattr_handler->set() wants inode])
7445 - ZFS_LINUX_TRY_COMPILE([
7446 - #include <linux/xattr.h>
7447 -
7448 - int set(struct inode *ip, const char *name,
7449 - const void *buffer, size_t size, int flags)
7450 - { return 0; }
7451 - static const struct xattr_handler
7452 - xops __attribute__ ((unused)) = {
7453 - .set = set,
7454 - };
7455 - ],[
7456 - ],[
7457 + ZFS_LINUX_TEST_RESULT(
7458 + [xattr_handler_set_inode], [
7459 AC_MSG_RESULT(yes)
7460 AC_DEFINE(HAVE_XATTR_SET_INODE, 1,
7461 [xattr_handler->set() wants inode])
7462 ],[
7463 - AC_MSG_ERROR([no; please file a bug report])
7464 + ZFS_LINUX_TEST_ERROR([xattr set()])
7465 ])
7466 ])
7467 ])
7468 @@ -293,12 +292,8 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
7469 dnl #
7470 dnl # Supported xattr handler list() interfaces checked newest to oldest.
7471 dnl #
7472 -AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
7473 - dnl # 4.5 API change,
7474 - dnl # The xattr_handler->list() callback was changed to take only a
7475 - dnl # dentry and it only needs to return if it's accessible.
7476 - AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
7477 - ZFS_LINUX_TRY_COMPILE([
7478 +AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [
7479 + ZFS_LINUX_TEST_SRC([xattr_handler_list_simple], [
7480 #include <linux/xattr.h>
7481
7482 bool list(struct dentry *dentry) { return 0; }
7483 @@ -306,8 +301,52 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
7484 xops __attribute__ ((unused)) = {
7485 .list = list,
7486 };
7487 - ],[
7488 - ],[
7489 + ],[])
7490 +
7491 + ZFS_LINUX_TEST_SRC([xattr_handler_list_xattr_handler], [
7492 + #include <linux/xattr.h>
7493 +
7494 + size_t list(const struct xattr_handler *handler,
7495 + struct dentry *dentry, char *list, size_t list_size,
7496 + const char *name, size_t name_len) { return 0; }
7497 + static const struct xattr_handler
7498 + xops __attribute__ ((unused)) = {
7499 + .list = list,
7500 + };
7501 + ],[])
7502 +
7503 + ZFS_LINUX_TEST_SRC([xattr_handler_list_dentry], [
7504 + #include <linux/xattr.h>
7505 +
7506 + size_t list(struct dentry *dentry,
7507 + char *list, size_t list_size,
7508 + const char *name, size_t name_len,
7509 + int handler_flags) { return 0; }
7510 + static const struct xattr_handler
7511 + xops __attribute__ ((unused)) = {
7512 + .list = list,
7513 + };
7514 + ],[])
7515 +
7516 + ZFS_LINUX_TEST_SRC([xattr_handler_list_inode], [
7517 + #include <linux/xattr.h>
7518 +
7519 + size_t list(struct inode *ip, char *lst,
7520 + size_t list_size, const char *name,
7521 + size_t name_len) { return 0; }
7522 + static const struct xattr_handler
7523 + xops __attribute__ ((unused)) = {
7524 + .list = list,
7525 + };
7526 + ],[])
7527 +])
7528 +
7529 +AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
7530 + dnl # 4.5 API change,
7531 + dnl # The xattr_handler->list() callback was changed to take only a
7532 + dnl # dentry and it only needs to return if it's accessible.
7533 + AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
7534 + ZFS_LINUX_TEST_RESULT([xattr_handler_list_simple], [
7535 AC_MSG_RESULT(yes)
7536 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
7537 [xattr_handler->list() wants simple])
7538 @@ -321,18 +360,7 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
7539 AC_MSG_RESULT(no)
7540 AC_MSG_CHECKING(
7541 [whether xattr_handler->list() wants xattr_handler])
7542 - ZFS_LINUX_TRY_COMPILE([
7543 - #include <linux/xattr.h>
7544 -
7545 - size_t list(const struct xattr_handler *handler,
7546 - struct dentry *dentry, char *list, size_t list_size,
7547 - const char *name, size_t name_len) { return 0; }
7548 - static const struct xattr_handler
7549 - xops __attribute__ ((unused)) = {
7550 - .list = list,
7551 - };
7552 - ],[
7553 - ],[
7554 + ZFS_LINUX_TEST_RESULT([xattr_handler_list_xattr_handler], [
7555 AC_MSG_RESULT(yes)
7556 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
7557 [xattr_handler->list() wants xattr_handler])
7558 @@ -346,47 +374,24 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
7559 AC_MSG_RESULT(no)
7560 AC_MSG_CHECKING(
7561 [whether xattr_handler->list() wants dentry])
7562 - ZFS_LINUX_TRY_COMPILE([
7563 - #include <linux/xattr.h>
7564 -
7565 - size_t list(struct dentry *dentry,
7566 - char *list, size_t list_size,
7567 - const char *name, size_t name_len,
7568 - int handler_flags) { return 0; }
7569 - static const struct xattr_handler
7570 - xops __attribute__ ((unused)) = {
7571 - .list = list,
7572 - };
7573 - ],[
7574 - ],[
7575 + ZFS_LINUX_TEST_RESULT([xattr_handler_list_dentry], [
7576 AC_MSG_RESULT(yes)
7577 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
7578 [xattr_handler->list() wants dentry])
7579 ],[
7580 dnl #
7581 - dnl # 2.6.32 API
7582 + dnl # Legacy 2.6.32 API
7583 dnl #
7584 AC_MSG_RESULT(no)
7585 AC_MSG_CHECKING(
7586 [whether xattr_handler->list() wants inode])
7587 - ZFS_LINUX_TRY_COMPILE([
7588 - #include <linux/xattr.h>
7589 -
7590 - size_t list(struct inode *ip, char *lst,
7591 - size_t list_size, const char *name,
7592 - size_t name_len) { return 0; }
7593 - static const struct xattr_handler
7594 - xops __attribute__ ((unused)) = {
7595 - .list = list,
7596 - };
7597 - ],[
7598 - ],[
7599 + ZFS_LINUX_TEST_RESULT(
7600 + [xattr_handler_list_inode], [
7601 AC_MSG_RESULT(yes)
7602 AC_DEFINE(HAVE_XATTR_LIST_INODE, 1,
7603 [xattr_handler->list() wants inode])
7604 ],[
7605 - AC_MSG_ERROR(
7606 - [no; please file a bug report])
7607 + ZFS_LINUX_TEST_ERROR([xattr list()])
7608 ])
7609 ])
7610 ])
7611 @@ -398,15 +403,19 @@ dnl # 3.7 API change,
7612 dnl # The posix_acl_{from,to}_xattr functions gained a new
7613 dnl # parameter: user_ns
7614 dnl #
7615 -AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
7616 - AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
7617 - ZFS_LINUX_TRY_COMPILE([
7618 +AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS], [
7619 + ZFS_LINUX_TEST_SRC([posix_acl_from_xattr_userns], [
7620 #include <linux/cred.h>
7621 #include <linux/fs.h>
7622 #include <linux/posix_acl_xattr.h>
7623 ],[
7624 posix_acl_from_xattr(&init_user_ns, NULL, 0);
7625 - ],[
7626 + ])
7627 +])
7628 +
7629 +AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
7630 + AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
7631 + ZFS_LINUX_TEST_RESULT([posix_acl_from_xattr_userns], [
7632 AC_MSG_RESULT(yes)
7633 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
7634 [posix_acl_from_xattr() needs user_ns])
7635 @@ -415,3 +424,50 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
7636 ])
7637 ])
7638
7639 +dnl #
7640 +dnl # 4.9 API change,
7641 +dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are
7642 +dnl # removed. xattr operations will directly go through sb->s_xattr.
7643 +dnl #
7644 +AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR], [
7645 + ZFS_LINUX_TEST_SRC([have_generic_setxattr], [
7646 + #include <linux/fs.h>
7647 + #include <linux/xattr.h>
7648 +
7649 + static const struct inode_operations
7650 + iops __attribute__ ((unused)) = {
7651 + .setxattr = generic_setxattr
7652 + };
7653 + ],[])
7654 +])
7655 +
7656 +AC_DEFUN([ZFS_AC_KERNEL_GENERIC_SETXATTR], [
7657 + AC_MSG_CHECKING([whether generic_setxattr() exists])
7658 + ZFS_LINUX_TEST_RESULT([have_generic_setxattr], [
7659 + AC_MSG_RESULT(yes)
7660 + AC_DEFINE(HAVE_GENERIC_SETXATTR, 1,
7661 + [generic_setxattr() exists])
7662 + ],[
7663 + AC_MSG_RESULT(no)
7664 + ])
7665 +])
7666 +
7667 +AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR], [
7668 + ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER
7669 + ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME
7670 + ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET
7671 + ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET
7672 + ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST
7673 + ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS
7674 + ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR
7675 +])
7676 +
7677 +AC_DEFUN([ZFS_AC_KERNEL_XATTR], [
7678 + ZFS_AC_KERNEL_CONST_XATTR_HANDLER
7679 + ZFS_AC_KERNEL_XATTR_HANDLER_NAME
7680 + ZFS_AC_KERNEL_XATTR_HANDLER_GET
7681 + ZFS_AC_KERNEL_XATTR_HANDLER_SET
7682 + ZFS_AC_KERNEL_XATTR_HANDLER_LIST
7683 + ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS
7684 + ZFS_AC_KERNEL_GENERIC_SETXATTR
7685 +])
7686 diff --git a/config/kernel-zlib.m4 b/config/kernel-zlib.m4
7687 index 3ca7cf682..d554d1168 100644
7688 --- a/config/kernel-zlib.m4
7689 +++ b/config/kernel-zlib.m4
7690 @@ -1,62 +1,25 @@
7691 -dnl #
7692 -dnl # zlib inflate compat,
7693 -dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
7694 -dnl #
7695 -AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE], [
7696 - AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
7697 - ZFS_LINUX_TRY_COMPILE([
7698 - #if !defined(CONFIG_ZLIB_INFLATE) && \
7699 - !defined(CONFIG_ZLIB_INFLATE_MODULE)
7700 - #error CONFIG_ZLIB_INFLATE not defined
7701 - #endif
7702 - ],[ ],[
7703 - AC_MSG_RESULT([yes])
7704 - ],[
7705 - AC_MSG_RESULT([no])
7706 - AC_MSG_ERROR([
7707 - *** This kernel does not include the required zlib inflate support.
7708 - *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
7709 - ])
7710 -])
7711 -
7712 -dnl #
7713 -dnl # zlib deflate compat,
7714 -dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
7715 -dnl #
7716 -AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE], [
7717 - AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
7718 - ZFS_LINUX_TRY_COMPILE([
7719 - #if !defined(CONFIG_ZLIB_DEFLATE) && \
7720 - !defined(CONFIG_ZLIB_DEFLATE_MODULE)
7721 - #error CONFIG_ZLIB_DEFLATE not defined
7722 - #endif
7723 - ],[ ],[
7724 - AC_MSG_RESULT([yes])
7725 - ],[
7726 - AC_MSG_RESULT([no])
7727 - AC_MSG_ERROR([
7728 - *** This kernel does not include the required zlib deflate support.
7729 - *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
7730 - ])
7731 -])
7732 -
7733 dnl #
7734 dnl # 2.6.39 API compat,
7735 +dnl
7736 dnl # The function zlib_deflate_workspacesize() now take 2 arguments.
7737 dnl # This was done to avoid always having to allocate the maximum size
7738 dnl # workspace (268K). The caller can now specific the windowBits and
7739 dnl # memLevel compression parameters to get a smaller workspace.
7740 dnl #
7741 -AC_DEFUN([ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE],
7742 - [AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args])
7743 - ZFS_LINUX_TRY_COMPILE([
7744 +AC_DEFUN([ZFS_AC_KERNEL_SRC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE], [
7745 + ZFS_LINUX_TEST_SRC([2args_zlib_deflate_workspacesize], [
7746 #include <linux/zlib.h>
7747 ],[
7748 return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL);
7749 - ],[
7750 + ])
7751 +])
7752 +
7753 +AC_DEFUN([ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE], [
7754 + AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args])
7755 + ZFS_LINUX_TEST_RESULT([2args_zlib_deflate_workspacesize], [
7756 AC_MSG_RESULT(yes)
7757 AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1,
7758 - [zlib_deflate_workspacesize() wants 2 args])
7759 + [zlib_deflate_workspacesize() wants 2 args])
7760 ],[
7761 AC_MSG_RESULT(no)
7762 ])
7763 diff --git a/config/kernel.m4 b/config/kernel.m4
7764 index 8e89c8014..b22a00cdd 100644
7765 --- a/config/kernel.m4
7766 +++ b/config/kernel.m4
7767 @@ -2,111 +2,217 @@ dnl #
7768 dnl # Default ZFS kernel configuration
7769 dnl #
7770 AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
7771 + dnl # Setup the kernel build environment.
7772 ZFS_AC_KERNEL
7773 ZFS_AC_QAT
7774 - ZFS_AC_KERNEL_ACCESS_OK_TYPE
7775 - ZFS_AC_TEST_MODULE
7776 +
7777 + dnl # Sanity checks for module building and CONFIG_* defines
7778 + ZFS_AC_KERNEL_TEST_MODULE
7779 + ZFS_AC_KERNEL_CONFIG_DEFINED
7780 +
7781 + dnl # Sequential ZFS_LINUX_TRY_COMPILE tests
7782 + ZFS_AC_KERNEL_FPU_HEADER
7783 + ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T
7784 ZFS_AC_KERNEL_MISC_MINOR
7785 + ZFS_AC_KERNEL_DECLARE_EVENT_CLASS
7786 +
7787 + dnl # Parallel ZFS_LINUX_TEST_SRC / ZFS_LINUX_TEST_RESULT tests
7788 + ZFS_AC_KERNEL_TEST_SRC
7789 + ZFS_AC_KERNEL_TEST_RESULT
7790 +
7791 + AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
7792 + KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"
7793 + ])
7794 +
7795 + AC_SUBST(KERNEL_MAKE)
7796 +])
7797 +
7798 +dnl #
7799 +dnl # Generate and compile all of the kernel API test cases to determine
7800 +dnl # which interfaces are available. By invoking the kernel build system
7801 +dnl # only once the compilation can be done in parallel significantly
7802 +dnl # speeding up the process.
7803 +dnl #
7804 +AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
7805 + ZFS_AC_KERNEL_SRC_OBJTOOL
7806 + ZFS_AC_KERNEL_SRC_GLOBAL_PAGE_STATE
7807 + ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE
7808 + ZFS_AC_KERNEL_SRC_CTL_NAME
7809 + ZFS_AC_KERNEL_SRC_PDE_DATA
7810 + ZFS_AC_KERNEL_SRC_FALLOCATE
7811 + ZFS_AC_KERNEL_SRC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
7812 + ZFS_AC_KERNEL_SRC_RWSEM
7813 + ZFS_AC_KERNEL_SRC_SCHED
7814 + ZFS_AC_KERNEL_SRC_USLEEP_RANGE
7815 + ZFS_AC_KERNEL_SRC_KMEM_CACHE
7816 + ZFS_AC_KERNEL_SRC_WAIT
7817 + ZFS_AC_KERNEL_SRC_INODE_TIMES
7818 + ZFS_AC_KERNEL_SRC_INODE_LOCK
7819 + ZFS_AC_KERNEL_SRC_GROUP_INFO_GID
7820 + ZFS_AC_KERNEL_SRC_RW
7821 + ZFS_AC_KERNEL_SRC_TIMER_SETUP
7822 + ZFS_AC_KERNEL_SRC_CURRENT_BIO_TAIL
7823 + ZFS_AC_KERNEL_SRC_SUPER_USER_NS
7824 + ZFS_AC_KERNEL_SRC_SUBMIT_BIO
7825 + ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS
7826 + ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH
7827 + ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART
7828 + ZFS_AC_KERNEL_SRC_INVALIDATE_BDEV
7829 + ZFS_AC_KERNEL_SRC_LOOKUP_BDEV
7830 + ZFS_AC_KERNEL_SRC_BDEV_OPEN_EXCLUSIVE
7831 + ZFS_AC_KERNEL_SRC_BDEV_LOGICAL_BLOCK_SIZE
7832 + ZFS_AC_KERNEL_SRC_BDEV_PHYSICAL_BLOCK_SIZE
7833 + ZFS_AC_KERNEL_SRC_BIO_BVEC_ITER
7834 + ZFS_AC_KERNEL_SRC_BIO_FAILFAST
7835 + ZFS_AC_KERNEL_SRC_BIO_SET_DEV
7836 + ZFS_AC_KERNEL_SRC_BIO_OPS
7837 + ZFS_AC_KERNEL_SRC_BIO_END_IO_T_ARGS
7838 + ZFS_AC_KERNEL_SRC_BIO_BI_STATUS
7839 + ZFS_AC_KERNEL_SRC_BIO_RW_BARRIER
7840 + ZFS_AC_KERNEL_SRC_BIO_RW_DISCARD
7841 + ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI
7842 + ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD
7843 + ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE
7844 + ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAGS
7845 + ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH
7846 + ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS
7847 + ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS
7848 + ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG
7849 + ZFS_AC_KERNEL_SRC_GET_DISK_AND_MODULE
7850 + ZFS_AC_KERNEL_SRC_GET_DISK_RO
7851 + ZFS_AC_KERNEL_SRC_GENERIC_READLINK_GLOBAL
7852 + ZFS_AC_KERNEL_SRC_DISCARD_GRANULARITY
7853 + ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE
7854 + ZFS_AC_KERNEL_SRC_XATTR
7855 + ZFS_AC_KERNEL_SRC_ACL
7856 + ZFS_AC_KERNEL_SRC_INODE_GETATTR
7857 + ZFS_AC_KERNEL_SRC_INODE_SET_FLAGS
7858 + ZFS_AC_KERNEL_SRC_INODE_SET_IVERSION
7859 + ZFS_AC_KERNEL_SRC_SHOW_OPTIONS
7860 + ZFS_AC_KERNEL_SRC_FILE_INODE
7861 + ZFS_AC_KERNEL_SRC_FILE_DENTRY
7862 + ZFS_AC_KERNEL_SRC_FSYNC
7863 + ZFS_AC_KERNEL_SRC_AIO_FSYNC
7864 + ZFS_AC_KERNEL_SRC_EVICT_INODE
7865 + ZFS_AC_KERNEL_SRC_DIRTY_INODE
7866 + ZFS_AC_KERNEL_SRC_SHRINKER
7867 + ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T
7868 + ZFS_AC_KERNEL_SRC_LOOKUP_NAMEIDATA
7869 + ZFS_AC_KERNEL_SRC_CREATE_NAMEIDATA
7870 + ZFS_AC_KERNEL_SRC_GET_LINK
7871 + ZFS_AC_KERNEL_SRC_PUT_LINK
7872 + ZFS_AC_KERNEL_SRC_TMPFILE
7873 + ZFS_AC_KERNEL_SRC_TRUNCATE_RANGE
7874 + ZFS_AC_KERNEL_SRC_AUTOMOUNT
7875 + ZFS_AC_KERNEL_SRC_ENCODE_FH_WITH_INODE
7876 + ZFS_AC_KERNEL_SRC_COMMIT_METADATA
7877 + ZFS_AC_KERNEL_SRC_CLEAR_INODE
7878 + ZFS_AC_KERNEL_SRC_SETATTR_PREPARE
7879 + ZFS_AC_KERNEL_SRC_INSERT_INODE_LOCKED
7880 + ZFS_AC_KERNEL_SRC_DENTRY
7881 + ZFS_AC_KERNEL_SRC_TRUNCATE_SETSIZE
7882 + ZFS_AC_KERNEL_SRC_SECURITY_INODE
7883 + ZFS_AC_KERNEL_SRC_FST_MOUNT
7884 + ZFS_AC_KERNEL_SRC_BDI
7885 + ZFS_AC_KERNEL_SRC_SET_NLINK
7886 + ZFS_AC_KERNEL_SRC_ELEVATOR_CHANGE
7887 + ZFS_AC_KERNEL_SRC_SGET
7888 + ZFS_AC_KERNEL_SRC_LSEEK_EXECUTE
7889 + ZFS_AC_KERNEL_SRC_VFS_GETATTR
7890 + ZFS_AC_KERNEL_SRC_VFS_FSYNC_2ARGS
7891 + ZFS_AC_KERNEL_SRC_VFS_ITERATE
7892 + ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO
7893 + ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE
7894 + ZFS_AC_KERNEL_SRC_VFS_GENERIC_WRITE_CHECKS
7895 + ZFS_AC_KERNEL_SRC_KMAP_ATOMIC_ARGS
7896 + ZFS_AC_KERNEL_SRC_FOLLOW_DOWN_ONE
7897 + ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN
7898 + ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT
7899 + ZFS_AC_KERNEL_SRC_FPU
7900 + ZFS_AC_KERNEL_SRC_FMODE_T
7901 + ZFS_AC_KERNEL_SRC_KUIDGID_T
7902 + ZFS_AC_KERNEL_SRC_KUID_HELPERS
7903 + ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST
7904 + ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS
7905 + ZFS_AC_KERNEL_SRC_CURRENT_TIME
7906 + ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES
7907 + ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL
7908 + ZFS_AC_KERNEL_SRC_KTIME_GET_COARSE_REAL_TS64
7909 + ZFS_AC_KERNEL_SRC_TOTALRAM_PAGES_FUNC
7910 + ZFS_AC_KERNEL_SRC_TOTALHIGH_PAGES
7911 + ZFS_AC_KERNEL_SRC_KSTRTOUL
7912 +
7913 + AC_MSG_CHECKING([for available kernel interfaces])
7914 + ZFS_LINUX_TEST_COMPILE_ALL([kabi])
7915 + AC_MSG_RESULT([done])
7916 +])
7917 +
7918 +dnl #
7919 +dnl # Check results of kernel interface tests.
7920 +dnl #
7921 +AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
7922 + ZFS_AC_KERNEL_ACCESS_OK_TYPE
7923 + ZFS_AC_KERNEL_GLOBAL_PAGE_STATE
7924 ZFS_AC_KERNEL_OBJTOOL
7925 - ZFS_AC_KERNEL_CONFIG
7926 ZFS_AC_KERNEL_CTL_NAME
7927 ZFS_AC_KERNEL_PDE_DATA
7928 - ZFS_AC_KERNEL_2ARGS_VFS_FSYNC
7929 - ZFS_AC_KERNEL_KUIDGID_T
7930 ZFS_AC_KERNEL_FALLOCATE
7931 ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
7932 - ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW
7933 - ZFS_AC_KERNEL_RWSEM_ACTIVITY
7934 - ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT
7935 - ZFS_AC_KERNEL_SCHED_RT_HEADER
7936 - ZFS_AC_KERNEL_SCHED_SIGNAL_HEADER
7937 - ZFS_AC_KERNEL_IO_SCHEDULE_TIMEOUT
7938 - ZFS_AC_KERNEL_4ARGS_VFS_GETATTR
7939 - ZFS_AC_KERNEL_3ARGS_VFS_GETATTR
7940 - ZFS_AC_KERNEL_2ARGS_VFS_GETATTR
7941 + ZFS_AC_KERNEL_RWSEM
7942 + ZFS_AC_KERNEL_SCHED
7943 ZFS_AC_KERNEL_USLEEP_RANGE
7944 - ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS
7945 - ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY
7946 - ZFS_AC_KERNEL_WAIT_ON_BIT
7947 - ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T
7948 - ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY
7949 + ZFS_AC_KERNEL_KMEM_CACHE
7950 + ZFS_AC_KERNEL_WAIT
7951 ZFS_AC_KERNEL_INODE_TIMES
7952 ZFS_AC_KERNEL_INODE_LOCK
7953 ZFS_AC_KERNEL_GROUP_INFO_GID
7954 - ZFS_AC_KERNEL_WRITE
7955 - ZFS_AC_KERNEL_READ
7956 + ZFS_AC_KERNEL_RW
7957 ZFS_AC_KERNEL_TIMER_SETUP
7958 - ZFS_AC_KERNEL_DECLARE_EVENT_CLASS
7959 ZFS_AC_KERNEL_CURRENT_BIO_TAIL
7960 ZFS_AC_KERNEL_SUPER_USER_NS
7961 ZFS_AC_KERNEL_SUBMIT_BIO
7962 - ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
7963 - ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
7964 - ZFS_AC_KERNEL_TYPE_FMODE_T
7965 + ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS
7966 ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH
7967 ZFS_AC_KERNEL_BLKDEV_REREAD_PART
7968 - ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE
7969 + ZFS_AC_KERNEL_INVALIDATE_BDEV
7970 ZFS_AC_KERNEL_LOOKUP_BDEV
7971 - ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS
7972 + ZFS_AC_KERNEL_BDEV_OPEN_EXCLUSIVE
7973 ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE
7974 ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE
7975 ZFS_AC_KERNEL_BIO_BVEC_ITER
7976 - ZFS_AC_KERNEL_BIO_FAILFAST_DTD
7977 + ZFS_AC_KERNEL_BIO_FAILFAST
7978 ZFS_AC_KERNEL_BIO_SET_DEV
7979 - ZFS_AC_KERNEL_REQ_FAILFAST_MASK
7980 - ZFS_AC_KERNEL_REQ_OP_DISCARD
7981 - ZFS_AC_KERNEL_REQ_OP_SECURE_ERASE
7982 - ZFS_AC_KERNEL_REQ_OP_FLUSH
7983 - ZFS_AC_KERNEL_BIO_BI_OPF
7984 + ZFS_AC_KERNEL_BIO_OPS
7985 ZFS_AC_KERNEL_BIO_END_IO_T_ARGS
7986 ZFS_AC_KERNEL_BIO_BI_STATUS
7987 ZFS_AC_KERNEL_BIO_RW_BARRIER
7988 ZFS_AC_KERNEL_BIO_RW_DISCARD
7989 ZFS_AC_KERNEL_BLK_QUEUE_BDI
7990 - ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR
7991 - ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET
7992 + ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
7993 + ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
7994 + ZFS_AC_KERNEL_BLK_QUEUE_FLAGS
7995 ZFS_AC_KERNEL_BLK_QUEUE_FLUSH
7996 ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS
7997 ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS
7998 - ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BIO_RW_UNPLUG
7999 - ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BLK_PLUG
8000 + ZFS_AC_KERNEL_BLK_QUEUE_PLUG
8001 ZFS_AC_KERNEL_GET_DISK_AND_MODULE
8002 ZFS_AC_KERNEL_GET_DISK_RO
8003 - ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS
8004 ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL
8005 ZFS_AC_KERNEL_DISCARD_GRANULARITY
8006 - ZFS_AC_KERNEL_CONST_XATTR_HANDLER
8007 - ZFS_AC_KERNEL_XATTR_HANDLER_NAME
8008 - ZFS_AC_KERNEL_XATTR_HANDLER_GET
8009 - ZFS_AC_KERNEL_XATTR_HANDLER_SET
8010 - ZFS_AC_KERNEL_XATTR_HANDLER_LIST
8011 ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE
8012 - ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS
8013 - ZFS_AC_KERNEL_POSIX_ACL_RELEASE
8014 - ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE
8015 - ZFS_AC_KERNEL_POSIX_ACL_CHMOD
8016 - ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
8017 - ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS
8018 - ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION
8019 - ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA
8020 - ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL
8021 - ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS
8022 - ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
8023 - ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
8024 - ZFS_AC_KERNEL_INODE_OPERATIONS_GETATTR
8025 + ZFS_AC_KERNEL_XATTR
8026 + ZFS_AC_KERNEL_ACL
8027 + ZFS_AC_KERNEL_INODE_GETATTR
8028 ZFS_AC_KERNEL_INODE_SET_FLAGS
8029 ZFS_AC_KERNEL_INODE_SET_IVERSION
8030 - ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
8031 ZFS_AC_KERNEL_SHOW_OPTIONS
8032 ZFS_AC_KERNEL_FILE_INODE
8033 ZFS_AC_KERNEL_FILE_DENTRY
8034 ZFS_AC_KERNEL_FSYNC
8035 - ZFS_AC_KERNEL_EVICT_INODE
8036 - ZFS_AC_KERNEL_DIRTY_INODE_WITH_FLAGS
8037 - ZFS_AC_KERNEL_NR_CACHED_OBJECTS
8038 - ZFS_AC_KERNEL_FREE_CACHED_OBJECTS
8039 - ZFS_AC_KERNEL_FALLOCATE
8040 ZFS_AC_KERNEL_AIO_FSYNC
8041 + ZFS_AC_KERNEL_EVICT_INODE
8042 + ZFS_AC_KERNEL_DIRTY_INODE
8043 + ZFS_AC_KERNEL_SHRINKER
8044 ZFS_AC_KERNEL_MKDIR_UMODE_T
8045 ZFS_AC_KERNEL_LOOKUP_NAMEIDATA
8046 ZFS_AC_KERNEL_CREATE_NAMEIDATA
8047 @@ -120,58 +226,38 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
8048 ZFS_AC_KERNEL_CLEAR_INODE
8049 ZFS_AC_KERNEL_SETATTR_PREPARE
8050 ZFS_AC_KERNEL_INSERT_INODE_LOCKED
8051 - ZFS_AC_KERNEL_D_MAKE_ROOT
8052 - ZFS_AC_KERNEL_D_OBTAIN_ALIAS
8053 - ZFS_AC_KERNEL_D_PRUNE_ALIASES
8054 - ZFS_AC_KERNEL_D_SET_D_OP
8055 - ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA
8056 - ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS
8057 + ZFS_AC_KERNEL_DENTRY
8058 ZFS_AC_KERNEL_TRUNCATE_SETSIZE
8059 - ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY
8060 - ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY
8061 + ZFS_AC_KERNEL_SECURITY_INODE
8062 ZFS_AC_KERNEL_FST_MOUNT
8063 - ZFS_AC_KERNEL_SHRINK
8064 - ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID
8065 - ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT
8066 - ZFS_AC_KERNEL_SHRINKER_CALLBACK
8067 - ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD
8068 - ZFS_AC_KERNEL_S_D_OP
8069 ZFS_AC_KERNEL_BDI
8070 ZFS_AC_KERNEL_SET_NLINK
8071 ZFS_AC_KERNEL_ELEVATOR_CHANGE
8072 - ZFS_AC_KERNEL_5ARG_SGET
8073 + ZFS_AC_KERNEL_SGET
8074 ZFS_AC_KERNEL_LSEEK_EXECUTE
8075 + ZFS_AC_KERNEL_VFS_GETATTR
8076 + ZFS_AC_KERNEL_VFS_FSYNC_2ARGS
8077 ZFS_AC_KERNEL_VFS_ITERATE
8078 - ZFS_AC_KERNEL_VFS_RW_ITERATE
8079 ZFS_AC_KERNEL_VFS_DIRECT_IO
8080 - ZFS_AC_KERNEL_GENERIC_WRITE_CHECKS
8081 + ZFS_AC_KERNEL_VFS_RW_ITERATE
8082 + ZFS_AC_KERNEL_VFS_GENERIC_WRITE_CHECKS
8083 ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS
8084 ZFS_AC_KERNEL_FOLLOW_DOWN_ONE
8085 ZFS_AC_KERNEL_MAKE_REQUEST_FN
8086 - ZFS_AC_KERNEL_GENERIC_IO_ACCT_3ARG
8087 - ZFS_AC_KERNEL_GENERIC_IO_ACCT_4ARG
8088 + ZFS_AC_KERNEL_GENERIC_IO_ACCT
8089 ZFS_AC_KERNEL_FPU
8090 + ZFS_AC_KERNEL_FMODE_T
8091 + ZFS_AC_KERNEL_KUIDGID_T
8092 ZFS_AC_KERNEL_KUID_HELPERS
8093 ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
8094 ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
8095 - ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR
8096 ZFS_AC_KERNEL_CURRENT_TIME
8097 - ZFS_AC_KERNEL_GLOBAL_PAGE_STATE
8098 - ZFS_AC_KERNEL_ACL_HAS_REFCOUNT
8099 ZFS_AC_KERNEL_USERNS_CAPABILITIES
8100 ZFS_AC_KERNEL_IN_COMPAT_SYSCALL
8101 ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64
8102 ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNC
8103 ZFS_AC_KERNEL_TOTALHIGH_PAGES
8104 - ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
8105 - ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
8106 ZFS_AC_KERNEL_KSTRTOUL
8107 -
8108 - AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
8109 - KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"
8110 - ])
8111 -
8112 - AC_SUBST(KERNEL_MAKE)
8113 ])
8114
8115 dnl #
8116 @@ -190,9 +276,10 @@ AC_DEFUN([ZFS_AC_MODULE_SYMVERS], [
8117 AS_IF([test ! -f "$LINUX_OBJ/$LINUX_SYMBOLS"], [
8118 AC_MSG_ERROR([
8119 *** Please make sure the kernel devel package for your distribution
8120 - *** is installed. If you are building with a custom kernel, make sure the
8121 - *** kernel is configured, built, and the '--with-linux=PATH' configure
8122 - *** option refers to the location of the kernel source.])
8123 + *** is installed. If you are building with a custom kernel, make sure
8124 + *** the kernel is configured, built, and the '--with-linux=PATH'
8125 + *** configure option refers to the location of the kernel source.
8126 + ])
8127 ])
8128 ], [
8129 LINUX_SYMBOLS=NONE
8130 @@ -285,12 +372,16 @@ AC_DEFUN([ZFS_AC_KERNEL], [
8131
8132 AS_IF([test -z "$kernsrcver"], [
8133 AC_MSG_RESULT([Not found])
8134 - AC_MSG_ERROR([*** Cannot determine kernel version.])
8135 + AC_MSG_ERROR([
8136 + *** Cannot determine kernel version.
8137 + ])
8138 ])
8139 ], [
8140 AC_MSG_RESULT([Not found])
8141 if test "x$enable_linux_builtin" != xyes; then
8142 - AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
8143 + AC_MSG_ERROR([
8144 + *** Cannot find UTS_RELEASE definition.
8145 + ])
8146 else
8147 AC_MSG_ERROR([
8148 *** Cannot find UTS_RELEASE definition.
8149 @@ -312,24 +403,27 @@ AC_DEFUN([ZFS_AC_KERNEL], [
8150 ])
8151
8152 dnl #
8153 -dnl # Detect the QAT module to be built against
8154 -dnl # QAT provides hardware acceleration for data compression:
8155 -dnl # https://01.org/intel-quickassist-technology
8156 -dnl # * Download and install QAT driver from the above link
8157 -dnl # * Start QAT driver in your system:
8158 -dnl # service qat_service start
8159 -dnl # * Enable QAT in ZFS, e.g.:
8160 -dnl # ./configure --with-qat=<qat-driver-path>/QAT1.6
8161 -dnl # make
8162 -dnl # * Set GZIP compression in ZFS dataset:
8163 -dnl # zfs set compression = gzip <dataset>
8164 -dnl # Then the data written to this ZFS pool is compressed
8165 -dnl # by QAT accelerator automatically, and de-compressed by
8166 -dnl # QAT when read from the pool.
8167 -dnl # * Get QAT hardware statistics by:
8168 -dnl # cat /proc/icp_dh895xcc_dev/qat
8169 -dnl # * To disable QAT:
8170 -dnl # insmod zfs.ko zfs_qat_disable=1
8171 +dnl # Detect the QAT module to be built against, QAT provides hardware
8172 +dnl # acceleration for data compression:
8173 +dnl #
8174 +dnl # https://01.org/intel-quickassist-technology
8175 +dnl #
8176 +dnl # 1) Download and install QAT driver from the above link
8177 +dnl # 2) Start QAT driver in your system:
8178 +dnl # service qat_service start
8179 +dnl # 3) Enable QAT in ZFS, e.g.:
8180 +dnl # ./configure --with-qat=<qat-driver-path>/QAT1.6
8181 +dnl # make
8182 +dnl # 4) Set GZIP compression in ZFS dataset:
8183 +dnl # zfs set compression = gzip <dataset>
8184 +dnl #
8185 +dnl # Then the data written to this ZFS pool is compressed by QAT accelerator
8186 +dnl # automatically, and de-compressed by QAT when read from the pool.
8187 +dnl #
8188 +dnl # 1) Get QAT hardware statistics with:
8189 +dnl # cat /proc/icp_dh895xcc_dev/qat
8190 +dnl # 2) To disable QAT:
8191 +dnl # insmod zfs.ko zfs_qat_disable=1
8192 dnl #
8193 AC_DEFUN([ZFS_AC_QAT], [
8194 AC_ARG_WITH([qat],
8195 @@ -350,11 +444,11 @@ AC_DEFUN([ZFS_AC_QAT], [
8196 QAT_SRC="${qatsrc}/quickassist"
8197 AS_IF([ test ! -e "$QAT_SRC/include/cpa.h"], [
8198 AC_MSG_ERROR([
8199 - *** Please make sure the qat driver package is installed
8200 - *** and specify the location of the qat source with the
8201 - *** '--with-qat=PATH' option then try again. Failed to
8202 - *** find cpa.h in:
8203 - ${QAT_SRC}/include])
8204 + *** Please make sure the qat driver package is installed
8205 + *** and specify the location of the qat source with the
8206 + *** '--with-qat=PATH' option then try again. Failed to
8207 + *** find cpa.h in:
8208 + ${QAT_SRC}/include])
8209 ])
8210 ])
8211
8212 @@ -368,9 +462,9 @@ AC_DEFUN([ZFS_AC_QAT], [
8213 QAT_OBJ=${qatbuild}
8214 AS_IF([ ! test -e "$QAT_OBJ/icp_qa_al.ko" && ! test -e "$QAT_OBJ/qat_api.ko"], [
8215 AC_MSG_ERROR([
8216 - *** Please make sure the qat driver is installed then try again.
8217 - *** Failed to find icp_qa_al.ko or qat_api.ko in:
8218 - $QAT_OBJ])
8219 + *** Please make sure the qat driver is installed then try again.
8220 + *** Failed to find icp_qa_al.ko or qat_api.ko in:
8221 + $QAT_OBJ])
8222 ])
8223
8224 AC_SUBST(QAT_SRC)
8225 @@ -391,10 +485,10 @@ AC_DEFUN([ZFS_AC_QAT], [
8226 AC_MSG_RESULT([$QAT_SYMBOLS])
8227 AC_SUBST(QAT_SYMBOLS)
8228 ],[
8229 - AC_MSG_ERROR([
8230 - *** Please make sure the qat driver is installed then try again.
8231 - *** Failed to find Module.symvers in:
8232 - $QAT_SYMBOLS])
8233 + AC_MSG_ERROR([
8234 + *** Please make sure the qat driver is installed then try again.
8235 + *** Failed to find Module.symvers in:
8236 + $QAT_SYMBOLS
8237 ])
8238 ])
8239 ])
8240 @@ -403,14 +497,16 @@ AC_DEFUN([ZFS_AC_QAT], [
8241 dnl #
8242 dnl # Basic toolchain sanity check.
8243 dnl #
8244 -AC_DEFUN([ZFS_AC_TEST_MODULE], [
8245 +AC_DEFUN([ZFS_AC_KERNEL_TEST_MODULE], [
8246 AC_MSG_CHECKING([whether modules can be built])
8247 - ZFS_LINUX_TRY_COMPILE([],[],[
8248 + ZFS_LINUX_TRY_COMPILE([], [], [
8249 AC_MSG_RESULT([yes])
8250 ],[
8251 AC_MSG_RESULT([no])
8252 if test "x$enable_linux_builtin" != xyes; then
8253 - AC_MSG_ERROR([*** Unable to build an empty module.])
8254 + AC_MSG_ERROR([
8255 + *** Unable to build an empty module.
8256 + ])
8257 else
8258 AC_MSG_ERROR([
8259 *** Unable to build an empty module.
8260 @@ -420,207 +516,313 @@ AC_DEFUN([ZFS_AC_TEST_MODULE], [
8261 ])
8262
8263 dnl #
8264 -dnl # Certain kernel build options are not supported. These must be
8265 -dnl # detected at configure time and cause a build failure. Otherwise
8266 -dnl # modules may be successfully built that behave incorrectly.
8267 +dnl # ZFS_LINUX_CONFTEST_H
8268 dnl #
8269 -AC_DEFUN([ZFS_AC_KERNEL_CONFIG], [
8270 - AS_IF([test "x$cross_compiling" != xyes], [
8271 - AC_RUN_IFELSE([
8272 - AC_LANG_PROGRAM([
8273 - #include "$LINUX/include/linux/license.h"
8274 - ], [
8275 - return !license_is_gpl_compatible("$ZFS_META_LICENSE");
8276 - ])
8277 - ], [
8278 - AC_DEFINE([ZFS_IS_GPL_COMPATIBLE], [1],
8279 - [Define to 1 if GPL-only symbols can be used])
8280 - ], [
8281 - ])
8282 - ])
8283 +AC_DEFUN([ZFS_LINUX_CONFTEST_H], [
8284 +test -d build/$2 || mkdir -p build/$2
8285 +cat - <<_ACEOF >build/$2/$2.h
8286 +$1
8287 +_ACEOF
8288 +])
8289
8290 - ZFS_AC_KERNEL_CONFIG_THREAD_SIZE
8291 - ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC
8292 - ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS
8293 - ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE
8294 - ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE
8295 +dnl #
8296 +dnl # ZFS_LINUX_CONFTEST_C
8297 +dnl #
8298 +AC_DEFUN([ZFS_LINUX_CONFTEST_C], [
8299 +test -d build/$2 || mkdir -p build/$2
8300 +cat confdefs.h - <<_ACEOF >build/$2/$2.c
8301 +$1
8302 +_ACEOF
8303 ])
8304
8305 dnl #
8306 -dnl # Check configured THREAD_SIZE
8307 +dnl # ZFS_LINUX_CONFTEST_MAKEFILE
8308 dnl #
8309 -dnl # The stack size will vary by architecture, but as of Linux 3.15 on x86_64
8310 -dnl # the default thread stack size was increased to 16K from 8K. Therefore,
8311 -dnl # on newer kernels and some architectures stack usage optimizations can be
8312 -dnl # conditionally applied to improve performance without negatively impacting
8313 -dnl # stability.
8314 +dnl # $1 - test case name
8315 +dnl # $2 - add to top-level Makefile
8316 +dnl # $3 - additional build flags
8317 dnl #
8318 -AC_DEFUN([ZFS_AC_KERNEL_CONFIG_THREAD_SIZE], [
8319 - AC_MSG_CHECKING([whether kernel was built with 16K or larger stacks])
8320 - ZFS_LINUX_TRY_COMPILE([
8321 - #include <linux/module.h>
8322 - ],[
8323 - #if (THREAD_SIZE < 16384)
8324 - #error "THREAD_SIZE is less than 16K"
8325 - #endif
8326 - ],[
8327 - AC_MSG_RESULT([yes])
8328 - AC_DEFINE(HAVE_LARGE_STACKS, 1, [kernel has large stacks])
8329 - ],[
8330 - AC_MSG_RESULT([no])
8331 - ])
8332 +AC_DEFUN([ZFS_LINUX_CONFTEST_MAKEFILE], [
8333 + test -d build || mkdir -p build
8334 + test -d build/$1 || mkdir -p build/$1
8335 +
8336 + file=build/$1/Makefile
8337 +
8338 + dnl # Example command line to manually build source.
8339 + cat - <<_ACEOF >$file
8340 +# Example command line to manually build source
8341 +# make modules -C $LINUX_OBJ $ARCH_UM M=$PWD/build/$1
8342 +
8343 +ccflags-y := -Werror $FRAME_LARGER_THAN
8344 +_ACEOF
8345 +
8346 + dnl # Additional custom CFLAGS as requested.
8347 + m4_ifval($3, [echo "ccflags-y += $3" >>$file], [])
8348 +
8349 + dnl # Test case source
8350 + echo "obj-m := $1.o" >>$file
8351 +
8352 + AS_IF([test "x$2" = "xyes"], [echo "obj-m += $1/" >>build/Makefile], [])
8353 ])
8354
8355 dnl #
8356 -dnl # Check CONFIG_DEBUG_LOCK_ALLOC
8357 +dnl # ZFS_LINUX_TEST_PROGRAM(C)([PROLOGUE], [BODY])
8358 dnl #
8359 -dnl # This is typically only set for debug kernels because it comes with
8360 -dnl # a performance penalty. However, when it is set it maps the non-GPL
8361 -dnl # symbol mutex_lock() to the GPL-only mutex_lock_nested() symbol.
8362 -dnl # This will cause a failure at link time which we'd rather know about
8363 -dnl # at compile time.
8364 +m4_define([ZFS_LINUX_TEST_PROGRAM], [
8365 +$1
8366 +int
8367 +main (void)
8368 +{
8369 +$2
8370 + ;
8371 + return 0;
8372 +}
8373 +])
8374 +
8375 dnl #
8376 -dnl # Since we plan to pursue making mutex_lock_nested() a non-GPL symbol
8377 -dnl # with the upstream community we add a check to detect this case.
8378 +dnl # ZFS_LINUX_TEST_REMOVE
8379 dnl #
8380 -AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
8381 -
8382 - ZFS_LINUX_CONFIG([DEBUG_LOCK_ALLOC], [
8383 - AC_MSG_CHECKING([whether mutex_lock() is GPL-only])
8384 - tmp_flags="$EXTRA_KCFLAGS"
8385 - ZFS_LINUX_TRY_COMPILE([
8386 - #include <linux/module.h>
8387 - #include <linux/mutex.h>
8388 -
8389 - MODULE_LICENSE("$ZFS_META_LICENSE");
8390 - ],[
8391 - struct mutex lock;
8392 +dnl # Removes the specified test source and results.
8393 +dnl #
8394 +AC_DEFUN([ZFS_LINUX_TEST_REMOVE], [
8395 + test -d build/$1 && rm -Rf build/$1
8396 + test -f build/Makefile && sed '/$1/d' build/Makefile
8397 +])
8398
8399 - mutex_init(&lock);
8400 - mutex_lock(&lock);
8401 - mutex_unlock(&lock);
8402 - ],[
8403 - AC_MSG_RESULT(no)
8404 - ],[
8405 - AC_MSG_RESULT(yes)
8406 - AC_MSG_ERROR([
8407 - *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
8408 - *** with the CDDL license and will prevent the module linking stage
8409 - *** from succeeding. You must rebuild your kernel without this
8410 - *** option enabled.])
8411 - ])
8412 - EXTRA_KCFLAGS="$tmp_flags"
8413 - ], [])
8414 +dnl #
8415 +dnl # ZFS_LINUX_COMPILE
8416 +dnl #
8417 +dnl # $1 - build dir
8418 +dnl # $2 - test command
8419 +dnl # $3 - pass command
8420 +dnl # $4 - fail command
8421 +dnl # $5 - set KBUILD_MODPOST_NOFINAL='yes'
8422 +dnl # $6 - set KBUILD_MODPOST_WARN='yes'
8423 +dnl #
8424 +dnl # Used internally by ZFS_LINUX_TEST_{COMPILE,MODPOST}
8425 +dnl #
8426 +AC_DEFUN([ZFS_LINUX_COMPILE], [
8427 + AC_TRY_COMMAND([
8428 + KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6"
8429 + make modules -k -j$TEST_JOBS -C $LINUX_OBJ $ARCH_UM
8430 + M=$PWD/$1 &>$1/build.log])
8431 + AS_IF([AC_TRY_COMMAND([$2])], [$3], [$4])
8432 ])
8433
8434 dnl #
8435 -dnl # Check CONFIG_TRIM_UNUSED_KSYMS
8436 +dnl # ZFS_LINUX_TEST_COMPILE
8437 dnl #
8438 -dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled.
8439 +dnl # Perform a full compile excluding the final modpost phase.
8440 dnl #
8441 -AC_DEFUN([ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS], [
8442 - AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
8443 - ZFS_LINUX_TRY_COMPILE([
8444 - #if defined(CONFIG_TRIM_UNUSED_KSYMS)
8445 - #error CONFIG_TRIM_UNUSED_KSYMS not defined
8446 - #endif
8447 - ],[ ],[
8448 - AC_MSG_RESULT([yes])
8449 +AC_DEFUN([ZFS_LINUX_TEST_COMPILE], [
8450 + ZFS_LINUX_COMPILE([$2], [test -f $2/build.log], [
8451 + mv $2/Makefile $2/Makefile.compile.$1
8452 + mv $2/build.log $2/build.log.$1
8453 ],[
8454 - AC_MSG_RESULT([no])
8455 - AS_IF([test "x$enable_linux_builtin" != xyes], [
8456 - AC_MSG_ERROR([
8457 - *** This kernel has unused symbols trimming enabled, please disable.
8458 - *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
8459 - ])])
8460 + AC_MSG_ERROR([
8461 + *** Unable to compile test source to determine kernel interfaces.])
8462 + ], [yes], [])
8463 ])
8464
8465 dnl #
8466 -dnl # ZFS_LINUX_CONFTEST_H
8467 +dnl # ZFS_LINUX_TEST_MODPOST
8468 dnl #
8469 -AC_DEFUN([ZFS_LINUX_CONFTEST_H], [
8470 -cat - <<_ACEOF >conftest.h
8471 -$1
8472 -_ACEOF
8473 +dnl # Perform a full compile including the modpost phase. This may
8474 +dnl # be an incremental build if the objects have already been built.
8475 +dnl #
8476 +AC_DEFUN([ZFS_LINUX_TEST_MODPOST], [
8477 + ZFS_LINUX_COMPILE([$2], [test -f $2/build.log], [
8478 + mv $2/Makefile $2/Makefile.modpost.$1
8479 + cat $2/build.log >>build/build.log.$1
8480 + ],[
8481 + AC_MSG_ERROR([
8482 + *** Unable to modpost test source to determine kernel interfaces.])
8483 + ], [], [yes])
8484 ])
8485
8486 dnl #
8487 -dnl # ZFS_LINUX_CONFTEST_C
8488 +dnl # Perform the compilation of the test cases in two phases.
8489 dnl #
8490 -AC_DEFUN([ZFS_LINUX_CONFTEST_C], [
8491 -cat confdefs.h - <<_ACEOF >conftest.c
8492 -$1
8493 -_ACEOF
8494 +dnl # Phase 1) attempt to build the object files for all of the tests
8495 +dnl # defined by the ZFS_LINUX_TEST_SRC macro. But do not
8496 +dnl # perform the final modpost stage.
8497 +dnl #
8498 +dnl # Phase 2) disable all tests which failed the initial compilation,
8499 +dnl # then invoke the final modpost step for the remaining tests.
8500 +dnl #
8501 +dnl # This allows us efficiently build the test cases in parallel while
8502 +dnl # remaining resilient to build failures which are expected when
8503 +dnl # detecting the available kernel interfaces.
8504 +dnl #
8505 +dnl # The maximum allowed parallelism can be controlled by setting the
8506 +dnl # TEST_JOBS environment variable. Otherwise, it default to $(nproc).
8507 +dnl #
8508 +AC_DEFUN([ZFS_LINUX_TEST_COMPILE_ALL], [
8509 + dnl # Phase 1 - Compilation only, final linking is skipped.
8510 + ZFS_LINUX_TEST_COMPILE([$1], [build])
8511 +
8512 + dnl #
8513 + dnl # Phase 2 - When building external modules disable test cases
8514 + dnl # which failed to compile and invoke modpost to verify the
8515 + dnl # final linking.
8516 + dnl #
8517 + dnl # Test names suffixed with '_license' call modpost independently
8518 + dnl # to ensure that a single incompatibility does not result in the
8519 + dnl # modpost phase exiting early. This check is not performed on
8520 + dnl # every symbol since the majority are compatible and doing so
8521 + dnl # would significantly slow down this phase.
8522 + dnl #
8523 + dnl # When configuring for builtin (--enable-linux-builtin)
8524 + dnl # fake the linking step artificially create the expected .ko
8525 + dnl # files for tests which did compile. This is required for
8526 + dnl # kernels which do not have loadable module support or have
8527 + dnl # not yet been built.
8528 + dnl #
8529 + AS_IF([test "x$enable_linux_builtin" = "xno"], [
8530 + for dir in $(awk '/^obj-m/ { print [$]3 }' \
8531 + build/Makefile.compile.$1); do
8532 + name=${dir%/}
8533 + AS_IF([test -f build/$name/$name.o], [
8534 + AS_IF([test "${name##*_}" = "license"], [
8535 + ZFS_LINUX_TEST_MODPOST([$1],
8536 + [build/$name])
8537 + echo "obj-n += $dir" >>build/Makefile
8538 + ], [
8539 + echo "obj-m += $dir" >>build/Makefile
8540 + ])
8541 + ], [
8542 + echo "obj-n += $dir" >>build/Makefile
8543 + ])
8544 + done
8545 +
8546 + ZFS_LINUX_TEST_MODPOST([$1], [build])
8547 + ], [
8548 + for dir in $(awk '/^obj-m/ { print [$]3 }' \
8549 + build/Makefile.compile.$1); do
8550 + name=${dir%/}
8551 + AS_IF([test -f build/$name/$name.o], [
8552 + touch build/$name/$name.ko
8553 + ])
8554 + done
8555 + ])
8556 ])
8557
8558 dnl #
8559 -dnl # ZFS_LANG_PROGRAM(C)([PROLOGUE], [BODY])
8560 +dnl # ZFS_LINUX_TEST_SRC
8561 dnl #
8562 -m4_define([ZFS_LANG_PROGRAM], [
8563 -$1
8564 -int
8565 -main (void)
8566 -{
8567 -dnl Do *not* indent the following line: there may be CPP directives.
8568 -dnl Don't move the `;' right after for the same reason.
8569 -$2
8570 - ;
8571 - return 0;
8572 -}
8573 +dnl # $1 - name
8574 +dnl # $2 - global
8575 +dnl # $3 - source
8576 +dnl # $4 - extra cflags
8577 +dnl # $5 - check license-compatibility
8578 +dnl #
8579 +dnl # N.B because all of the test cases are compiled in parallel they
8580 +dnl # must never depend on the results of previous tests. Each test
8581 +dnl # needs to be entirely independent.
8582 +dnl #
8583 +AC_DEFUN([ZFS_LINUX_TEST_SRC], [
8584 + ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM([[$2]], [[$3]])], [$1])
8585 + ZFS_LINUX_CONFTEST_MAKEFILE([$1], [yes], [$4])
8586 +
8587 + AS_IF([ test -n "$5" ], [
8588 + ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM([[
8589 + #include <linux/module.h>
8590 + MODULE_LICENSE("$5");
8591 + $2]], [[$3]])], [$1_license])
8592 + ZFS_LINUX_CONFTEST_MAKEFILE([$1_license], [yes], [$4])
8593 + ])
8594 ])
8595
8596 dnl #
8597 -dnl # ZFS_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
8598 +dnl # ZFS_LINUX_TEST_RESULT
8599 dnl #
8600 -AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [
8601 - m4_ifvaln([$1], [ZFS_LINUX_CONFTEST_C([$1])])
8602 - m4_ifvaln([$6], [ZFS_LINUX_CONFTEST_H([$6])], [ZFS_LINUX_CONFTEST_H([])])
8603 - rm -Rf build && mkdir -p build && touch build/conftest.mod.c
8604 - echo "obj-m := conftest.o" >build/Makefile
8605 - modpost_flag=''
8606 - test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
8607 - AS_IF(
8608 - [AC_TRY_COMMAND(cp conftest.c conftest.h build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $FRAME_LARGER_THAN $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])],
8609 - [$4],
8610 - [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
8611 - )
8612 - rm -Rf build
8613 +dnl # $1 - name of a test source (ZFS_LINUX_TEST_SRC)
8614 +dnl # $2 - run on success (valid .ko generated)
8615 +dnl # $3 - run on failure (unable to compile)
8616 +dnl #
8617 +AC_DEFUN([ZFS_LINUX_TEST_RESULT], [
8618 + AS_IF([test -d build/$1], [
8619 + AS_IF([test -f build/$1/$1.ko], [$2], [$3])
8620 + ], [
8621 + AC_MSG_ERROR([
8622 + *** No matching source for the "$1" test, check that
8623 + *** both the test source and result macros refer to the same name.
8624 + ])
8625 + ])
8626 ])
8627
8628 dnl #
8629 -dnl # ZFS_LINUX_TRY_COMPILE like AC_TRY_COMPILE
8630 +dnl # ZFS_LINUX_TEST_ERROR
8631 dnl #
8632 -AC_DEFUN([ZFS_LINUX_TRY_COMPILE],
8633 - [ZFS_LINUX_COMPILE_IFELSE(
8634 - [AC_LANG_SOURCE([ZFS_LANG_PROGRAM([[$1]], [[$2]])])],
8635 - [modules],
8636 - [test -s build/conftest.o],
8637 - [$3], [$4])
8638 +dnl # Generic error message which can be used when none of the expected
8639 +dnl # kernel interfaces were detected.
8640 +dnl #
8641 +AC_DEFUN([ZFS_LINUX_TEST_ERROR], [
8642 + AC_MSG_ERROR([
8643 + *** None of the expected "$1" interfaces were detected.
8644 + *** This may be because your kernel version is newer than what is
8645 + *** supported, or you are using a patched custom kernel with
8646 + *** incompatible modifications.
8647 + ***
8648 + *** ZFS Version: $ZFS_META_ALIAS
8649 + *** Compatible Kernels: $ZFS_META_KVER_MIN - $ZFS_META_KVER_MAX
8650 + ])
8651 ])
8652
8653 dnl #
8654 -dnl # ZFS_LINUX_CONFIG
8655 +dnl # ZFS_LINUX_TEST_RESULT_SYMBOL
8656 dnl #
8657 -AC_DEFUN([ZFS_LINUX_CONFIG],
8658 - [AC_MSG_CHECKING([whether kernel was built with CONFIG_$1])
8659 - ZFS_LINUX_TRY_COMPILE([
8660 - #include <linux/module.h>
8661 - ],[
8662 - #ifndef CONFIG_$1
8663 - #error CONFIG_$1 not #defined
8664 - #endif
8665 - ],[
8666 - AC_MSG_RESULT([yes])
8667 - $2
8668 - ],[
8669 - AC_MSG_RESULT([no])
8670 - $3
8671 +dnl # Like ZFS_LINUX_TEST_RESULT except ZFS_CHECK_SYMBOL_EXPORT is called to
8672 +dnl # verify symbol exports, unless --enable-linux-builtin was provided to
8673 +dnl # configure.
8674 +dnl #
8675 +AC_DEFUN([ZFS_LINUX_TEST_RESULT_SYMBOL], [
8676 + AS_IF([ ! test -f build/$1/$1.ko], [
8677 + $5
8678 + ], [
8679 + AS_IF([test "x$enable_linux_builtin" != "xyes"], [
8680 + ZFS_CHECK_SYMBOL_EXPORT([$2], [$3], [$4], [$5])
8681 + ], [
8682 + $4
8683 + ])
8684 ])
8685 ])
8686
8687 +dnl #
8688 +dnl # ZFS_LINUX_COMPILE_IFELSE
8689 +dnl #
8690 +AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [
8691 + ZFS_LINUX_TEST_REMOVE([conftest])
8692 +
8693 + m4_ifvaln([$1], [ZFS_LINUX_CONFTEST_C([$1], [conftest])])
8694 + m4_ifvaln([$5], [ZFS_LINUX_CONFTEST_H([$5], [conftest])],
8695 + [ZFS_LINUX_CONFTEST_H([], [conftest])])
8696 +
8697 + ZFS_LINUX_CONFTEST_MAKEFILE([conftest], [no],
8698 + [m4_ifvaln([$5], [-I$PWD/build/conftest], [])])
8699 + ZFS_LINUX_COMPILE([build/conftest], [$2], [$3], [$4], [], [])
8700 +])
8701 +
8702 +dnl #
8703 +dnl # ZFS_LINUX_TRY_COMPILE
8704 +dnl #
8705 +dnl # $1 - global
8706 +dnl # $2 - source
8707 +dnl # $3 - run on success (valid .ko generated)
8708 +dnl # $4 - run on failure (unable to compile)
8709 +dnl #
8710 +AC_DEFUN([ZFS_LINUX_TRY_COMPILE], [
8711 + ZFS_LINUX_COMPILE_IFELSE(
8712 + [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]])],
8713 + [test -f build/conftest/conftest.ko],
8714 + [$3], [$4])
8715 +])
8716 +
8717 dnl #
8718 dnl # ZFS_CHECK_SYMBOL_EXPORT
8719 -dnl # check symbol exported or not
8720 +dnl #
8721 +dnl # Check if a symbol is exported on not by consulting the symbols
8722 +dnl # file, or optionally the source code.
8723 dnl #
8724 AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], [
8725 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
8726 @@ -649,8 +851,10 @@ AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], [
8727
8728 dnl #
8729 dnl # ZFS_LINUX_TRY_COMPILE_SYMBOL
8730 -dnl # like ZFS_LINUX_TRY_COMPILE, except ZFS_CHECK_SYMBOL_EXPORT
8731 -dnl # is called if not compiling for builtin
8732 +dnl #
8733 +dnl # Like ZFS_LINUX_TRY_COMPILER except ZFS_CHECK_SYMBOL_EXPORT is called
8734 +dnl # to verify symbol exports, unless --enable-linux-builtin was provided
8735 +dnl # to configure.
8736 dnl #
8737 AC_DEFUN([ZFS_LINUX_TRY_COMPILE_SYMBOL], [
8738 ZFS_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1])
8739 @@ -673,10 +877,9 @@ dnl # ZFS_LINUX_TRY_COMPILE_HEADER
8740 dnl # like ZFS_LINUX_TRY_COMPILE, except the contents conftest.h are
8741 dnl # provided via the fifth parameter
8742 dnl #
8743 -AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER],
8744 - [ZFS_LINUX_COMPILE_IFELSE(
8745 - [AC_LANG_SOURCE([ZFS_LANG_PROGRAM([[$1]], [[$2]])])],
8746 - [modules],
8747 - [test -s build/conftest.o],
8748 - [$3], [$4], [$5])
8749 +AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER], [
8750 + ZFS_LINUX_COMPILE_IFELSE(
8751 + [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]])],
8752 + [test -f build/conftest/conftest.ko],
8753 + [$3], [$4], [$5])
8754 ])
8755 diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
8756 index 8e221f2d7..d2c355425 100644
8757 --- a/config/zfs-build.m4
8758 +++ b/config/zfs-build.m4
8759 @@ -166,6 +166,17 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
8760 ])
8761
8762 AC_DEFUN([ZFS_AC_CONFIG], [
8763 +
8764 + dnl # Remove the previous build test directory.
8765 + rm -Rf build
8766 +
8767 + AC_ARG_VAR([TEST_JOBS],
8768 + [simultaneous jobs during configure (defaults to $(nproc))])
8769 + if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then
8770 + TEST_JOBS=$(nproc)
8771 + fi
8772 + AC_SUBST(TEST_JOBS)
8773 +
8774 ZFS_CONFIG=all
8775 AC_ARG_WITH([config],
8776 AS_HELP_STRING([--with-config=CONFIG],
8777 diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4
8778 index f525e2010..660d8ccb9 100644
8779 --- a/config/zfs-meta.m4
8780 +++ b/config/zfs-meta.m4
8781 @@ -162,6 +162,24 @@ AC_DEFUN([ZFS_AC_META], [
8782 AC_SUBST([ZFS_META_AUTHOR])
8783 fi
8784
8785 + ZFS_META_KVER_MIN=_ZFS_AC_META_GETVAL([Linux-Minimum]);
8786 + if test -n "$ZFS_META_KVER_MIN"; then
8787 + AC_DEFINE_UNQUOTED([ZFS_META_KVER_MIN],
8788 + ["$ZFS_META_KVER_MIN"],
8789 + [Define the minimum compatible kernel version.]
8790 + )
8791 + AC_SUBST([ZFS_META_KVER_MIN])
8792 + fi
8793 +
8794 + ZFS_META_KVER_MAX=_ZFS_AC_META_GETVAL([Linux-Maximum]);
8795 + if test -n "$ZFS_META_KVER_MAX"; then
8796 + AC_DEFINE_UNQUOTED([ZFS_META_KVER_MAX],
8797 + ["$ZFS_META_KVER_MAX"],
8798 + [Define the maximum compatible kernel version.]
8799 + )
8800 + AC_SUBST([ZFS_META_KVER_MAX])
8801 + fi
8802 +
8803 m4_pattern_allow([^LT_(CURRENT|REVISION|AGE)$])
8804 ZFS_META_LT_CURRENT=_ZFS_AC_META_GETVAL([LT_Current]);
8805 ZFS_META_LT_REVISION=_ZFS_AC_META_GETVAL([LT_Revision]);