aboutsummaryrefslogtreecommitdiffstats
path: root/module/os
diff options
context:
space:
mode:
authorKonstantin Khorenko <[email protected]>2020-12-31 01:18:29 +0300
committerGitHub <[email protected]>2020-12-30 14:18:29 -0800
commit064c2cf40ea367f0b7608a3e8b537f87190f52cb (patch)
tree6ab7f23a9d575c756dfa5220a9151ebde63b8d93 /module/os
parent808e6812386b1c93a90be685a3f71342596df203 (diff)
VZ 7 kernel compat: introduce ITER-enabled .direct_IO() via IOVECs
Virtuozzo 7 kernels starting 3.10.0-1127.18.2.vz7.163.46 have the following configuration: * no HAVE_VFS_RW_ITERATE * HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET => let's add implementation of zpl_direct_IO() via zpl_aio_{read,write}() in this case. https://bugs.openvz.org/browse/OVZ-7243 Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Konstantin Khorenko <[email protected]> Closes #11410 Closes #11411
Diffstat (limited to 'module/os')
-rw-r--r--module/os/linux/zfs/zpl_file.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c
index 705bd22f5..9e08c94e2 100644
--- a/module/os/linux/zfs/zpl_file.c
+++ b/module/os/linux/zfs/zpl_file.c
@@ -463,7 +463,7 @@ zpl_direct_IO(int rw, struct kiocb *kiocb, struct iov_iter *iter, loff_t pos)
#error "Unknown direct IO interface"
#endif
-#else
+#else /* HAVE_VFS_RW_ITERATE */
#if defined(HAVE_VFS_DIRECT_IO_IOVEC)
static ssize_t
@@ -475,6 +475,19 @@ zpl_direct_IO(int rw, struct kiocb *kiocb, const struct iovec *iov,
else
return (zpl_aio_read(kiocb, iov, nr_segs, pos));
}
+#elif defined(HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET)
+static ssize_t
+zpl_direct_IO(int rw, struct kiocb *kiocb, struct iov_iter *iter, loff_t pos)
+{
+ const struct iovec *iovp = iov_iter_iovec(iter);
+ unsigned long nr_segs = iter->nr_segs;
+
+ ASSERT3S(pos, ==, kiocb->ki_pos);
+ if (rw == WRITE)
+ return (zpl_aio_write(kiocb, iovp, nr_segs, pos));
+ else
+ return (zpl_aio_read(kiocb, iovp, nr_segs, pos));
+}
#else
#error "Unknown direct IO interface"
#endif