Skip to content

Commit 5ee79af

Browse files
ckanetonyhutter
authored andcommitted
Linux 4.20 compat: wrapper function for iov_iter type access
An iov_iter_type() function to access the "type" member of the struct iov_iter was added at one point. Move the conditional logic to decide which method to use for accessing it into a macro and simplify the zpl_uio_init code. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Brian Atkinson <[email protected]> Signed-off-by: Coleman Kane <[email protected]> Closes #15100
1 parent feb0fa6 commit 5ee79af

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,10 @@ zfs_uio_iov_iter_init(zfs_uio_t *uio, struct iov_iter *iter, offset_t offset,
152152
#define zfs_uio_iter_iov(iter) (iter)->iov
153153
#endif
154154

155+
#if defined(HAVE_IOV_ITER_TYPE)
156+
#define zfs_uio_iov_iter_type(iter) iov_iter_type((iter))
157+
#else
158+
#define zfs_uio_iov_iter_type(iter) (iter)->type
159+
#endif
160+
155161
#endif /* SPL_UIO_H */

module/os/linux/zfs/zpl_file.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,10 @@ 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-
#elif defined(HAVE_IOV_ITER_TYPE)
297-
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
298-
iov_iter_type(to) & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
299-
count, skip);
300296
#else
301297
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
302-
to->type & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
298+
zfs_uio_iov_iter_type(to) & ITER_KVEC ?
299+
UIO_SYSSPACE : UIO_USERSPACE,
303300
count, skip);
304301
#endif
305302
}

0 commit comments

Comments
 (0)