Skip to content

Commit feb0fa6

Browse files
ckanetonyhutter
authored andcommitted
Linux 6.4 compat: iter_iov() function now used to get old iov member
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 <[email protected]> Reviewed-by: Brian Atkinson <[email protected]> Signed-off-by: Coleman Kane <[email protected]> Closes #15100
1 parent 7c0618b commit feb0fa6

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

config/kernel-vfs-iov_iter.m4

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
9393
struct iov_iter iter = { 0 };
9494
__attribute__((unused)) enum iter_type i = iov_iter_type(&iter);
9595
])
96+
97+
ZFS_LINUX_TEST_SRC([iter_iov], [
98+
#include <linux/fs.h>
99+
#include <linux/uio.h>
100+
],[
101+
struct iov_iter iter = { 0 };
102+
__attribute__((unused)) const struct iovec *iov = iter_iov(&iter);
103+
])
96104
])
97105

98106
AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
@@ -201,4 +209,19 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
201209
AC_DEFINE(HAVE_VFS_IOV_ITER, 1,
202210
[All required iov_iter interfaces are available])
203211
])
212+
213+
dnl #
214+
dnl # Kernel 6.5 introduces the iter_iov() function that returns the
215+
dnl # __iov member of an iov_iter*. The iov member was renamed to this
216+
dnl # __iov member, and is intended to be accessed via the helper
217+
dnl # function now.
218+
dnl #
219+
AC_MSG_CHECKING([whether iter_iov() is available])
220+
ZFS_LINUX_TEST_RESULT([iter_iov], [
221+
AC_MSG_RESULT(yes)
222+
AC_DEFINE(HAVE_ITER_IOV, 1,
223+
[iter_iov() is available])
224+
],[
225+
AC_MSG_RESULT(no)
226+
])
204227
])

include/os/linux/spl/sys/uio.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,10 @@ zfs_uio_iov_iter_init(zfs_uio_t *uio, struct iov_iter *iter, offset_t offset,
146146
}
147147
#endif
148148

149+
#if defined(HAVE_ITER_IOV)
150+
#define zfs_uio_iter_iov(iter) iter_iov((iter))
151+
#else
152+
#define zfs_uio_iter_iov(iter) (iter)->iov
153+
#endif
154+
149155
#endif /* SPL_UIO_H */

module/os/linux/zfs/zpl_file.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,15 @@ zpl_uio_init(zfs_uio_t *uio, struct kiocb *kiocb, struct iov_iter *to,
293293
{
294294
#if defined(HAVE_VFS_IOV_ITER)
295295
zfs_uio_iov_iter_init(uio, to, pos, count, skip);
296-
#else
297-
#ifdef HAVE_IOV_ITER_TYPE
298-
zfs_uio_iovec_init(uio, to->iov, to->nr_segs, pos,
296+
#elif defined(HAVE_IOV_ITER_TYPE)
297+
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
299298
iov_iter_type(to) & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
300299
count, skip);
301300
#else
302-
zfs_uio_iovec_init(uio, to->iov, to->nr_segs, pos,
301+
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
303302
to->type & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
304303
count, skip);
305304
#endif
306-
#endif
307305
}
308306

309307
static ssize_t

0 commit comments

Comments
 (0)