From 0f4061d0dc39477cfcd95acd13f5d62562424b31 Mon Sep 17 00:00:00 2001 From: Yang Sheng Date: Fri, 9 May 2025 13:18:14 -0700 Subject: [PATCH] LU-18103 llite: Apply the change of splice_read Upstream changes in kernel v6.4-rc2-3-g69df79a45111 ("splice: Rename direct_splice_read() to copy_splice_read()") the rule of splice_read(). For newer kernels we now choose copy_splice_read() to adapt it. Lustre-change: https://review.whamcloud.com/56093 Lustre-commit: 3f24011b01a8a072751899bae84839655d899620 Signed-off-by: Yang Sheng Change-Id: Ic13da773691ada3c21b9803f65ea3e2533f7885a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59170 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 6 ------ lustre/llite/pcc.c | 20 +++++++++++++------- lustre/llite/pcc.h | 4 ---- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index ca4c214..a53b0ed 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -5701,13 +5701,7 @@ int ll_inode_permission(struct mnt_idmap *idmap, struct inode *inode, int mask) RETURN(rc); } -#if defined(HAVE_FILEMAP_SPLICE_READ) -# define ll_splice_read filemap_splice_read -#elif !defined(HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT) -# define ll_splice_read generic_file_splice_read -#else # define ll_splice_read pcc_file_splice_read -#endif /* -o localflock - only provides locally consistent flock locks */ static const struct file_operations ll_file_operations = { diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index ee3555b..8250b8d 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -1851,7 +1851,14 @@ out: RETURN(rc); } -#ifdef HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT +#if defined(HAVE_FILEMAP_SPLICE_READ) +# define do_sys_splice_read copy_splice_read +#elif defined(HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT) +# define do_sys_splice_read default_file_splice_read +#else +# define do_sys_splice_read generic_file_splice_read +#endif + ssize_t pcc_file_splice_read(struct file *in_file, loff_t *ppos, struct pipe_inode_info *pipe, size_t count, unsigned int flags) @@ -1865,20 +1872,19 @@ ssize_t pcc_file_splice_read(struct file *in_file, loff_t *ppos, ENTRY; if (!pcc_file) - RETURN(default_file_splice_read(in_file, ppos, pipe, - count, flags)); + RETURN(do_sys_splice_read(in_file, ppos, pipe, + count, flags)); pcc_io_init(inode, PIT_SPLICE_READ, &cached); if (!cached) - RETURN(default_file_splice_read(in_file, ppos, pipe, - count, flags)); + RETURN(do_sys_splice_read(in_file, ppos, pipe, + count, flags)); - result = default_file_splice_read(pcc_file, ppos, pipe, count, flags); + result = do_sys_splice_read(pcc_file, ppos, pipe, count, flags); pcc_io_fini(inode); RETURN(result); } -#endif /* HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT */ int pcc_fsync(struct file *file, loff_t start, loff_t end, int datasync, bool *cached) diff --git a/lustre/llite/pcc.h b/lustre/llite/pcc.h index 067daef..77f32b7 100644 --- a/lustre/llite/pcc.h +++ b/lustre/llite/pcc.h @@ -183,10 +183,8 @@ enum pcc_io_type { PIT_FAULT, /* fsync system call handling */ PIT_FSYNC, -#ifdef HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT /* splice_read system call */ PIT_SPLICE_READ, -#endif /* open system call */ PIT_OPEN }; @@ -242,11 +240,9 @@ ssize_t pcc_file_write_iter(struct kiocb *iocb, struct iov_iter *iter, int pcc_inode_getattr(struct inode *inode, u32 request_mask, unsigned int flags, bool *cached); int pcc_inode_setattr(struct inode *inode, struct iattr *attr, bool *cached); -#ifdef HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT ssize_t pcc_file_splice_read(struct file *in_file, loff_t *ppos, struct pipe_inode_info *pipe, size_t count, unsigned int flags); -#endif int pcc_fsync(struct file *file, loff_t start, loff_t end, int datasync, bool *cached); int pcc_file_mmap(struct file *file, struct vm_area_struct *vma, bool *cached); -- 1.8.3.1