From 3f24011b01a8a072751899bae84839655d899620 Mon Sep 17 00:00:00 2001 From: Yang Sheng Date: Tue, 20 Aug 2024 12:25:48 +0800 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. Test-Parameters: mdtcount=4 mdscount=2 env=SANITY_EXCEPT="17e 27J 103" clientdistro=ubuntu2404 testlist=sanity Signed-off-by: Yang Sheng Change-Id: Ic13da773691ada3c21b9803f65ea3e2533f7885a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56093 Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: Qian Yingjin Tested-by: jenkins Tested-by: Maloo --- lustre/llite/file.c | 6 ------ lustre/llite/pcc.c | 20 +++++++++++++------- lustre/llite/pcc.h | 2 -- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 9739eae..98c498f 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -6275,13 +6275,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 7ad8416..64e47e8 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -2657,7 +2657,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) @@ -2670,20 +2677,19 @@ ssize_t pcc_file_splice_read(struct file *in_file, loff_t *ppos, ENTRY; in_file->f_ra.ra_pages = 0; 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, in_file, &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, PIT_SPLICE_READ, result, &cached); 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 609b383..53c8fab 100644 --- a/lustre/llite/pcc.h +++ b/lustre/llite/pcc.h @@ -298,11 +298,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