2 dnl # Linux 4.6.x API change
4 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER], [
5 AC_MSG_CHECKING([whether aops->direct_IO() uses iov_iter])
6 ZFS_LINUX_TRY_COMPILE([
9 ssize_t test_direct_IO(struct kiocb *kiocb,
10 struct iov_iter *iter) { return 0; }
12 static const struct address_space_operations
13 aops __attribute__ ((unused)) = {
14 .direct_IO = test_direct_IO,
19 AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER, 1,
20 [aops->direct_IO() uses iov_iter without rw])
21 zfs_ac_direct_io="yes"
28 dnl # Linux 4.1.x API change
30 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_OFFSET], [
32 [whether aops->direct_IO() uses iov_iter with offset])
33 ZFS_LINUX_TRY_COMPILE([
36 ssize_t test_direct_IO(struct kiocb *kiocb,
37 struct iov_iter *iter, loff_t offset) { return 0; }
39 static const struct address_space_operations
40 aops __attribute__ ((unused)) = {
41 .direct_IO = test_direct_IO,
46 AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER_OFFSET, 1,
47 [aops->direct_IO() uses iov_iter with offset])
48 zfs_ac_direct_io="yes"
55 dnl # Linux 3.16.x API change
57 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_RW_OFFSET], [
59 [whether aops->direct_IO() uses iov_iter with rw and offset])
60 ZFS_LINUX_TRY_COMPILE([
63 ssize_t test_direct_IO(int rw, struct kiocb *kiocb,
64 struct iov_iter *iter, loff_t offset) { return 0; }
66 static const struct address_space_operations
67 aops __attribute__ ((unused)) = {
68 .direct_IO = test_direct_IO,
73 AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET, 1,
74 [aops->direct_IO() uses iov_iter with rw and offset])
75 zfs_ac_direct_io="yes"
82 dnl # Ancient Linux API (predates git)
84 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_IOVEC], [
85 AC_MSG_CHECKING([whether aops->direct_IO() uses iovec])
86 ZFS_LINUX_TRY_COMPILE([
89 ssize_t test_direct_IO(int rw, struct kiocb *kiocb,
90 const struct iovec *iov, loff_t offset,
91 unsigned long nr_segs) { return 0; }
93 static const struct address_space_operations
94 aops __attribute__ ((unused)) = {
95 .direct_IO = test_direct_IO,
100 AC_DEFINE(HAVE_VFS_DIRECT_IO_IOVEC, 1,
101 [aops->direct_IO() uses iovec])
102 zfs_ac_direct_io="yes"
108 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO], [
109 zfs_ac_direct_io="no"
111 if test "$zfs_ac_direct_io" = "no"; then
112 ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER
115 if test "$zfs_ac_direct_io" = "no"; then
116 ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_OFFSET
119 if test "$zfs_ac_direct_io" = "no"; then
120 ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_RW_OFFSET
123 if test "$zfs_ac_direct_io" = "no"; then
124 ZFS_AC_KERNEL_VFS_DIRECT_IO_IOVEC
127 if test "$zfs_ac_direct_io" = "no"; then
128 AC_MSG_ERROR([no; unknown direct IO interface])