Skip to content

Commit bda2f33

Browse files
finist0RageLtMan
authored andcommitted
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 openzfs#11410 Closes openzfs#11411
1 parent 1a553f6 commit bda2f33

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

module/os/linux/zfs/zpl_file.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ zpl_direct_IO(int rw, struct kiocb *kiocb, struct iov_iter *iter, loff_t pos)
463463
#error "Unknown direct IO interface"
464464
#endif
465465

466-
#else
466+
#else /* HAVE_VFS_RW_ITERATE */
467467

468468
#if defined(HAVE_VFS_DIRECT_IO_IOVEC)
469469
static ssize_t
@@ -475,6 +475,19 @@ zpl_direct_IO(int rw, struct kiocb *kiocb, const struct iovec *iov,
475475
else
476476
return (zpl_aio_read(kiocb, iov, nr_segs, pos));
477477
}
478+
#elif defined(HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET)
479+
static ssize_t
480+
zpl_direct_IO(int rw, struct kiocb *kiocb, struct iov_iter *iter, loff_t pos)
481+
{
482+
const struct iovec *iovp = iov_iter_iovec(iter);
483+
unsigned long nr_segs = iter->nr_segs;
484+
485+
ASSERT3S(pos, ==, kiocb->ki_pos);
486+
if (rw == WRITE)
487+
return (zpl_aio_write(kiocb, iovp, nr_segs, pos));
488+
else
489+
return (zpl_aio_read(kiocb, iovp, nr_segs, pos));
490+
}
478491
#else
479492
#error "Unknown direct IO interface"
480493
#endif

0 commit comments

Comments
 (0)