]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Linux 6.4 compat: iter_iov() function now used to get old iov member
authorColeman Kane <ckane@colemankane.org>
Sun, 23 Jul 2023 05:34:29 +0000 (01:34 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 19 Sep 2023 15:50:01 +0000 (08:50 -0700)
The iov_iter->iov member is now iov_iter->__iov and must be accessed via
the accessor function iter_iov(). Create a wrapper that is conditionally
compiled to use the access method appropriate for the target kernel
version.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Coleman Kane <ckane@colemankane.org>
Closes #15100

config/kernel-vfs-iov_iter.m4
include/os/linux/spl/sys/uio.h
module/os/linux/zfs/zpl_file.c

index e0617faab02c245635163d6053c6134767b7122f..cc5a7ab0c237d73c994e40299cfd790b45902665 100644 (file)
@@ -93,6 +93,14 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
                struct iov_iter iter = { 0 };
                __attribute__((unused)) enum iter_type i = iov_iter_type(&iter);
        ])
+
+       ZFS_LINUX_TEST_SRC([iter_iov], [
+               #include <linux/fs.h>
+               #include <linux/uio.h>
+       ],[
+               struct iov_iter iter = { 0 };
+               __attribute__((unused)) const struct iovec *iov = iter_iov(&iter);
+       ])
 ])
 
 AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
@@ -201,4 +209,19 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
                AC_DEFINE(HAVE_VFS_IOV_ITER, 1,
                    [All required iov_iter interfaces are available])
        ])
+
+       dnl #
+       dnl # Kernel 6.5 introduces the iter_iov() function that returns the
+       dnl # __iov member of an iov_iter*. The iov member was renamed to this
+       dnl # __iov member, and is intended to be accessed via the helper
+       dnl # function now.
+       dnl #
+       AC_MSG_CHECKING([whether iter_iov() is available])
+       ZFS_LINUX_TEST_RESULT([iter_iov], [
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ITER_IOV, 1,
+                   [iter_iov() is available])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
 ])
index fe2b5c07a018530c5285d5bce835f7bade8af667..082e930e46b32ac7ec04e80f9f47a19cd121e508 100644 (file)
@@ -173,4 +173,10 @@ zfs_uio_iov_iter_init(zfs_uio_t *uio, struct iov_iter *iter, offset_t offset,
 }
 #endif
 
+#if defined(HAVE_ITER_IOV)
+#define        zfs_uio_iter_iov(iter)  iter_iov((iter))
+#else
+#define        zfs_uio_iter_iov(iter)  (iter)->iov
+#endif
+
 #endif /* SPL_UIO_H */
index 73526db731c43e9c5ea13fba0b1a0ddd6b61e146..aedafd6002b94440139545f464aeb98c5b4164cc 100644 (file)
@@ -300,17 +300,15 @@ zpl_uio_init(zfs_uio_t *uio, struct kiocb *kiocb, struct iov_iter *to,
 {
 #if defined(HAVE_VFS_IOV_ITER)
        zfs_uio_iov_iter_init(uio, to, pos, count, skip);
-#else
-#ifdef HAVE_IOV_ITER_TYPE
-       zfs_uio_iovec_init(uio, to->iov, to->nr_segs, pos,
+#elif defined(HAVE_IOV_ITER_TYPE)
+       zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
            iov_iter_type(to) & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
            count, skip);
 #else
-       zfs_uio_iovec_init(uio, to->iov, to->nr_segs, pos,
+       zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
            to->type & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
            count, skip);
 #endif
-#endif
 }
 
 static ssize_t