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
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
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.
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.
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.
33 master (secs) patched (secs)
34 ------------- ----------------
36 configure 137 24 (~17% of current run time)
37 make -j $(nproc) 44 44
40 Reviewed-by: Tony Hutter <hutter2@llnl.gov>
41 Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
45 (cherry picked from commit 608f8749a1055e6769899788e11bd51fd396f9e5)
46 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
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%)
176 diff --git a/.gitignore b/.gitignore
177 index ae9e22dfa..19377a7b1 100644
180 @@ -36,6 +36,7 @@ Makefile.in
181 # Top level generated files specific to this top level dir
188 diff --git a/Makefile.am b/Makefile.am
189 index 9afe22954..5ee7c20be 100644
192 @@ -40,7 +40,7 @@ gitrev:
193 BUILT_SOURCES = gitrev
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:
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 {} \+
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/( /(/'`
221 - $am_cv_proto_iconv])
222 + AC_MSG_RESULT([$am_cv_proto_iconv])
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)
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>
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);
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], [
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])
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
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>
277 - struct posix_acl* tmp = posix_acl_alloc(1, 0);
279 + struct posix_acl *tmp = posix_acl_alloc(1, 0);
280 posix_acl_release(tmp);
282 + ], [], [$ZFS_META_LICENSE])
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], [
289 AC_DEFINE(HAVE_POSIX_ACL_RELEASE, 1,
290 [posix_acl_release() is available])
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>
299 - MODULE_LICENSE("$ZFS_META_LICENSE");
301 - struct posix_acl* tmp = posix_acl_alloc(1, 0);
302 - posix_acl_release(tmp);
304 + ZFS_LINUX_TEST_RESULT([posix_acl_release_license], [
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.
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>
322 - MODULE_LICENSE("$ZFS_META_LICENSE");
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);
330 + ], [], [$ZFS_META_LICENSE])
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], [
337 AC_DEFINE(HAVE_SET_CACHED_ACL_USABLE, 1,
338 - [posix_acl_release() is usable])
339 + [set_cached_acl() is usable])
343 @@ -77,14 +72,25 @@ dnl #
344 dnl # 3.14 API change,
345 dnl # posix_acl_chmod() is changed to __posix_acl_chmod()
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>
355 posix_acl_chmod(NULL, 0, 0)
358 + ZFS_LINUX_TEST_SRC([__posix_acl_chmod], [
359 + #include <linux/fs.h>
360 + #include <linux/posix_acl.h>
362 + __posix_acl_chmod(NULL, 0, 0)
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], [
370 AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, [posix_acl_chmod() exists])
372 @@ -92,14 +98,10 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
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>
380 - __posix_acl_chmod(NULL, 0, 0)
382 + ZFS_LINUX_TEST_RESULT([__posix_acl_chmod], [
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])
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*
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>
403 posix_acl_equiv_mode(NULL,&tmp);
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], [
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*])
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.
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>
430 @@ -141,7 +146,12 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
433 error = posix_acl_valid(user_ns, acl);
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], [
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.
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>
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,
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], [
469 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
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.
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>
483 @@ -193,8 +205,12 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
484 iops __attribute__ ((unused)) = {
485 .permission = permission_fn,
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], [
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
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>
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,
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], [
523 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
525 @@ -232,9 +251,8 @@ dnl #
526 dnl # 2.6.38 API change,
527 dnl # The function check_acl gained a new parameter: flags
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>
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,
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], [
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
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>
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,
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], [
577 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
579 @@ -284,20 +309,23 @@ dnl #
580 dnl # 3.14 API change,
581 dnl # Check if inode_operations contains the function set_acl
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>
590 - int set_acl_fn(struct inode *inode, struct posix_acl *acl, int type)
592 + int set_acl_fn(struct inode *inode, struct posix_acl *acl,
593 + int type) { return 0; }
595 static const struct inode_operations
596 iops __attribute__ ((unused)) = {
597 .set_acl = set_acl_fn,
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], [
608 AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
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
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>
618 + void *sentinel __attribute__ ((unused)) =
619 + uncached_acl_sentinel(NULL);
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], [
629 + AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1,
630 + [uncached_acl_sentinel() exists])
632 - void *sentinel __attribute__ ((unused)) = uncached_acl_sentinel(NULL);
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.
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>
647 + struct posix_acl acl;
648 + refcount_t *r __attribute__ ((unused)) = &acl.a_refcount;
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], [
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])
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
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
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
700 dnl # Linux 4.9-rc5+ ABI, removal of the .aio_fsync field
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>
709 static const struct file_operations
710 fops __attribute__ ((unused)) = {
718 +AC_DEFUN([ZFS_AC_KERNEL_AIO_FSYNC], [
719 + AC_MSG_CHECKING([whether fops->aio_fsync() exists])
720 + ZFS_LINUX_TEST_RESULT([aio_fsync], [
722 AC_DEFINE(HAVE_FILE_AIO_FSYNC, 1, [fops->aio_fsync() exists])
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.
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,
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], [
755 AC_DEFINE(HAVE_AUTOMOUNT, 1, [dops->automount() exists])
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
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>
774 struct block_device *bdev = NULL;
775 bdev_logical_block_size(bdev);
777 + ], [$NO_UNUSED_BUT_SET_VARIABLE])
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], [
784 AC_DEFINE(HAVE_BDEV_LOGICAL_BLOCK_SIZE, 1,
785 - [bdev_logical_block_size() is available])
786 + [bdev_logical_block_size() is available])
790 - EXTRA_KCFLAGS="$tmp_flags"
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.
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>
809 struct block_device *bdev = NULL;
810 bdev_physical_block_size(bdev);
812 + ], [$NO_UNUSED_BUT_SET_VARIABLE])
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], [
819 AC_DEFINE(HAVE_BDEV_PHYSICAL_BLOCK_SIZE, 1,
820 - [bdev_physical_block_size() is available])
821 + [bdev_physical_block_size() is available])
825 - EXTRA_KCFLAGS="$tmp_flags"
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
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.
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;
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));
856 + ZFS_LINUX_TEST_SRC([bdi_setup_and_register], [
857 + #include <linux/backing-dev.h>
858 + struct backing_dev_info bdi;
860 + char *name = "bdi";
861 + int error __attribute__((unused)) =
862 + bdi_setup_and_register(&bdi, name);
865 + ZFS_LINUX_TEST_SRC([bdi_setup_and_register_3args], [
866 + #include <linux/backing-dev.h>
867 + struct backing_dev_info bdi;
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);
876 +AC_DEFUN([ZFS_AC_KERNEL_BDI], [
878 + dnl # 4.12, super_setup_bdi_name() introduced.
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], [
884 AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
885 [super_setup_bdi_name() exits])
890 + dnl # 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments.
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;
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], [
905 AC_DEFINE(HAVE_2ARGS_BDI_SETUP_AND_REGISTER, 1,
906 [bdi_setup_and_register() wants 2 args])
911 + dnl # 2.6.34 - 3.19, bdi_setup_and_register()
912 + dnl # takes 3 arguments.
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;
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], [
929 AC_DEFINE(HAVE_3ARGS_BDI_SETUP_AND_REGISTER, 1,
930 [bdi_setup_and_register() wants 3 args])
933 + dnl # 2.6.32 - 2.6.33, bdi_setup_and_register()
934 + dnl # is not exported.
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.
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>
955 bio.bi_iter.bi_sector = 0;
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], [
964 AC_DEFINE(HAVE_BIO_BVEC_ITER, 1, [bio has bi_iter])
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").
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>
985 void wanted_end_io(struct bio *bio) { return; }
987 bio_end_io_t *end_io __attribute__ ((unused)) = wanted_end_io;
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], [
997 AC_DEFINE(HAVE_1ARG_BIO_END_IO_T, 1,
998 - [bio_end_io_t wants 1 arg])
1000 + [bio_end_io_t wants 1 arg])
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.
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>
1017 struct bio bio __attribute__ ((unused));
1018 blk_status_t status __attribute__ ((unused)) = BLK_STS_OK;
1020 bio.bi_status = status;
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], [
1029 AC_DEFINE(HAVE_BIO_BI_STATUS, 1, [bio->bi_status exists])
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}
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>
1047 int flags __attribute__ ((unused));
1048 flags = ((1 << BIO_RW_FAILFAST_DEV) |
1049 (1 << BIO_RW_FAILFAST_TRANSPORT) |
1050 (1 << BIO_RW_FAILFAST_DRIVER));
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], [
1059 AC_DEFINE(HAVE_BIO_RW_FAILFAST_DTD, 1,
1060 - [BIO_RW_FAILFAST_* are defined])
1061 + [BIO_RW_FAILFAST_* are defined])
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>
1074 int flags __attribute__ ((unused));
1075 flags = REQ_FAILFAST_MASK;
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], [
1084 AC_DEFINE(HAVE_REQ_FAILFAST_MASK, 1,
1085 - [REQ_FAILFAST_MASK is defined])
1086 + [REQ_FAILFAST_MASK is defined])
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
1097 +AC_DEFUN([ZFS_AC_KERNEL_BIO_FAILFAST], [
1098 + ZFS_AC_KERNEL_BIO_FAILFAST_DTD
1099 + ZFS_AC_KERNEL_REQ_FAILFAST_MASK
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.
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>
1116 int op __attribute__ ((unused)) = REQ_OP_DISCARD;
1119 + ZFS_LINUX_TEST_SRC([req_op_secure_erase], [
1120 + #include <linux/blk_types.h>
1122 + int op __attribute__ ((unused)) = REQ_OP_SECURE_ERASE;
1125 + ZFS_LINUX_TEST_SRC([req_op_flush], [
1126 + #include <linux/blk_types.h>
1128 + int op __attribute__ ((unused)) = REQ_OP_FLUSH;
1131 + ZFS_LINUX_TEST_SRC([bio_bi_opf], [
1132 + #include <linux/bio.h>
1134 + struct bio bio __attribute__ ((unused));
1138 + ZFS_LINUX_TEST_SRC([bio_set_op_attrs], [
1139 + #include <linux/bio.h>
1141 + struct bio *bio __attribute__ ((unused)) = NULL;
1142 + bio_set_op_attrs(bio, 0, 0);
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], [
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], [
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>
1159 - int op __attribute__ ((unused)) = REQ_OP_SECURE_ERASE;
1161 + ZFS_LINUX_TEST_RESULT([req_op_secure_erase], [
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], [
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>
1172 - int op __attribute__ ((unused)) = REQ_OP_FLUSH;
1174 + ZFS_LINUX_TEST_RESULT([req_op_flush], [
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])
1182 @@ -53,12 +74,7 @@ AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_FLUSH], [
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>
1189 - struct bio bio __attribute__ ((unused));
1192 + ZFS_LINUX_TEST_RESULT([bio_bi_opf], [
1194 AC_DEFINE(HAVE_BIO_BI_OPF, 1, [bio->bi_opf is defined])
1196 @@ -68,13 +84,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_OPF], [
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>
1203 - struct bio *bio __attribute__ ((unused)) = NULL;
1205 - bio_set_op_attrs(bio, 0, 0);
1207 + ZFS_LINUX_TEST_RESULT([bio_set_op_attrs], [
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], [
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
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
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([
1242 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_BARRIER], [
1243 + ZFS_LINUX_TEST_SRC([bio_rw_barrier], [
1244 #include <linux/bio.h>
1246 int flags __attribute__ ((unused));
1247 flags = BIO_RW_BARRIER;
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], [
1256 AC_DEFINE(HAVE_BIO_RW_BARRIER, 1, [BIO_RW_BARRIER is defined])
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
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([
1277 +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_DISCARD], [
1278 + ZFS_LINUX_TEST_SRC([bio_rw_discard], [
1279 #include <linux/bio.h>
1281 int flags __attribute__ ((unused));
1282 flags = BIO_RW_DISCARD;
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], [
1291 AC_DEFINE(HAVE_BIO_RW_DISCARD, 1, [BIO_RW_DISCARD is defined])
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,
1299 dnl # The bio_set_dev() helper macro was introduced as part of the transition
1300 dnl # to have struct gendisk in struct bio.
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>
1308 - struct block_device *bdev = NULL;
1309 - struct bio *bio = NULL;
1310 - bio_set_dev(bio, bdev);
1312 - AC_MSG_RESULT(yes)
1313 - AC_DEFINE(HAVE_BIO_SET_DEV, 1, [bio_set_dev() exists])
1320 dnl # Linux 5.0 API,
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.
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");
1335 struct block_device *bdev = NULL;
1336 struct bio *bio = NULL;
1337 bio_set_dev(bio, bdev);
1341 - AC_MSG_RESULT(yes)
1342 - AC_DEFINE(HAVE_BIO_SET_DEV_GPL_ONLY, 1,
1343 - [bio_set_dev() GPL-only])
1345 + ], [], [$ZFS_META_LICENSE])
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])
1356 + AC_MSG_CHECKING([whether bio_set_dev() is GPL-only])
1357 + ZFS_LINUX_TEST_RESULT([bio_set_dev_license], [
1360 + AC_MSG_RESULT(yes)
1361 + AC_DEFINE(HAVE_BIO_SET_DEV_GPL_ONLY, 1,
1362 + [bio_set_dev() GPL-only])
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
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>
1383 struct request_queue q;
1384 struct backing_dev_info bdi;
1385 q.backing_dev_info = &bdi;
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], [
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()
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>
1411 struct request_queue *q __attribute__ ((unused)) = NULL;
1412 int value __attribute__ ((unused));
1414 value = blk_queue_discard(q);
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], [
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
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>
1436 struct request_queue *q __attribute__ ((unused)) = NULL;
1437 int value __attribute__ ((unused));
1439 value = blk_queue_secure_erase(q);
1442 + ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [
1443 + #include <linux/blkdev.h>
1445 + struct request_queue *q __attribute__ ((unused)) = NULL;
1446 + int value __attribute__ ((unused));
1447 + value = blk_queue_secdiscard(q);
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], [
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], [
1460 AC_MSG_CHECKING([whether blk_queue_secdiscard() is available])
1461 - ZFS_LINUX_TRY_COMPILE([
1462 - #include <linux/blkdev.h>
1464 - struct request_queue *q __attribute__ ((unused)) = NULL;
1465 - int value __attribute__ ((unused));
1467 - value = blk_queue_secdiscard(q);
1469 + ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [
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
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>
1490 struct request_queue *q = NULL;
1491 blk_queue_flag_set(0, q);
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], [
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])
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>
1516 struct request_queue *q = NULL;
1517 blk_queue_flag_clear(0, q);
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], [
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])
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
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
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.
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>
1561 struct request_queue *q = NULL;
1562 (void) blk_queue_flush(q, REQ_FLUSH);
1564 + ], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE])
1566 + ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [
1567 + #include <linux/kernel.h>
1568 + #include <linux/blkdev.h>
1570 + struct request_queue *q = NULL;
1571 + blk_queue_write_cache(q, true, true);
1572 + ], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE])
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], [
1579 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1,
1580 - [blk_queue_flush() is available])
1581 + [blk_queue_flush() is available])
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>
1588 - MODULE_LICENSE("$ZFS_META_LICENSE");
1590 - struct request_queue *q = NULL;
1591 - (void) blk_queue_flush(q, REQ_FLUSH);
1593 + ZFS_LINUX_TEST_RESULT([blk_queue_flush_license], [
1597 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1,
1598 - [blk_queue_flush() is GPL-only])
1599 + [blk_queue_flush() is GPL-only])
1603 @@ -48,38 +50,20 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
1604 dnl # Replace blk_queue_flush with blk_queue_write_cache
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>
1612 - struct request_queue *q = NULL;
1613 - blk_queue_write_cache(q, true, true);
1615 + ZFS_LINUX_TEST_RESULT([blk_queue_write_cache], [
1617 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1,
1618 - [blk_queue_write_cache() exists])
1619 + [blk_queue_write_cache() exists])
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>
1627 - MODULE_LICENSE("$ZFS_META_LICENSE");
1629 - struct request_queue *q = NULL;
1630 - blk_queue_write_cache(q, true, true);
1632 + ZFS_LINUX_TEST_RESULT([blk_queue_write_cache_license], [
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])
1644 - EXTRA_KCFLAGS="$tmp_flags"
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().
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>
1664 struct request_queue *q = NULL;
1665 (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS);
1667 + ], [$NO_UNUSED_BUT_SET_VARIABLE])
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], [
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])
1680 - EXTRA_KCFLAGS="$tmp_flags"
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().
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>
1700 struct request_queue *q = NULL;
1701 (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS);
1703 + ], [$NO_UNUSED_BUT_SET_VARIABLE])
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], [
1710 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
1711 - [blk_queue_max_segments() is available])
1713 + [blk_queue_max_segments() is available])
1717 - EXTRA_KCFLAGS="$tmp_flags"
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.
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>
1736 - extern enum bio_rw_flags rw;
1737 + enum bio_rw_flags rw __attribute__ ((unused)) = BIO_RW_UNPLUG;
1741 - rw = BIO_RW_UNPLUG;
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], [
1747 AC_DEFINE(HAVE_BLK_QUEUE_HAVE_BIO_RW_UNPLUG, 1,
1748 - [BIO_RW_UNPLUG is available])
1749 + [BIO_RW_UNPLUG is available])
1753 - EXTRA_KCFLAGS="$tmp_flags"
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>
1765 - struct blk_plug plug;
1766 + struct blk_plug plug __attribute__ ((unused));
1768 blk_start_plug(&plug);
1769 blk_finish_plug(&plug);
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], [
1778 AC_DEFINE(HAVE_BLK_QUEUE_HAVE_BLK_PLUG, 1,
1779 - [struct blk_plug is available])
1780 + [struct blk_plug is available])
1784 - EXTRA_KCFLAGS="$tmp_flags"
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
1792 +AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_PLUG], [
1793 + ZFS_AC_KERNEL_BIO_RW_UNPLUG
1794 + ZFS_AC_KERNEL_BLK_PLUG
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()
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>
1811 blkdev_get_by_path(NULL, 0, NULL);
1812 - ], [blkdev_get_by_path], [fs/block_dev.c], [
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], [
1821 AC_DEFINE(HAVE_BLKDEV_GET_BY_PATH, 1,
1822 - [blkdev_get_by_path() is available])
1823 + [blkdev_get_by_path() is available])
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.
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>
1842 struct block_device *bdev = NULL;
1845 error = blkdev_reread_part(bdev);
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], [
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
1862 dnl # 2.6.38 API change
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>
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,
1880 + ], [], [$NO_UNUSED_BUT_SET_VARIABLE])
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], [
1887 AC_DEFINE(HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS, 1,
1888 [bops->check_events() exists])
1892 - EXTRA_KCFLAGS="$tmp_flags"
1896 dnl # 3.10.x API change
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>
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], [
1910 .compat_ioctl = NULL,
1914 - AC_MSG_RESULT(void)
1915 + ], [], [$NO_UNUSED_BUT_SET_VARIABLE])
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])
1925 - AC_MSG_RESULT(int)
1928 - EXTRA_KCFLAGS="$tmp_flags"
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
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
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.
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>
1956 - ], [clear_inode], [fs/inode.c], [
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], [
1965 AC_DEFINE(HAVE_CLEAR_INODE, 1, [clear_inode() is available])
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().
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,
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], [
1994 AC_DEFINE(HAVE_COMMIT_METADATA, 1,
1995 - [eops->commit_metadata() exists])
1996 + [eops->commit_metadata() exists])
2000 diff --git a/config/kernel-config-defined.m4 b/config/kernel-config-defined.m4
2001 new file mode 100644
2002 index 000000000..0ee4231cc
2004 +++ b/config/kernel-config-defined.m4
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.
2011 +AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [
2012 + AS_IF([test "x$cross_compiling" != xyes], [
2015 + #include "$LINUX/include/linux/license.h"
2017 + return !license_is_gpl_compatible(
2018 + "$ZFS_META_LICENSE");
2021 + AC_DEFINE([ZFS_IS_GPL_COMPATIBLE], [1],
2022 + [Define to 1 if GPL-only symbols can be used])
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
2033 + AC_MSG_CHECKING([for kernel config option compatibility])
2034 + ZFS_LINUX_TEST_COMPILE_ALL([config])
2035 + AC_MSG_RESULT([done])
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
2045 +dnl # Check configured THREAD_SIZE
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
2053 +AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_THREAD_SIZE], [
2054 + ZFS_LINUX_TEST_SRC([config_thread_size], [
2055 + #include <linux/module.h>
2057 + #if (THREAD_SIZE < 16384)
2058 + #error "THREAD_SIZE is less than 16K"
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])
2069 + AC_MSG_RESULT([no])
2074 +dnl # Check CONFIG_DEBUG_LOCK_ALLOC
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.
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.
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>
2089 + struct mutex lock;
2091 + mutex_init(&lock);
2092 + mutex_lock(&lock);
2093 + mutex_unlock(&lock);
2094 + ], [], [$ZFS_META_LICENSE])
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], [
2102 + AC_MSG_RESULT(yes)
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.])
2112 +dnl # Check CONFIG_TRIM_UNUSED_KSYMS
2114 +dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled.
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
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])
2129 + AC_MSG_RESULT([no])
2130 + AS_IF([test "x$enable_linux_builtin" != xyes], [
2132 + *** This kernel has unused symbols trimming enabled, please disable.
2133 + *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
2139 +dnl # Check CONFIG_ZLIB_INFLATE
2141 +dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
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
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])
2157 + AC_MSG_RESULT([no])
2159 + *** This kernel does not include the required zlib inflate support.
2160 + *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
2165 +dnl # Check CONFIG_ZLIB_DEFLATE
2167 +dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
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
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])
2183 + AC_MSG_RESULT([no])
2185 + *** This kernel does not include the required zlib deflate support.
2186 + *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
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
2195 dnl # 3.6 API change
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>
2205 @@ -19,11 +18,15 @@ AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
2206 iops __attribute__ ((unused)) = {
2207 .create = inode_create,
2214 +AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
2215 + AC_MSG_CHECKING([whether iops->create() passes nameidata])
2216 + ZFS_LINUX_TEST_RESULT([create_nameidata], [
2218 AC_DEFINE(HAVE_CREATE_NAMEIDATA, 1,
2219 - [iops->create() passes nameidata])
2220 + [iops->create() passes nameidata])
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.
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>
2239 struct ctl_table ctl __attribute__ ((unused));
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], [
2249 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
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
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>
2266 struct inode ip __attribute__ ((unused));
2267 ip.i_atime = current_time(&ip);
2268 - ], [current_time], [fs/inode.c], [
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], [
2277 AC_DEFINE(HAVE_CURRENT_TIME, 1, [current_time() exists])
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.
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>
2295 current->bio_tail = (struct bio **) NULL;
2299 + ZFS_LINUX_TEST_SRC([current_bio_list], [
2300 + #include <linux/sched.h>
2302 + current->bio_list = (struct bio_list *) NULL;
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], [
2310 AC_DEFINE(HAVE_CURRENT_BIO_TAIL, 1,
2311 [current->bio_tail exists])
2315 AC_MSG_CHECKING([whether current->bio_list exists])
2316 - ZFS_LINUX_TRY_COMPILE([
2317 - #include <linux/sched.h>
2319 - current->bio_list = (struct bio_list *) NULL;
2321 + ZFS_LINUX_TEST_RESULT([current_bio_list], [
2323 AC_DEFINE(HAVE_CURRENT_BIO_LIST, 1,
2324 [current->bio_list exists])
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])
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
2339 -dnl # 3.4.0 API change
2340 -dnl # Added d_make_root() to replace previous d_alloc_root() function.
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>
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])
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
2362 -dnl # 2.6.28 API change
2363 -dnl # Added d_obtain_alias() helper function.
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>
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])
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
2386 -dnl # 2.6.12 API change
2387 -dnl # d_prune_aliases() helper function available.
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>
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])
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.
2411 AC_DEFUN([ZFS_AC_KERNEL_DECLARE_EVENT_CLASS], [
2412 - tmp_flags="$EXTRA_KCFLAGS"
2413 - EXTRA_KCFLAGS="-I\$(src)"
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");
2421 #define CREATE_TRACE_POINTS
2422 #include "conftest.h"
2423 @@ -18,7 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_DECLARE_EVENT_CLASS], [
2426 AC_DEFINE(HAVE_DECLARE_EVENT_CLASS, 1,
2427 - [DECLARE_EVENT_CLASS() is available])
2428 + [DECLARE_EVENT_CLASS() is available])
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>
2436 - EXTRA_KCFLAGS="$tmp_flags"
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
2444 +dnl # 3.4.0 API change
2445 +dnl # Added d_make_root() to replace previous d_alloc_root() function.
2447 +AC_DEFUN([ZFS_AC_KERNEL_SRC_D_MAKE_ROOT], [
2448 + ZFS_LINUX_TEST_SRC([d_make_root], [
2449 + #include <linux/dcache.h>
2451 + d_make_root(NULL);
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])
2467 +dnl # 2.6.28 API change
2468 +dnl # Added d_obtain_alias() helper function.
2470 +AC_DEFUN([ZFS_AC_KERNEL_SRC_D_OBTAIN_ALIAS], [
2471 + ZFS_LINUX_TEST_SRC([d_obtain_alias], [
2472 + #include <linux/dcache.h>
2474 + d_obtain_alias(NULL);
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])
2491 +dnl # 2.6.12 API change
2492 +dnl # d_prune_aliases() helper function available.
2494 +AC_DEFUN([ZFS_AC_KERNEL_SRC_D_PRUNE_ALIASES], [
2495 + ZFS_LINUX_TEST_SRC([d_prune_aliases], [
2496 + #include <linux/dcache.h>
2498 + struct inode *ip = NULL;
2499 + d_prune_aliases(ip);
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])
2516 +dnl # 2.6.38 API change
2517 +dnl # Added d_set_d_op() helper function.
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>
2523 + d_set_d_op(NULL, NULL);
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])
2539 dnl # 3.6 API change
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>
2549 @@ -14,11 +108,15 @@ AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [
2550 dops __attribute__ ((unused)) = {
2551 .d_revalidate = revalidate,
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], [
2562 AC_DEFINE(HAVE_D_REVALIDATE_NAMEIDATA, 1,
2563 - [dops->d_revalidate() operation takes nameidata])
2564 + [dops->d_revalidate() operation takes nameidata])
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.
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>
2579 const struct dentry_operations test_d_op = {
2580 @@ -38,32 +135,17 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [
2583 struct dentry d __attribute__ ((unused));
2585 d.d_op = &test_d_op;
2587 - AC_MSG_RESULT(yes)
2588 - AC_DEFINE(HAVE_CONST_DENTRY_OPERATIONS, 1,
2589 - [dentry uses const struct dentry_operations])
2596 -dnl # 2.6.38 API change
2597 -dnl # Added d_set_d_op() helper function.
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>
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], [
2610 - AC_DEFINE(HAVE_D_SET_D_OP, 1,
2611 - [d_set_d_op() is available])
2613 + AC_DEFINE(HAVE_CONST_DENTRY_OPERATIONS, 1,
2614 + [dentry uses const struct dentry_operations])
2619 @@ -72,17 +154,41 @@ dnl #
2620 dnl # 2.6.38 API chage
2621 dnl # Added sb->s_d_op default dentry_operations member
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>
2630 struct super_block sb __attribute__ ((unused));
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], [
2640 AC_DEFINE(HAVE_S_D_OP, 1, [struct super_block has s_d_op])
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
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
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.
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>
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,
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])
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.
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>
2715 struct queue_limits ql __attribute__ ((unused));
2717 ql.discard_granularity = 0;
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], [
2726 AC_DEFINE(HAVE_DISCARD_GRANULARITY, 1,
2727 - [ql->discard_granularity is available])
2728 + [ql->discard_granularity is available])
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
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>
2751 struct request_queue *q = NULL;
2752 char *elevator = NULL;
2753 - ret = elevator_change(q, elevator);
2755 + int error __attribute__ ((unused)) =
2756 + elevator_change(q, elevator);
2760 +AC_DEFUN([ZFS_AC_KERNEL_ELEVATOR_CHANGE], [
2761 + AC_MSG_CHECKING([whether elevator_change() is available])
2762 + ZFS_LINUX_TEST_RESULT([elevator_change], [
2764 AC_DEFINE(HAVE_ELEVATOR_CHANGE, 1,
2765 - [elevator_change() is available])
2766 + [elevator_change() is available])
2770 - EXTRA_KCFLAGS="$tmp_flags"
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.
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,
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], [
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])
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.
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,
2829 +AC_DEFUN([ZFS_AC_KERNEL_EVICT_INODE], [
2830 + AC_MSG_CHECKING([whether sops->evict_inode() exists])
2831 + ZFS_LINUX_TEST_RESULT([evict_inode], [
2833 AC_DEFINE(HAVE_EVICT_INODE, 1, [sops->evict_inode() exists])
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
2842 -dnl # PaX Linux 2.6.38 - 3.x API
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>
2849 - long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
2850 - struct file_operations_no_const fops __attribute__ ((unused)) = {
2851 - .fallocate = fallocate,
2854 - AC_MSG_RESULT(yes)
2855 - AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
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
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.
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], [
2875 + dnl # Linux 2.6.38 - 3.x API
2876 + ZFS_LINUX_TEST_SRC([file_fallocate], [
2877 #include <linux/fs.h>
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,
2886 - AC_MSG_RESULT(yes)
2887 - AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
2895 -dnl # Linux 2.6.x - 2.6.37 API
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>
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,
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])
2922 + AC_MSG_CHECKING([whether iops->fallocate() exists])
2923 + ZFS_LINUX_TEST_RESULT([inode_fallocate], [
2925 AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
2932 -dnl # The fallocate callback was moved from the inode_operations
2933 -dnl # structure to the file_operations structure.
2935 -AC_DEFUN([ZFS_AC_KERNEL_FALLOCATE], [
2936 - ZFS_AC_KERNEL_FILE_FALLOCATE
2937 - ZFS_AC_KERNEL_INODE_FALLOCATE
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").
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>
2954 struct file *f = NULL;
2960 +AC_DEFUN([ZFS_AC_KERNEL_FILE_DENTRY], [
2961 + AC_MSG_CHECKING([whether file_dentry() is available])
2962 + ZFS_LINUX_TEST_RESULT([file_dentry], [
2964 AC_DEFINE(HAVE_FILE_DENTRY, 1, [file_dentry() is available])
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
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>
2981 struct file *f = NULL;
2987 +AC_DEFUN([ZFS_AC_KERNEL_FILE_INODE], [
2988 + AC_MSG_CHECKING([whether file_inode() is available])
2989 + ZFS_LINUX_TEST_RESULT([file_inode], [
2991 AC_DEFINE(HAVE_FILE_INODE, 1, [file_inode() is available])
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
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>
3008 fmode_t *ptr __attribute__ ((unused));
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])
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.
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>
3038 struct path *p = NULL;
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], [
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
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.
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], [
3070 AC_MSG_RESULT(i387.h & xcr.h)
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>
3082 #include <asm/i387.h>
3083 #include <asm/xcr.h>
3085 - MODULE_LICENSE("$ZFS_META_LICENSE");
3090 - ], [kernel_fpu_begin], [arch/x86/kernel/fpu/core.c], [
3091 + ], [], [$ZFS_META_LICENSE])
3093 + ZFS_LINUX_TEST_SRC([__kernel_fpu], [
3094 + #ifdef HAVE_KERNEL_FPU_API_HEADER
3095 + #include <asm/fpu/api.h>
3097 + #include <asm/i387.h>
3098 + #include <asm/xcr.h>
3101 + __kernel_fpu_begin();
3102 + __kernel_fpu_end();
3103 + ], [], [$ZFS_META_LICENSE])
3105 + ZFS_LINUX_TEST_SRC([fpu_initialized], [
3106 + #include <linux/module.h>
3107 + #include <linux/sched.h>
3109 + struct fpu *fpu = ¤t->thread.fpu;
3110 + if (fpu->initialized) { return (0); };
3113 + ZFS_LINUX_TEST_SRC([tif_need_fpu_load], [
3114 + #include <linux/module.h>
3115 + #include <asm/thread_info.h>
3117 + #if !defined(TIF_NEED_FPU_LOAD)
3118 + #error "TIF_NEED_FPU_LOAD undefined"
3123 +AC_DEFUN([ZFS_AC_KERNEL_FPU], [
3125 + dnl # Legacy kernel
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])
3136 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
3137 - #include <linux/module.h>
3138 - #ifdef HAVE_KERNEL_FPU_API_HEADER
3139 - #include <asm/fpu/api.h>
3141 - #include <asm/i387.h>
3142 - #include <asm/xcr.h>
3144 - MODULE_LICENSE("$ZFS_META_LICENSE");
3146 - __kernel_fpu_begin();
3147 - __kernel_fpu_end();
3148 - ], [__kernel_fpu_begin], [arch/x86/kernel/fpu/core.c arch/x86/kernel/i387.c], [
3150 + dnl # Linux 4.2 kernel
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])
3161 - ZFS_LINUX_TRY_COMPILE([
3162 - #include <linux/module.h>
3163 - #include <linux/sched.h>
3165 - struct fpu *fpu = ¤t->thread.fpu;
3166 - if (fpu->initialized) { return (0); };
3169 + dnl # Linux 5.0 kernel
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])
3176 - ZFS_LINUX_TRY_COMPILE([
3177 - #include <linux/module.h>
3178 - #include <asm/thread_info.h>
3180 - #if !defined(TIF_NEED_FPU_LOAD)
3181 - #error "TIF_NEED_FPU_LOAD undefined"
3186 + dnl # Linux 5.2 kernel
3188 + ZFS_LINUX_TEST_RESULT([tif_need_fpu_load], [
3189 AC_MSG_RESULT(TIF_NEED_FPU_LOAD)
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.
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>
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)) = {
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], [
3221 AC_DEFINE(HAVE_FST_MOUNT, 1, [fst->mount() exists])
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
3229 -dnl # Linux 2.6.x - 2.6.34 API
3230 +dnl # Check file_operations->fsync interface.
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>
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,
3245 - AC_MSG_RESULT([dentry])
3246 - AC_DEFINE(HAVE_FSYNC_WITH_DENTRY, 1,
3247 - [fops->fsync() with dentry])
3254 -dnl # Linux 2.6.35 - Linux 3.0 API
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>
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,
3268 - AC_MSG_RESULT([no dentry])
3269 - AC_DEFINE(HAVE_FSYNC_WITHOUT_DENTRY, 1,
3270 - [fops->fsync() without dentry])
3277 -dnl # Linux 3.1 - 3.x API
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>
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,
3291 - AC_MSG_RESULT([range])
3292 - AC_DEFINE(HAVE_FSYNC_RANGE, 1,
3293 - [fops->fsync() with range])
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
3305 + dnl # Linux 2.6.x - 2.6.34 API
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])
3313 + AC_MSG_RESULT([no])
3316 + dnl # Linux 2.6.35 - Linux 3.0 API
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])
3324 + AC_MSG_RESULT([no])
3327 + dnl # Linux 3.1 - 3.x API
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])
3335 + ZFS_LINUX_TEST_ERROR([fops->fsync])
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
3346 -dnl # 3.19 API addition
3347 +dnl # Check for generic io accounting interface.
3349 -dnl # torvalds/linux@394ffa503bc40e32d7f54a9b817264e81ce131b4 allows us to
3350 -dnl # increment iostat counters without generic_make_request().
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>
3359 void (*generic_start_io_acct_f)(int, unsigned long,
3360 @@ -16,24 +12,9 @@ AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT_3ARG], [
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])
3374 -dnl # Linux 4.14 API,
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
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>
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], [
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], [
3394 +AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [
3396 + dnl # 3.19 API addition
3398 + dnl # torvalds/linux@394ffa50 allows us to increment iostat
3399 + dnl # counters without generic_make_request().
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], [
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])
3413 + dnl # Linux 4.14 API,
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.
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])
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.
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>
3446 int i __attribute__ ((unused));
3448 i = generic_readlink(NULL, NULL, 0);
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])
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.
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>
3478 struct gendisk *disk = NULL;
3479 (void) get_disk_and_module(disk);
3480 - ], [get_disk_and_module], [block/genhd.c], [
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], [
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
3497 dnl # 2.6.x API change
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>
3508 struct gendisk *disk = NULL;
3509 (void) get_disk_ro(disk);
3511 + ], [$NO_UNUSED_BUT_SET_VARIABLE])
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], [
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])
3524 - EXTRA_KCFLAGS="$tmp_flags"
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
3532 dnl # Supported get_link() interfaces checked newest to oldest.
3533 +dnl # Note this interface used to be named follow_link.
3535 -AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_LINK], [
3537 - dnl # 4.2 API change
3538 - dnl # - This kernel retired the nameidata structure.
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,
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,
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,
3573 - AC_MSG_RESULT(yes)
3574 - AC_DEFINE(HAVE_FOLLOW_LINK_COOKIE, 1,
3575 - [iops->follow_link() cookie])
3582 - [whether iops->follow_link() passes nameidata])
3583 - ZFS_LINUX_TRY_COMPILE([
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,
3596 - AC_MSG_RESULT(yes)
3597 - AC_DEFINE(HAVE_FOLLOW_LINK_NAMEIDATA, 1,
3598 - [iops->follow_link() nameidata])
3600 - AC_MSG_ERROR(no; please file a bug report)
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,
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.
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,
3627 + ZFS_LINUX_TEST_RESULT([inode_operations_get_link], [
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])
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.
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,
3654 + ZFS_LINUX_TEST_RESULT([inode_operations_get_link_cookie], [
3656 AC_DEFINE(HAVE_GET_LINK_COOKIE, 1,
3657 [iops->get_link() cookie])
3662 - dnl # Check for the follow_link APIs.
3663 + dnl # 4.2 API change
3664 + dnl # This kernel retired the nameidata structure.
3667 - ZFS_AC_KERNEL_FOLLOW_LINK
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])
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])
3688 + ZFS_LINUX_TEST_ERROR([get_link])
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
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>
3710 (void) global_node_page_state(0);
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], [
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])
3725 @@ -24,16 +29,21 @@ dnl # 4.14 API change
3727 dnl # c41f012ade0b mm: rename global_page_state to global_zone_page_state
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>
3737 (void) global_zone_page_state(0);
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], [
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])
3752 @@ -44,9 +54,11 @@ dnl # Create a define and autoconf variable for an enum member
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
3766 @@ -59,8 +71,7 @@ dnl #
3767 AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR],[
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])
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], [
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.
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])
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], [
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
3799 dnl # enum members in which we're interested
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
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])
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])
3831 ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY
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
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>
3850 struct group_info *gi = groups_alloc(1);
3851 gi->gid[0] = KGIDT_INIT(0);
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], [
3860 AC_DEFINE(HAVE_GROUP_INFO_GID, 1, [group_info->gid exists])
3864 - EXTRA_KCFLAGS="$tmp_flags"
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.
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>
3881 in_compat_syscall();
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], [
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
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>
3908 @@ -16,24 +15,9 @@ AC_DEFUN([ZFS_AC_PATH_KERNEL_IOPS_GETATTR], [
3909 iops __attribute__ ((unused)) = {
3910 .getattr = test_getattr,
3914 - AC_MSG_RESULT(yes)
3915 - AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
3916 - [iops->getattr() takes a path])
3926 -dnl # Linux 3.9 - 4.10 API
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>
3935 @@ -45,23 +29,25 @@ AC_DEFUN([ZFS_AC_VFSMOUNT_KERNEL_IOPS_GETATTR], [
3936 iops __attribute__ ((unused)) = {
3937 .getattr = test_getattr,
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], [
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])
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.
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])
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.
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>
3993 struct inode *inode = NULL;
3994 inode_lock_shared(inode);
3999 +AC_DEFUN([ZFS_AC_KERNEL_INODE_LOCK], [
4000 + AC_MSG_CHECKING([whether inode_lock_shared() exists])
4001 + ZFS_LINUX_TEST_RESULT([inode_lock], [
4003 AC_DEFINE(HAVE_INODE_LOCK_SHARED, 1, [yes])
4007 - EXTRA_KCFLAGS="$tmp_flags"
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
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>
4025 inode_set_flags(&inode, S_IMMUTABLE, S_IMMUTABLE);
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], [
4034 AC_DEFINE(HAVE_INODE_SET_FLAGS, 1, [inode_set_flags() exists])
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
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>
4052 inode_set_iversion(&inode, 1);
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], [
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.
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>
4081 @@ -14,12 +11,16 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
4083 memset(&ip, 0, sizeof(ip));
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], [
4095 AC_DEFINE(HAVE_INODE_TIMESPEC64_TIMES, 1,
4096 [inode->i_*time's are timespec64])
4098 - EXTRA_KCFLAGS="$tmp_flags"
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.
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>
4115 insert_inode_locked(NULL);
4116 - ], [insert_inode_locked], [fs/inode.c], [
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], [
4125 AC_DEFINE(HAVE_INSERT_INODE_LOCKED, 1,
4126 - [insert_inode_locked() is available])
4127 + [insert_inode_locked() is available])
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.
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>
4146 struct block_device *bdev = NULL;
4147 invalidate_bdev(bdev);
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], [
4156 AC_DEFINE(HAVE_1ARG_INVALIDATE_BDEV, 1,
4157 - [invalidate_bdev() wants 1 arg])
4158 + [invalidate_bdev() wants 1 arg])
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
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>
4177 struct inode *ip = NULL;
4178 (void) inode_owner_or_capable(ip);
4182 + ZFS_LINUX_TEST_SRC([is_owner_or_cap], [
4183 + #include <linux/fs.h>
4184 + #include <linux/sched.h>
4186 + struct inode *ip = NULL;
4187 + (void) is_owner_or_cap(ip);
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], [
4195 AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
4196 [inode_owner_or_capable() exists])
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>
4204 - struct inode *ip = NULL;
4205 - (void) is_owner_or_cap(ip);
4208 + ZFS_LINUX_TEST_RESULT([is_owner_or_cap], [
4210 AC_DEFINE(HAVE_IS_OWNER_OR_CAP, 1,
4211 [is_owner_or_cap() exists])
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])
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.
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>
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], [
4244 AC_DEFINE(HAVE_1ARG_KMAP_ATOMIC, 1,
4245 - [kmap_atomic wants 1 args])
4246 + [kmap_atomic wants 1 args])
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.
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>
4265 struct kmem_cache cachep __attribute__ ((unused));
4266 cachep.allocflags = GFP_KERNEL;
4269 + ZFS_LINUX_TEST_SRC([kmem_cache_gfpflags], [
4270 + #include <linux/slab.h>
4272 + struct kmem_cache cachep __attribute__ ((unused));
4273 + cachep.gfpflags = GFP_KERNEL;
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], [
4281 AC_DEFINE(HAVE_KMEM_CACHE_ALLOCFLAGS, 1,
4282 - [struct kmem_cache has allocflags])
4283 + [struct kmem_cache has allocflags])
4287 AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
4288 - ZFS_LINUX_TRY_COMPILE([
4289 - #include <linux/slab.h>
4291 - struct kmem_cache cachep __attribute__ ((unused));
4292 - cachep.gfpflags = GFP_KERNEL;
4294 + ZFS_LINUX_TEST_RESULT([kmem_cache_gfpflags], [
4296 AC_DEFINE(HAVE_KMEM_CACHE_GFPFLAGS, 1,
4297 - [struct kmem_cache has gfpflags])
4298 + [struct kmem_cache has gfpflags])
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().
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)
4318 + static void ctor(void *foo) { /* fake ctor */ }
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;
4325 skc_linux_cache = kmem_cache_create_usercopy(
4326 - name, size, align, flags, useroffset, usersize, ctor);
4328 + name, size, align, flags, useroffset, usersize, ctor);
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], [
4336 AC_DEFINE(HAVE_KMEM_CACHE_CREATE_USERCOPY, 1,
4337 - [kmem_cache_create_usercopy() exists])
4338 + [kmem_cache_create_usercopy() exists])
4342 - EXTRA_KCFLAGS="$tmp_flags"
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
4350 +AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE], [
4351 + ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS
4352 + ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY
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
4360 dnl # 2.6.39 API change
4362 -dnl # 33ee3b2e2eb9 kstrto*: converting strings to integers done (hopefully) right
4364 dnl # If kstrtoul() doesn't exist, fallback to use strict_strtoul() which has
4365 dnl # existed since 2.6.25.
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>
4374 int ret __attribute__ ((unused)) = kstrtoul(NULL, 10, NULL);
4379 +AC_DEFUN([ZFS_AC_KERNEL_KSTRTOUL], [
4380 + AC_MSG_CHECKING([whether kstrtoul() exists])
4381 + ZFS_LINUX_TEST_RESULT([kstrtoul], [
4383 AC_DEFINE(HAVE_KSTRTOUL, 1, [kstrtoul() exists])
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().
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>
4400 struct timespec64 ts;
4401 ktime_get_coarse_real_ts64(&ts);
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], [
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])
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.
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>
4431 struct inode *ip = NULL;
4432 (void) i_uid_read(ip);
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], [
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
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>
4458 kuid_t userid __attribute__ ((unused)) = KUIDT_INIT(0);
4459 kgid_t groupid __attribute__ ((unused)) = KGIDT_INIT(0);
4461 - ZFS_LINUX_TRY_COMPILE([
4462 - #include <linux/uidgid.h>
4464 - kuid_t userid __attribute__ ((unused)) = 0;
4465 - kgid_t groupid __attribute__ ((unused)) = 0;
4469 + ZFS_LINUX_TEST_SRC([kuidgid_t], [
4470 + #include <linux/uidgid.h>
4472 + kuid_t userid __attribute__ ((unused)) = 0;
4473 + kgid_t groupid __attribute__ ((unused)) = 0;
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)
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.
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>
4500 - ], [lookup_bdev], [fs/block_dev.c], [
4503 + ZFS_LINUX_TEST_SRC([lookup_bdev_2args], [
4504 + #include <linux/fs.h>
4506 + lookup_bdev(NULL, FMODE_READ);
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], [
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])
4521 AC_MSG_CHECKING([whether lookup_bdev() wants 2 args])
4522 - ZFS_LINUX_TRY_COMPILE_SYMBOL([
4523 - #include <linux/fs.h>
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], [
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],
4537 \ No newline at end of file
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
4545 dnl # 3.6 API change
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>
4555 @@ -15,11 +14,15 @@ AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
4556 __attribute__ ((unused)) = {
4557 .lookup = inode_lookup,
4564 +AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
4565 + AC_MSG_CHECKING([whether iops->lookup() passes nameidata])
4566 + ZFS_LINUX_TEST_RESULT([lookup_nameidata], [
4568 AC_DEFINE(HAVE_LOOKUP_NAMEIDATA, 1,
4569 - [iops->lookup() passes nameidata])
4570 + [iops->lookup() passes nameidata])
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
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>
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;
4593 lseek_execute(fp, ip, offset, maxsize);
4594 - ], [lseek_exclusive], [fs/read_write.c], [
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], [
4603 - AC_DEFINE(HAVE_LSEEK_EXECUTE, 1,
4604 - [lseek_execute() is available])
4605 + AC_DEFINE(HAVE_LSEEK_EXECUTE, 1, [lseek_execute() is available])
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
4613 +++ b/config/kernel-make-request-fn.m4
4616 +dnl # Check for make_request_fn interface.
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); }
4624 + blk_queue_make_request(NULL, &make_request);
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; }
4632 + blk_queue_make_request(NULL, &make_request);
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); }
4640 + blk_queue_make_request(NULL, &make_request);
4644 +AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [
4647 + dnl # make_request_fn returns int.
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])
4660 + dnl # Linux 3.2 API Change
4661 + dnl # make_request_fn returns void.
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])
4674 + dnl # Linux 4.4 API Change
4675 + dnl # make_request_fn returns blk_qc_t.
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])
4687 + ZFS_LINUX_TEST_ERROR([make_request_fn])
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.
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])
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
4712 -dnl # Linux 3.2 API Change
4713 -dnl # make_request_fn returns void instead of int.
4715 -dnl # Linux 4.4 API Change
4716 -dnl # make_request_fn returns blk_qc_t.
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>
4723 - int make_request(struct request_queue *q, struct bio *bio)
4728 - blk_queue_make_request(NULL, &make_request);
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])
4737 - AC_MSG_CHECKING([whether make_request_fn() returns void])
4738 - ZFS_LINUX_TRY_COMPILE([
4739 - #include <linux/blkdev.h>
4741 - void make_request(struct request_queue *q, struct bio *bio)
4746 - blk_queue_make_request(NULL, &make_request);
4748 - AC_MSG_RESULT(yes)
4749 - AC_DEFINE(MAKE_REQUEST_FN_RET, void,
4750 - [make_request_fn() returns void])
4753 - AC_MSG_CHECKING([whether make_request_fn() returns blk_qc_t])
4754 - ZFS_LINUX_TRY_COMPILE([
4755 - #include <linux/blkdev.h>
4757 - blk_qc_t make_request(struct request_queue *q, struct bio *bio)
4759 - return (BLK_QC_T_NONE);
4762 - blk_queue_make_request(NULL, &make_request);
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])
4770 - AC_MSG_ERROR(no - Please file a bug report at
4771 - https://github.com/zfsonlinux/zfs/issues/new)
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.
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>
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)) = {
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], [
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
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>
4823 @@ -19,8 +18,12 @@ AC_DEFUN([ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST], [
4826 module_param_call(p, param_set, param_get, NULL, 0644);
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], [
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
4844 -dnl # 4.6 API for compile-time stack validation
4845 +dnl # Check for objtool support.
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], [
4852 + dnl # 4.6 API for compile-time stack validation
4853 + ZFS_LINUX_TEST_SRC([objtool], [
4855 #include <asm/frame.h>
4857 #if !defined(FRAME_BEGIN)
4861 - AC_MSG_RESULT(yes)
4862 - AC_DEFINE(HAVE_KERNEL_OBJTOOL, 1,
4863 - [kernel does stack verification])
4865 - ZFS_AC_KERNEL_STACK_FRAME_NON_STANDARD
4872 -dnl # 4.6 API added STACK_FRAME_NON_STANDARD macro
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>
4881 #if !defined(STACK_FRAME_NON_STANDARD)
4888 +AC_DEFUN([ZFS_AC_KERNEL_OBJTOOL], [
4890 + [whether compile-time stack validation (objtool) is available])
4891 + ZFS_LINUX_TEST_RESULT([objtool], [
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])
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])
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()
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>
4924 open_bdev_exclusive(NULL, 0, NULL);
4925 - ], [open_bdev_exclusive], [fs/block_dev.c], [
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], [
4934 AC_DEFINE(HAVE_OPEN_BDEV_EXCLUSIVE, 1,
4935 - [open_bdev_exclusive() is available])
4936 + [open_bdev_exclusive() is available])
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
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>
4956 - ], [PDE_DATA], [], [
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], [], [
4964 - AC_DEFINE(HAVE_PDE_DATA, 1, [yes])
4965 + AC_DEFINE(HAVE_PDE_DATA, 1, [PDE_DATA is available])
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
4975 dnl # Supported symlink APIs
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)
4982 + static struct inode_operations
4983 + iops __attribute__ ((unused)) = {
4984 + .put_link = put_link,
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,
4999 AC_DEFUN([ZFS_AC_KERNEL_PUT_LINK], [
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
5005 - ZFS_LINUX_TRY_COMPILE([
5006 - #if !defined(HAVE_GET_LINK_DELAYED)
5007 - #error "Expecting get_link() delayed done"
5011 + ZFS_LINUX_TEST_RESULT([inode_operations_get_link], [
5012 AC_DEFINE(HAVE_PUT_LINK_DELAYED, 1, [iops->put_link() delayed])
5015 @@ -19,41 +37,24 @@ AC_DEFUN([ZFS_AC_KERNEL_PUT_LINK], [
5016 dnl # This kernel retired the nameidata structure.
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)
5023 - static struct inode_operations
5024 - iops __attribute__ ((unused)) = {
5025 - .put_link = put_link,
5029 + ZFS_LINUX_TEST_RESULT([put_link_cookie], [
5031 AC_DEFINE(HAVE_PUT_LINK_COOKIE, 1,
5032 [iops->put_link() cookie])
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,
5052 + ZFS_LINUX_TEST_RESULT([put_link_nameidata], [
5054 AC_DEFINE(HAVE_PUT_LINK_NAMEIDATA, 1,
5055 [iops->put_link() nameidata])
5057 - AC_MSG_ERROR(no; please file a bug report)
5058 + ZFS_LINUX_TEST_ERROR([put_link])
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
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,
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], [
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])
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().
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>
5114 struct file *file = NULL;
5115 @@ -17,14 +14,18 @@ AC_DEFUN([ZFS_AC_KERNEL_WRITE], [
5118 ret = kernel_write(file, buf, count, pos);
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], [
5127 AC_DEFINE(HAVE_KERNEL_WRITE_PPOS, 1,
5128 [kernel_write() take loff_t pointer])
5132 - EXTRA_KCFLAGS="$tmp_flags"
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().
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>
5149 struct file *file = NULL;
5150 @@ -46,12 +44,26 @@ AC_DEFUN([ZFS_AC_KERNEL_READ], [
5153 ret = kernel_read(file, buf, count, pos);
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], [
5162 AC_DEFINE(HAVE_KERNEL_READ_PPOS, 1,
5163 [kernel_read() take loff_t pointer])
5167 - EXTRA_KCFLAGS="$tmp_flags"
5170 +AC_DEFUN([ZFS_AC_KERNEL_SRC_RW], [
5171 + ZFS_AC_KERNEL_SRC_WRITE
5172 + ZFS_AC_KERNEL_SRC_READ
5175 +AC_DEFUN([ZFS_AC_KERNEL_RW], [
5176 + ZFS_AC_KERNEL_WRITE
5177 + ZFS_AC_KERNEL_READ
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.
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>
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;
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], [
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])
5214 - EXTRA_KCFLAGS="$tmp_flags"
5218 @@ -30,23 +31,24 @@ dnl # 3.16 API Change
5220 dnl # rwsem-spinlock "->activity" changed to "->count"
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>
5231 struct rw_semaphore dummy_semaphore __attribute__ ((unused));
5232 dummy_semaphore.activity = 0;
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], [
5241 AC_DEFINE(HAVE_RWSEM_ACTIVITY, 1,
5242 - [struct rw_semaphore has member activity])
5243 + [struct rw_semaphore has member activity])
5247 - EXTRA_KCFLAGS="$tmp_flags"
5251 @@ -54,22 +56,35 @@ dnl # 4.8 API Change
5253 dnl # rwsem "->count" changed to atomic_long_t type
5255 -AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT], [
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>
5265 DECLARE_RWSEM(dummy_semaphore);
5266 (void) atomic_long_read(&dummy_semaphore.count);
5271 +AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT], [
5273 + [whether struct rw_semaphore has atomic_long_t member count])
5274 + ZFS_LINUX_TEST_RESULT([rwsem_atomic_long_count], [
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])
5282 - EXTRA_KCFLAGS="$tmp_flags"
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
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
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
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>
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])
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
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>
5337 - AC_DEFINE(HAVE_SCHED_SIGNAL_HEADER, 1, [linux/sched/signal.h exists])
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])
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.
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>
5365 (void) io_schedule_timeout(1);
5366 - ], [io_schedule_timeout], [], [
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], [], [
5375 AC_DEFINE(HAVE_IO_SCHEDULE_TIMEOUT, 1, [yes])
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
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
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.
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>
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;
5411 security_inode_init_security(ip, dip, str, &name, &value, &len);
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], [
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])
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.
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>
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;
5441 security_inode_init_security(ip, dip, str, func, NULL);
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], [
5450 AC_DEFINE(HAVE_CALLBACK_SECURITY_INODE_INIT_SECURITY, 1,
5451 - [security_inode_init_security wants callback])
5452 + [security_inode_init_security wants callback])
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
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
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
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>
5483 unsigned int link = 0;
5484 (void) set_nlink(&node, link);
5489 +AC_DEFUN([ZFS_AC_KERNEL_SET_NLINK], [
5490 + AC_MSG_CHECKING([whether set_nlink() is available])
5491 + ZFS_LINUX_TEST_RESULT([set_nlink], [
5493 - AC_DEFINE(HAVE_SET_NLINK, 1,
5494 - [set_nlink() is available])
5495 + AC_DEFINE(HAVE_SET_NLINK, 1, [set_nlink() is available])
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.
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>
5514 struct dentry *dentry = NULL;
5515 struct iattr *attr = NULL;
5517 + int error __attribute__ ((unused)) =
5518 + setattr_prepare(dentry, attr);
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], [
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.
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>
5546 struct file_system_type *type = NULL;
5547 @@ -13,11 +12,15 @@ AC_DEFUN([ZFS_AC_KERNEL_5ARG_SGET],
5550 (void) sget(type, test, set, flags, data);
5555 +AC_DEFUN([ZFS_AC_KERNEL_SGET], [
5556 + AC_MSG_CHECKING([whether sget() wants 5 args])
5557 + ZFS_LINUX_TEST_RESULT([sget_5args], [
5559 AC_DEFINE(HAVE_5ARG_SGET, 1, [sget() wants 5 args])
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
5573 -AC_DEFUN([ZFS_AC_KERNEL_SHOW_OPTIONS], [
5574 - AC_MSG_CHECKING([whether sops->show_options() wants dentry])
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>
5581 - int show_options (struct seq_file * x, struct dentry * y) { return 0; };
5582 + int show_options(struct seq_file * x, struct dentry * y) {
5586 static struct super_operations sops __attribute__ ((unused)) = {
5587 .show_options = show_options,
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])
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.
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>
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,
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], [
5633 AC_DEFINE(HAVE_SHRINK, 1, [struct super_block has s_shrink])
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.
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>
5646 struct super_block sb __attribute__ ((unused));
5648 INIT_LIST_HEAD(&sb.s_instances);
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], [
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], [
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>
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,
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], [
5684 AC_DEFINE(HAVE_NR_CACHED_OBJECTS, 1,
5685 - [sops->nr_cached_objects() exists])
5686 + [sops->nr_cached_objects() exists])
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>
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,
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], [
5713 AC_DEFINE(HAVE_FREE_CACHED_OBJECTS, 1,
5714 - [sops->free_cached_objects() exists])
5715 + [sops->free_cached_objects() exists])
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.
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>
5730 struct shrink_control sc __attribute__ ((unused));
5731 unsigned long scnidsize __attribute__ ((unused)) =
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], [
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], [
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; }
5752 + struct shrinker cache_shrinker = {
5753 + .shrink = shrinker_cb,
5754 + .seeks = DEFAULT_SEEKS,
5756 + register_shrinker(&cache_shrinker);
5759 -AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[
5760 - tmp_flags="$EXTRA_KCFLAGS"
5761 - EXTRA_KCFLAGS="-Werror"
5763 - dnl # 2.6.23 to 2.6.34 API change
5764 - dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask)
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; }
5773 + struct shrinker cache_shrinker = {
5774 + .shrink = shrinker_cb,
5775 + .seeks = DEFAULT_SEEKS,
5777 + register_shrinker(&cache_shrinker);
5780 - int shrinker_cb(int nr_to_scan, gfp_t gfp_mask) {
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; }
5788 struct shrinker cache_shrinker = {
5789 .shrink = shrinker_cb,
5790 .seeks = DEFAULT_SEEKS,
5792 register_shrinker(&cache_shrinker);
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; }
5800 + struct shrinker cache_shrinker = {
5801 + .count_objects = shrinker_cb,
5802 + .scan_objects = shrinker_cb,
5803 + .seeks = DEFAULT_SEEKS,
5805 + register_shrinker(&cache_shrinker);
5809 +AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[
5811 + dnl # 2.6.23 to 2.6.34 API change
5812 + dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask)
5814 + AC_MSG_CHECKING([whether old 2-argument shrinker exists])
5815 + ZFS_LINUX_TEST_RESULT([shrinker_cb_2arg], [
5817 AC_DEFINE(HAVE_2ARGS_OLD_SHRINKER_CALLBACK, 1,
5818 - [old shrinker callback wants 2 args])
5819 + [old shrinker callback wants 2 args])
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)
5828 AC_MSG_CHECKING([whether old 3-argument shrinker exists])
5829 - ZFS_LINUX_TRY_COMPILE([
5830 - #include <linux/mm.h>
5832 - int shrinker_cb(struct shrinker *shrink, int nr_to_scan,
5837 - struct shrinker cache_shrinker = {
5838 - .shrink = shrinker_cb,
5839 - .seeks = DEFAULT_SEEKS,
5841 - register_shrinker(&cache_shrinker);
5843 + ZFS_LINUX_TEST_RESULT([shrinker_cb_3arg], [
5845 AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
5846 [old shrinker callback wants 3 args])
5851 dnl # 3.0 - 3.11 API change
5852 dnl # ->shrink(struct shrinker *,
5853 dnl # struct shrink_control *sc)
5856 - [whether new 2-argument shrinker exists])
5857 - ZFS_LINUX_TRY_COMPILE([
5858 - #include <linux/mm.h>
5860 - int shrinker_cb(struct shrinker *shrink,
5861 - struct shrink_control *sc) {
5865 - struct shrinker cache_shrinker = {
5866 - .shrink = shrinker_cb,
5867 - .seeks = DEFAULT_SEEKS,
5869 - register_shrinker(&cache_shrinker);
5871 + [whether new 2-argument shrinker exists])
5872 + ZFS_LINUX_TEST_RESULT([shrinker_cb_shrink_control], [
5874 AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1,
5875 [new shrinker callback wants 2 args])
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],[
5885 [whether ->count_objects callback exists])
5886 - ZFS_LINUX_TRY_COMPILE([
5887 - #include <linux/mm.h>
5889 - unsigned long shrinker_cb(
5890 - struct shrinker *shrink,
5891 - struct shrink_control *sc) {
5895 - struct shrinker cache_shrinker = {
5896 - .count_objects = shrinker_cb,
5897 - .scan_objects = shrinker_cb,
5898 - .seeks = DEFAULT_SEEKS,
5900 - register_shrinker(&cache_shrinker);
5902 + ZFS_LINUX_TEST_RESULT(
5903 + [shrinker_cb_shrink_control_split], [
5905 AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK,
5906 1, [->count_objects exists])
5908 - AC_MSG_ERROR(error)
5909 + ZFS_LINUX_TEST_ERROR([shrinker])
5914 - EXTRA_KCFLAGS="$tmp_flags"
5918 dnl # 2.6.39 API change,
5919 dnl # Shrinker adjust to use common shrink_control structure.
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>
5928 struct shrink_control sc __attribute__ ((unused));
5931 sc.gfp_mask = GFP_KERNEL;
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], [
5940 AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
5941 - [struct shrink_control exists])
5942 + [struct shrink_control exists])
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
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
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.
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>
5983 struct bio *bio = NULL;
5984 blk_qc = submit_bio(bio);
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], [
5993 AC_DEFINE(HAVE_1ARG_SUBMIT_BIO, 1, [submit_bio() wants 1 arg])
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
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>
6012 struct super_block super;
6013 super.s_user_ns = (struct user_namespace *)NULL;
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], [
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.
6030 dnl # Also check for the existance of flags in struct timer_list, they were
6031 dnl # added in 4.1-rc8 via 0eeda71bc30d.
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"
6038 - ZFS_LINUX_TRY_COMPILE([
6040 +AC_DEFUN([ZFS_AC_KERNEL_SRC_TIMER_SETUP], [
6041 + ZFS_LINUX_TEST_SRC([timer_setup], [
6042 #include <linux/timer.h>
6044 struct my_task_timer {
6045 @@ -24,13 +20,34 @@ AC_DEFUN([ZFS_AC_KERNEL_TIMER_SETUP], [
6047 void task_expire(struct timer_list *tl)
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;
6055 struct my_task_timer task_timer;
6056 timer_setup(&task_timer.timer, task_expire, 0);
6059 + ZFS_LINUX_TEST_SRC([timer_list_function], [
6060 + #include <linux/timer.h>
6061 + void task_expire(struct timer_list *tl) {}
6063 + struct timer_list tl;
6064 + tl.function = task_expire;
6067 + ZFS_LINUX_TEST_SRC([timer_list_flags], [
6068 + #include <linux/timer.h>
6070 + struct timer_list tl;
6075 +AC_DEFUN([ZFS_AC_KERNEL_TIMER_SETUP], [
6076 + AC_MSG_CHECKING([whether timer_setup() is available])
6077 + ZFS_LINUX_TEST_RESULT([timer_setup], [
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], [
6084 AC_MSG_CHECKING([whether timer function expects timer_list])
6086 - ZFS_LINUX_TRY_COMPILE([
6087 - #include <linux/timer.h>
6088 - void task_expire(struct timer_list *tl) {}
6090 - struct timer_list tl;
6091 - tl.function = task_expire;
6093 + ZFS_LINUX_TEST_RESULT([timer_list_function], [
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], [
6100 AC_MSG_CHECKING([whether struct timer_list has flags])
6102 - ZFS_LINUX_TRY_COMPILE([
6103 - #include <linux/timer.h>
6105 - struct timer_list tl;
6108 + ZFS_LINUX_TEST_RESULT([timer_list_flags], [
6110 AC_DEFINE(HAVE_KERNEL_TIMER_LIST_FLAGS, 1,
6111 [struct timer_list has a flags member])
6116 - EXTRA_KCFLAGS="$tmp_flags"
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
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)) = {
6143 +AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
6144 + AC_MSG_CHECKING([whether i_op->tmpfile() exists])
6145 + ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
6147 - AC_DEFINE(HAVE_TMPFILE, 1,
6148 - [i_op->tmpfile() exists])
6149 + AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
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
6159 dnl # 5.0 API change
6161 -dnl # ca79b0c211af mm: convert totalram_pages and totalhigh_pages variables to atomic
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>
6170 unsigned long pages __attribute__ ((unused));
6171 pages = totalhigh_pages();
6176 +AC_DEFUN([ZFS_AC_KERNEL_TOTALHIGH_PAGES], [
6177 + AC_MSG_CHECKING([whether totalhigh_pages() exists])
6178 + ZFS_LINUX_TEST_RESULT([totalhigh_pages], [
6180 AC_DEFINE(HAVE_TOTALHIGH_PAGES, 1, [totalhigh_pages() exists])
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.
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>
6197 unsigned long pages __attribute__ ((unused));
6198 pages = totalram_pages();
6203 +AC_DEFUN([ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNC], [
6204 + AC_MSG_CHECKING([whether totalram_pages() exists])
6205 + ZFS_LINUX_TEST_RESULT([totalram_pages], [
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()])
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()
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,
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], [
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.
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>
6258 truncate_setsize(NULL, 0);
6259 - ], [truncate_setsize], [mm/truncate.c], [
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], [
6268 AC_DEFINE(HAVE_TRUNCATE_SETSIZE, 1,
6269 - [truncate_setsize() is available])
6270 + [truncate_setsize() is available])
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
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>
6289 ns_capable((struct user_namespace *)NULL, CAP_SYS_ADMIN);
6294 +AC_DEFUN([ZFS_AC_KERNEL_NS_CAPABLE], [
6295 + AC_MSG_CHECKING([whether ns_capable exists])
6296 + ZFS_LINUX_TEST_RESULT([ns_capable], [
6298 - AC_DEFINE(HAVE_NS_CAPABLE, 1,
6299 - [ns_capable exists])
6300 + AC_DEFINE(HAVE_NS_CAPABLE, 1, [ns_capable exists])
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.
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>
6316 cr.user_ns = (struct user_namespace *)NULL;
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], [
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])
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.
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>
6342 kuid_has_mapping((struct user_namespace *)NULL, KUIDT_INIT(0));
6343 kgid_has_mapping((struct user_namespace *)NULL, KGIDT_INIT(0));
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], [
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], [
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
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
6376 -dnl # 2.6.36 API compatibility.
6377 -dnl # Added usleep_range timer.
6378 +dnl # 2.6.36 API compatibility- Added usleep_range timer.
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.
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>
6396 +AC_DEFUN([ZFS_AC_KERNEL_USLEEP_RANGE], [
6397 + AC_MSG_CHECKING([whether usleep_range() is available])
6398 + ZFS_LINUX_TEST_RESULT([usleep_range], [
6400 - AC_DEFINE(HAVE_USLEEP_RANGE, 1,
6401 - [usleep_range is available])
6402 + AC_DEFINE(HAVE_USLEEP_RANGE, 1, [usleep_range is available])
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
6412 -dnl # Linux 4.6.x API change
6413 +dnl # Check for direct IO interfaces.
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>
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,
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"
6434 - AC_MSG_RESULT([no])
6440 -dnl # Linux 4.1.x API change
6442 -AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_OFFSET], [
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>
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,
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"
6461 - AC_MSG_RESULT([no])
6467 -dnl # Linux 3.16.x API change
6469 -AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_RW_OFFSET], [
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>
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,
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"
6488 - AC_MSG_RESULT([no])
6494 -dnl # Ancient Linux API (predates git)
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>
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,
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"
6514 - AC_MSG_RESULT([no])
6519 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO], [
6520 - zfs_ac_direct_io="no"
6522 - if test "$zfs_ac_direct_io" = "no"; then
6523 - ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER
6526 - if test "$zfs_ac_direct_io" = "no"; then
6527 - ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_OFFSET
6530 - if test "$zfs_ac_direct_io" = "no"; then
6531 - ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_RW_OFFSET
6534 - if test "$zfs_ac_direct_io" = "no"; then
6535 - ZFS_AC_KERNEL_VFS_DIRECT_IO_IOVEC
6538 + dnl # Linux 4.6.x API change
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])
6546 + AC_MSG_RESULT([no])
6548 - if test "$zfs_ac_direct_io" = "no"; then
6549 - AC_MSG_ERROR([no; unknown direct IO interface])
6552 + dnl # Linux 4.1.x API change
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])
6562 + AC_MSG_RESULT([no])
6565 + dnl # Linux 3.16.x API change
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 ]
6575 + AC_MSG_RESULT([no])
6578 + dnl # Ancient Linux API (predates git)
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])
6587 + ZFS_LINUX_TEST_ERROR([direct IO])
6588 + AC_MSG_RESULT([no])
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.
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>
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], [
6618 AC_DEFINE(HAVE_2ARGS_VFS_FSYNC, 1, [vfs_fsync() wants 2 args])
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)
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>
6635 vfs_getattr((const struct path *)NULL,
6636 (struct kstat *)NULL,
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], [
6647 AC_DEFINE(HAVE_4ARGS_VFS_GETATTR, 1,
6648 - [vfs_getattr wants 4 args])
6649 + [vfs_getattr wants 4 args])
6653 @@ -24,17 +28,21 @@ dnl #
6655 dnl # vfs_getattr(struct path *p, struct kstat *s)
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>
6664 vfs_getattr((struct path *) NULL,
6665 (struct kstat *)NULL);
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], [
6674 AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
6675 - [vfs_getattr wants 2 args])
6676 + [vfs_getattr wants 2 args])
6680 @@ -44,19 +52,35 @@ dnl #
6682 dnl # vfs_getattr(struct vfsmount *v, struct dentry *d, struct kstat *k)
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>
6691 vfs_getattr((struct vfsmount *)NULL,
6692 (struct dentry *)NULL,
6693 (struct kstat *)NULL);
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], [
6702 AC_DEFINE(HAVE_3ARGS_VFS_GETATTR, 1,
6703 - [vfs_getattr wants 3 args])
6704 + [vfs_getattr wants 3 args])
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
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
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
6726 -AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
6728 - dnl # 4.7 API change
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)
6737 @@ -12,11 +8,44 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
6738 __attribute__ ((unused)) = {
6739 .iterate_shared = iterate,
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; }
6750 + static const struct file_operations fops
6751 + __attribute__ ((unused)) = {
6752 + .iterate = iterate,
6755 + #if defined(FMODE_KABI_ITERATE)
6756 + #error "RHEL 7.5, FMODE_KABI_ITERATE interface"
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; }
6765 + static const struct file_operations fops
6766 + __attribute__ ((unused)) = {
6767 + .readdir = readdir,
6772 +AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
6774 + dnl # 4.7 API change
6776 + AC_MSG_CHECKING([whether fops->iterate_shared() is available])
6777 + ZFS_LINUX_TEST_RESULT([file_operations_iterate_shared], [
6779 AC_DEFINE(HAVE_VFS_ITERATE_SHARED, 1,
6780 - [fops->iterate_shared() is available])
6781 + [fops->iterate_shared() is available])
6785 @@ -31,44 +60,23 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
6786 dnl # to using fops.readdir() to retain KABI compatibility.
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; }
6794 - static const struct file_operations fops
6795 - __attribute__ ((unused)) = {
6796 - .iterate = iterate,
6799 - #if defined(FMODE_KABI_ITERATE)
6800 - #error "RHEL 7.5, FMODE_KABI_ITERATE interface"
6804 + ZFS_LINUX_TEST_RESULT([file_operations_iterate], [
6806 AC_DEFINE(HAVE_VFS_ITERATE, 1,
6807 - [fops->iterate() is available])
6808 + [fops->iterate() is available])
6813 + dnl # readdir interface introduced
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; }
6821 - static const struct file_operations fops
6822 - __attribute__ ((unused)) = {
6823 - .readdir = readdir,
6827 + ZFS_LINUX_TEST_RESULT([file_operations_readdir], [
6829 AC_DEFINE(HAVE_VFS_READDIR, 1,
6830 - [fops->readdir() is available])
6831 + [fops->readdir() is available])
6833 - AC_MSG_ERROR(no; file a bug report with ZoL)
6834 + ZFS_LINUX_TEST_ERROR([vfs_iterate])
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
6844 dnl # Linux 3.16 API
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>
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,
6860 - AC_MSG_RESULT(yes)
6861 - AC_DEFINE(HAVE_VFS_RW_ITERATE, 1,
6862 - [fops->read/write_iter() are available])
6865 - ZFS_AC_KERNEL_NEW_SYNC_READ
6866 + ZFS_LINUX_TEST_SRC([new_sync_rw], [
6867 + #include <linux/fs.h>
6870 + ssize_t ret __attribute__ ((unused));
6871 + struct file *filp = NULL;
6872 + char __user *rbuf = NULL;
6873 + const char __user *wbuf = NULL;
6877 + ret = new_sync_read(filp, rbuf, len, &ppos);
6878 + ret = new_sync_write(filp, wbuf, len, &ppos);
6883 -dnl # Linux 4.1 API
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>
6890 - ssize_t ret __attribute__ ((unused));
6891 - struct file *filp = NULL;
6892 - char __user *rbuf = NULL;
6893 - const char __user *wbuf = NULL;
6897 - ret = new_sync_read(filp, rbuf, len, &ppos);
6898 - ret = new_sync_write(filp, wbuf, len, &ppos);
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], [
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])
6910 + dnl # Linux 4.1 API
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])
6923 @@ -57,19 +58,22 @@ AC_DEFUN([ZFS_AC_KERNEL_NEW_SYNC_READ],
6925 dnl # Linux 4.1.x API
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>
6935 struct kiocb *iocb = NULL;
6936 struct iov_iter *iov = NULL;
6937 generic_write_checks(iocb, iov);
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], [
6946 AC_DEFINE(HAVE_GENERIC_WRITE_CHECKS_KIOCB, 1,
6947 - [generic_write_checks() takes kiocb])
6948 + [generic_write_checks() takes kiocb])
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
6958 +dnl # 4.13 API change
6959 +dnl # Renamed struct wait_queue -> struct wait_queue_entry.
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.
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>
6970 + wait_queue_entry_t *entry __attribute__ ((unused));
6972 + AC_MSG_RESULT(yes)
6973 + AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY_T, 1,
6974 + [wait_queue_entry_t exists])
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.
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>
6994 int (*action)(void *) = NULL;
6995 wait_on_bit(NULL, 0, action, 0);
6997 - AC_MSG_RESULT(yes)
6998 - AC_DEFINE(HAVE_WAIT_ON_BIT_ACTION, 1, [yes])
7004 -dnl # 4.13 API change
7005 -dnl # Renamed struct wait_queue -> struct wait_queue_entry.
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>
7012 - wait_queue_entry_t *entry __attribute__ ((unused));
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], [
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])
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
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>
7036 #ifdef HAVE_WAIT_QUEUE_ENTRY_T
7037 @@ -66,7 +74,12 @@ AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY], [
7039 head = &wq_head.head;
7040 entry = &wq_entry.entry;
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], [
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], [
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
7061 +AC_DEFUN([ZFS_AC_KERNEL_WAIT], [
7062 + ZFS_AC_KERNEL_WAIT_ON_BIT
7063 + ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY
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.
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>
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,
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])
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"
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>
7111 static const struct xattr_handler
7112 xops __attribute__ ((unused)) = {
7113 .name = XATTR_NAME_POSIX_ACL_ACCESS,
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], [
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], [
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.
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>
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)) = {
7155 - AC_MSG_RESULT(yes)
7156 - AC_DEFINE(HAVE_GENERIC_SETXATTR, 1,
7157 - [generic_setxattr() exists])
7165 -dnl # Supported xattr handler get() interfaces checked newest to oldest.
7167 -AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
7169 - dnl # 4.7 API change,
7170 - dnl # The xattr_handler->get() callback was changed to take both
7171 - dnl # dentry and inode.
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>
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)) = {
7191 + ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry], [
7192 + #include <linux/xattr.h>
7194 + int get(struct dentry *dentry, const char *name,
7195 + void *buffer, size_t size, int handler_flags)
7197 + static const struct xattr_handler
7198 + xops __attribute__ ((unused)) = {
7203 + ZFS_LINUX_TEST_SRC([xattr_handler_get_inode], [
7204 + #include <linux/xattr.h>
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)) = {
7215 +AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
7217 + dnl # 4.7 API change,
7218 + dnl # The xattr_handler->get() callback was changed to take both
7219 + dnl # dentry and inode.
7221 + AC_MSG_CHECKING([whether xattr_handler->get() wants dentry and inode])
7222 + ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode], [
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.
7230 - AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
7231 - ZFS_LINUX_TRY_COMPILE([
7232 - #include <linux/xattr.h>
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)) = {
7244 + [whether xattr_handler->get() wants xattr_handler])
7245 + ZFS_LINUX_TEST_RESULT([xattr_handler_get_xattr_handler], [
7247 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
7248 [xattr_handler->get() wants xattr_handler])
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.
7260 - AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
7261 - ZFS_LINUX_TRY_COMPILE([
7262 - #include <linux/xattr.h>
7264 - int get(struct dentry *dentry, const char *name,
7265 - void *buffer, size_t size, int handler_flags)
7267 - static const struct xattr_handler
7268 - xops __attribute__ ((unused)) = {
7274 + [whether xattr_handler->get() wants dentry])
7275 + ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry], [
7277 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
7278 [xattr_handler->get() wants dentry])
7282 + dnl # Legacy 2.6.32 API
7286 [whether xattr_handler->get() wants inode])
7287 - ZFS_LINUX_TRY_COMPILE([
7288 - #include <linux/xattr.h>
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)) = {
7298 + ZFS_LINUX_TEST_RESULT(
7299 + [xattr_handler_get_inode], [
7301 AC_DEFINE(HAVE_XATTR_GET_INODE, 1,
7302 [xattr_handler->get() wants inode])
7304 - AC_MSG_ERROR([no; please file a bug report])
7305 + ZFS_LINUX_TEST_ERROR([xattr get()])
7309 @@ -187,14 +177,8 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
7311 dnl # Supported xattr handler set() interfaces checked newest to oldest.
7313 -AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
7315 - dnl # 4.7 API change,
7316 - dnl # The xattr_handler->set() callback was changed to take both
7317 - dnl # dentry and inode.
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>
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)) = {
7334 + ZFS_LINUX_TEST_SRC([xattr_handler_set_xattr_handler], [
7335 + #include <linux/xattr.h>
7337 + int set(const struct xattr_handler *handler,
7338 + struct dentry *dentry, const char *name,
7339 + const void *buffer, size_t size, int flags)
7341 + static const struct xattr_handler
7342 + xops __attribute__ ((unused)) = {
7347 + ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry], [
7348 + #include <linux/xattr.h>
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)) = {
7359 + ZFS_LINUX_TEST_SRC([xattr_handler_set_inode], [
7360 + #include <linux/xattr.h>
7362 + int set(struct inode *ip, const char *name,
7363 + const void *buffer, size_t size, int flags)
7365 + static const struct xattr_handler
7366 + xops __attribute__ ((unused)) = {
7372 +AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
7374 + dnl # 4.7 API change,
7375 + dnl # The xattr_handler->set() callback was changed to take both
7376 + dnl # dentry and inode.
7378 + AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode])
7379 + ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [
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.
7387 - AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
7388 - ZFS_LINUX_TRY_COMPILE([
7389 - #include <linux/xattr.h>
7391 - int set(const struct xattr_handler *handler,
7392 - struct dentry *dentry, const char *name,
7393 - const void *buffer, size_t size, int flags)
7395 - static const struct xattr_handler
7396 - xops __attribute__ ((unused)) = {
7402 + [whether xattr_handler->set() wants xattr_handler])
7403 + ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [
7405 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
7406 [xattr_handler->set() wants xattr_handler])
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.
7418 - AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
7419 - ZFS_LINUX_TRY_COMPILE([
7420 - #include <linux/xattr.h>
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)) = {
7432 + [whether xattr_handler->set() wants dentry])
7433 + ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [
7435 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
7436 [xattr_handler->set() wants dentry])
7440 + dnl # Legacy 2.6.32 API
7444 [whether xattr_handler->set() wants inode])
7445 - ZFS_LINUX_TRY_COMPILE([
7446 - #include <linux/xattr.h>
7448 - int set(struct inode *ip, const char *name,
7449 - const void *buffer, size_t size, int flags)
7451 - static const struct xattr_handler
7452 - xops __attribute__ ((unused)) = {
7457 + ZFS_LINUX_TEST_RESULT(
7458 + [xattr_handler_set_inode], [
7460 AC_DEFINE(HAVE_XATTR_SET_INODE, 1,
7461 [xattr_handler->set() wants inode])
7463 - AC_MSG_ERROR([no; please file a bug report])
7464 + ZFS_LINUX_TEST_ERROR([xattr set()])
7468 @@ -293,12 +292,8 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
7470 dnl # Supported xattr handler list() interfaces checked newest to oldest.
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>
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)) = {
7491 + ZFS_LINUX_TEST_SRC([xattr_handler_list_xattr_handler], [
7492 + #include <linux/xattr.h>
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)) = {
7503 + ZFS_LINUX_TEST_SRC([xattr_handler_list_dentry], [
7504 + #include <linux/xattr.h>
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)) = {
7516 + ZFS_LINUX_TEST_SRC([xattr_handler_list_inode], [
7517 + #include <linux/xattr.h>
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)) = {
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], [
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], [
7541 [whether xattr_handler->list() wants xattr_handler])
7542 - ZFS_LINUX_TRY_COMPILE([
7543 - #include <linux/xattr.h>
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)) = {
7554 + ZFS_LINUX_TEST_RESULT([xattr_handler_list_xattr_handler], [
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], [
7561 [whether xattr_handler->list() wants dentry])
7562 - ZFS_LINUX_TRY_COMPILE([
7563 - #include <linux/xattr.h>
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)) = {
7575 + ZFS_LINUX_TEST_RESULT([xattr_handler_list_dentry], [
7577 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
7578 [xattr_handler->list() wants dentry])
7582 + dnl # Legacy 2.6.32 API
7586 [whether xattr_handler->list() wants inode])
7587 - ZFS_LINUX_TRY_COMPILE([
7588 - #include <linux/xattr.h>
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)) = {
7599 + ZFS_LINUX_TEST_RESULT(
7600 + [xattr_handler_list_inode], [
7602 AC_DEFINE(HAVE_XATTR_LIST_INODE, 1,
7603 [xattr_handler->list() wants inode])
7606 - [no; please file a bug report])
7607 + ZFS_LINUX_TEST_ERROR([xattr list()])
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
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>
7624 posix_acl_from_xattr(&init_user_ns, NULL, 0);
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], [
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], [
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.
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>
7649 + static const struct inode_operations
7650 + iops __attribute__ ((unused)) = {
7651 + .setxattr = generic_setxattr
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])
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
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
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
7692 -dnl # zlib inflate compat,
7693 -dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
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
7703 - AC_MSG_RESULT([yes])
7705 - AC_MSG_RESULT([no])
7707 - *** This kernel does not include the required zlib inflate support.
7708 - *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
7713 -dnl # zlib deflate compat,
7714 -dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
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
7724 - AC_MSG_RESULT([yes])
7726 - AC_MSG_RESULT([no])
7728 - *** This kernel does not include the required zlib deflate support.
7729 - *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
7734 dnl # 2.6.39 API compat,
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.
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>
7748 return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL);
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], [
7757 AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1,
7758 - [zlib_deflate_workspacesize() wants 2 args])
7759 + [zlib_deflate_workspacesize() wants 2 args])
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
7770 AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
7771 + dnl # Setup the kernel build environment.
7774 - ZFS_AC_KERNEL_ACCESS_OK_TYPE
7775 - ZFS_AC_TEST_MODULE
7777 + dnl # Sanity checks for module building and CONFIG_* defines
7778 + ZFS_AC_KERNEL_TEST_MODULE
7779 + ZFS_AC_KERNEL_CONFIG_DEFINED
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
7787 + dnl # Parallel ZFS_LINUX_TEST_SRC / ZFS_LINUX_TEST_RESULT tests
7788 + ZFS_AC_KERNEL_TEST_SRC
7789 + ZFS_AC_KERNEL_TEST_RESULT
7791 + AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
7792 + KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"
7795 + AC_SUBST(KERNEL_MAKE)
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.
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
7913 + AC_MSG_CHECKING([for available kernel interfaces])
7914 + ZFS_LINUX_TEST_COMPILE_ALL([kabi])
7915 + AC_MSG_RESULT([done])
7919 +dnl # Check results of kernel interface tests.
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
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
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
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
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
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
8108 - AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
8109 - KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"
8112 - AC_SUBST(KERNEL_MAKE)
8116 @@ -190,9 +276,10 @@ AC_DEFUN([ZFS_AC_MODULE_SYMVERS], [
8117 AS_IF([test ! -f "$LINUX_OBJ/$LINUX_SYMBOLS"], [
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.
8130 @@ -285,12 +372,16 @@ AC_DEFUN([ZFS_AC_KERNEL], [
8132 AS_IF([test -z "$kernsrcver"], [
8133 AC_MSG_RESULT([Not found])
8134 - AC_MSG_ERROR([*** Cannot determine kernel version.])
8136 + *** Cannot determine kernel version.
8140 AC_MSG_RESULT([Not found])
8141 if test "x$enable_linux_builtin" != xyes; then
8142 - AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
8144 + *** Cannot find UTS_RELEASE definition.
8148 *** Cannot find UTS_RELEASE definition.
8149 @@ -312,24 +403,27 @@ AC_DEFUN([ZFS_AC_KERNEL], [
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
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:
8174 +dnl # https://01.org/intel-quickassist-technology
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
8182 +dnl # 4) Set GZIP compression in ZFS dataset:
8183 +dnl # zfs set compression = gzip <dataset>
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.
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
8193 AC_DEFUN([ZFS_AC_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"], [
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])
8212 @@ -368,9 +462,9 @@ AC_DEFUN([ZFS_AC_QAT], [
8214 AS_IF([ ! test -e "$QAT_OBJ/icp_qa_al.ko" && ! test -e "$QAT_OBJ/qat_api.ko"], [
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:
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:
8225 @@ -391,10 +485,10 @@ AC_DEFUN([ZFS_AC_QAT], [
8226 AC_MSG_RESULT([$QAT_SYMBOLS])
8227 AC_SUBST(QAT_SYMBOLS)
8230 - *** Please make sure the qat driver is installed then try again.
8231 - *** Failed to find Module.symvers in:
8234 + *** Please make sure the qat driver is installed then try again.
8235 + *** Failed to find Module.symvers in:
8240 @@ -403,14 +497,16 @@ AC_DEFUN([ZFS_AC_QAT], [
8242 dnl # Basic toolchain sanity check.
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])
8252 if test "x$enable_linux_builtin" != xyes; then
8253 - AC_MSG_ERROR([*** Unable to build an empty module.])
8255 + *** Unable to build an empty module.
8259 *** Unable to build an empty module.
8260 @@ -420,207 +516,313 @@ AC_DEFUN([ZFS_AC_TEST_MODULE], [
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
8269 -AC_DEFUN([ZFS_AC_KERNEL_CONFIG], [
8270 - AS_IF([test "x$cross_compiling" != xyes], [
8273 - #include "$LINUX/include/linux/license.h"
8275 - return !license_is_gpl_compatible("$ZFS_META_LICENSE");
8278 - AC_DEFINE([ZFS_IS_GPL_COMPATIBLE], [1],
8279 - [Define to 1 if GPL-only symbols can be used])
8283 +AC_DEFUN([ZFS_LINUX_CONFTEST_H], [
8284 +test -d build/$2 || mkdir -p build/$2
8285 +cat - <<_ACEOF >build/$2/$2.h
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
8296 +dnl # ZFS_LINUX_CONFTEST_C
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
8306 -dnl # Check configured THREAD_SIZE
8307 +dnl # ZFS_LINUX_CONFTEST_MAKEFILE
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
8314 +dnl # $1 - test case name
8315 +dnl # $2 - add to top-level Makefile
8316 +dnl # $3 - additional build flags
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>
8323 - #if (THREAD_SIZE < 16384)
8324 - #error "THREAD_SIZE is less than 16K"
8327 - AC_MSG_RESULT([yes])
8328 - AC_DEFINE(HAVE_LARGE_STACKS, 1, [kernel has large stacks])
8330 - AC_MSG_RESULT([no])
8332 +AC_DEFUN([ZFS_LINUX_CONFTEST_MAKEFILE], [
8333 + test -d build || mkdir -p build
8334 + test -d build/$1 || mkdir -p build/$1
8336 + file=build/$1/Makefile
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
8343 +ccflags-y := -Werror $FRAME_LARGER_THAN
8346 + dnl # Additional custom CFLAGS as requested.
8347 + m4_ifval($3, [echo "ccflags-y += $3" >>$file], [])
8349 + dnl # Test case source
8350 + echo "obj-m := $1.o" >>$file
8352 + AS_IF([test "x$2" = "xyes"], [echo "obj-m += $1/" >>build/Makefile], [])
8356 -dnl # Check CONFIG_DEBUG_LOCK_ALLOC
8357 +dnl # ZFS_LINUX_TEST_PROGRAM(C)([PROLOGUE], [BODY])
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], [
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
8380 -AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
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>
8389 - MODULE_LICENSE("$ZFS_META_LICENSE");
8391 - struct mutex lock;
8392 +dnl # Removes the specified test source and results.
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
8399 - mutex_init(&lock);
8400 - mutex_lock(&lock);
8401 - mutex_unlock(&lock);
8405 - AC_MSG_RESULT(yes)
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.])
8412 - EXTRA_KCFLAGS="$tmp_flags"
8415 +dnl # ZFS_LINUX_COMPILE
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'
8424 +dnl # Used internally by ZFS_LINUX_TEST_{COMPILE,MODPOST}
8426 +AC_DEFUN([ZFS_LINUX_COMPILE], [
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])
8435 -dnl # Check CONFIG_TRIM_UNUSED_KSYMS
8436 +dnl # ZFS_LINUX_TEST_COMPILE
8438 -dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled.
8439 +dnl # Perform a full compile excluding the final modpost phase.
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
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
8454 - AC_MSG_RESULT([no])
8455 - AS_IF([test "x$enable_linux_builtin" != xyes], [
8457 - *** This kernel has unused symbols trimming enabled, please disable.
8458 - *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
8461 + *** Unable to compile test source to determine kernel interfaces.])
8466 -dnl # ZFS_LINUX_CONFTEST_H
8467 +dnl # ZFS_LINUX_TEST_MODPOST
8469 -AC_DEFUN([ZFS_LINUX_CONFTEST_H], [
8470 -cat - <<_ACEOF >conftest.h
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.
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
8482 + *** Unable to modpost test source to determine kernel interfaces.])
8487 -dnl # ZFS_LINUX_CONFTEST_C
8488 +dnl # Perform the compilation of the test cases in two phases.
8490 -AC_DEFUN([ZFS_LINUX_CONFTEST_C], [
8491 -cat confdefs.h - <<_ACEOF >conftest.c
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.
8498 +dnl # Phase 2) disable all tests which failed the initial compilation,
8499 +dnl # then invoke the final modpost step for the remaining tests.
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.
8505 +dnl # The maximum allowed parallelism can be controlled by setting the
8506 +dnl # TEST_JOBS environment variable. Otherwise, it default to $(nproc).
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])
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.
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.
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.
8529 + AS_IF([test "x$enable_linux_builtin" = "xno"], [
8530 + for dir in $(awk '/^obj-m/ { print [$]3 }' \
8531 + build/Makefile.compile.$1); do
8533 + AS_IF([test -f build/$name/$name.o], [
8534 + AS_IF([test "${name##*_}" = "license"], [
8535 + ZFS_LINUX_TEST_MODPOST([$1],
8537 + echo "obj-n += $dir" >>build/Makefile
8539 + echo "obj-m += $dir" >>build/Makefile
8542 + echo "obj-n += $dir" >>build/Makefile
8546 + ZFS_LINUX_TEST_MODPOST([$1], [build])
8548 + for dir in $(awk '/^obj-m/ { print [$]3 }' \
8549 + build/Makefile.compile.$1); do
8551 + AS_IF([test -f build/$name/$name.o], [
8552 + touch build/$name/$name.ko
8559 -dnl # ZFS_LANG_PROGRAM(C)([PROLOGUE], [BODY])
8560 +dnl # ZFS_LINUX_TEST_SRC
8562 -m4_define([ZFS_LANG_PROGRAM], [
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.
8576 +dnl # $4 - extra cflags
8577 +dnl # $5 - check license-compatibility
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.
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])
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])
8597 -dnl # ZFS_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
8598 +dnl # ZFS_LINUX_TEST_RESULT
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
8606 - test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
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])],
8610 - [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
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)
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])
8622 + *** No matching source for the "$1" test, check that
8623 + *** both the test source and result macros refer to the same name.
8629 -dnl # ZFS_LINUX_TRY_COMPILE like AC_TRY_COMPILE
8630 +dnl # ZFS_LINUX_TEST_ERROR
8632 -AC_DEFUN([ZFS_LINUX_TRY_COMPILE],
8633 - [ZFS_LINUX_COMPILE_IFELSE(
8634 - [AC_LANG_SOURCE([ZFS_LANG_PROGRAM([[$1]], [[$2]])])],
8636 - [test -s build/conftest.o],
8638 +dnl # Generic error message which can be used when none of the expected
8639 +dnl # kernel interfaces were detected.
8641 +AC_DEFUN([ZFS_LINUX_TEST_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.
8648 + *** ZFS Version: $ZFS_META_ALIAS
8649 + *** Compatible Kernels: $ZFS_META_KVER_MIN - $ZFS_META_KVER_MAX
8654 -dnl # ZFS_LINUX_CONFIG
8655 +dnl # ZFS_LINUX_TEST_RESULT_SYMBOL
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>
8663 - #error CONFIG_$1 not #defined
8666 - AC_MSG_RESULT([yes])
8669 - AC_MSG_RESULT([no])
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
8675 +AC_DEFUN([ZFS_LINUX_TEST_RESULT_SYMBOL], [
8676 + AS_IF([ ! test -f build/$1/$1.ko], [
8679 + AS_IF([test "x$enable_linux_builtin" != "xyes"], [
8680 + ZFS_CHECK_SYMBOL_EXPORT([$2], [$3], [$4], [$5])
8688 +dnl # ZFS_LINUX_COMPILE_IFELSE
8690 +AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [
8691 + ZFS_LINUX_TEST_REMOVE([conftest])
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])])
8697 + ZFS_LINUX_CONFTEST_MAKEFILE([conftest], [no],
8698 + [m4_ifvaln([$5], [-I$PWD/build/conftest], [])])
8699 + ZFS_LINUX_COMPILE([build/conftest], [$2], [$3], [$4], [], [])
8703 +dnl # ZFS_LINUX_TRY_COMPILE
8707 +dnl # $3 - run on success (valid .ko generated)
8708 +dnl # $4 - run on failure (unable to compile)
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],
8718 dnl # ZFS_CHECK_SYMBOL_EXPORT
8719 -dnl # check symbol exported or not
8721 +dnl # Check if a symbol is exported on not by consulting the symbols
8722 +dnl # file, or optionally the source code.
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], [
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
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.
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
8743 -AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER],
8744 - [ZFS_LINUX_COMPILE_IFELSE(
8745 - [AC_LANG_SOURCE([ZFS_LANG_PROGRAM([[$1]], [[$2]])])],
8747 - [test -s build/conftest.o],
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],
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], [
8762 AC_DEFUN([ZFS_AC_CONFIG], [
8764 + dnl # Remove the previous build test directory.
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)
8772 + AC_SUBST(TEST_JOBS)
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])
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.]
8791 + AC_SUBST([ZFS_META_KVER_MIN])
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.]
8800 + AC_SUBST([ZFS_META_KVER_MAX])
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]);