Skip to content

Commit 8be6308

Browse files
ckanebehlendorf
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 0bf2c53 commit 8be6308

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
@@ -179,4 +179,10 @@ zfs_uio_iov_iter_init(zfs_uio_t *uio, struct iov_iter *iter, offset_t offset,
179179
#define zfs_uio_iter_iov(iter) (iter)->iov
180180
#endif
181181

182+
#if defined(HAVE_IOV_ITER_TYPE)
183+
#define zfs_uio_iov_iter_type(iter) iov_iter_type((iter))
184+
#else
185+
#define zfs_uio_iov_iter_type(iter) (iter)->type
186+
#endif
187+
182188
#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
@@ -300,13 +300,10 @@ zpl_uio_init(zfs_uio_t *uio, struct kiocb *kiocb, struct iov_iter *to,
300300
{
301301
#if defined(HAVE_VFS_IOV_ITER)
302302
zfs_uio_iov_iter_init(uio, to, pos, count, skip);
303-
#elif defined(HAVE_IOV_ITER_TYPE)
304-
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
305-
iov_iter_type(to) & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
306-
count, skip);
307303
#else
308304
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
309-
to->type & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
305+
zfs_uio_iov_iter_type(to) & ITER_KVEC ?
306+
UIO_SYSSPACE : UIO_USERSPACE,
310307
count, skip);
311308
#endif
312309
}

0 commit comments

Comments
 (0)