xref: /freebsd/sys/contrib/openzfs/config/kernel-vfs-direct_IO.m4 (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1dnl #
2dnl # Check for Direct I/O interfaces.
3dnl #
4AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO], [
5	ZFS_LINUX_TEST_SRC([direct_io_iter], [
6		#include <linux/fs.h>
7
8		static ssize_t test_direct_IO(struct kiocb *kiocb,
9		    struct iov_iter *iter) { return 0; }
10
11		static const struct address_space_operations
12		    aops __attribute__ ((unused)) = {
13			.direct_IO = test_direct_IO,
14		};
15	],[])
16
17	ZFS_LINUX_TEST_SRC([direct_io_iter_offset], [
18		#include <linux/fs.h>
19
20		static ssize_t test_direct_IO(struct kiocb *kiocb,
21		    struct iov_iter *iter, loff_t offset) { return 0; }
22
23		static const struct address_space_operations
24		    aops __attribute__ ((unused)) = {
25			.direct_IO = test_direct_IO,
26		};
27	],[])
28])
29
30AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO], [
31	dnl #
32	dnl # Linux 4.6.x API change
33	dnl #
34	AC_MSG_CHECKING([whether aops->direct_IO() uses iov_iter])
35	ZFS_LINUX_TEST_RESULT([direct_io_iter], [
36		AC_MSG_RESULT([yes])
37		AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER, 1,
38		    [aops->direct_IO() uses iov_iter without rw])
39	],[
40		AC_MSG_RESULT([no])
41
42		dnl #
43		dnl # Linux 4.1.x API change
44		dnl #
45		AC_MSG_CHECKING(
46		    [whether aops->direct_IO() uses offset])
47		ZFS_LINUX_TEST_RESULT([direct_io_iter_offset], [
48			AC_MSG_RESULT([yes])
49			AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER_OFFSET, 1,
50			    [aops->direct_IO() uses iov_iter with offset])
51
52		],[
53			AC_MSG_RESULT([no])
54			ZFS_LINUX_TEST_ERROR([Direct I/O])
55		])
56	])
57])
58