Whamcloud - gitweb
LU-18103 llite: Apply the change of splice_read 93/56093/4
authorYang Sheng <ys@whamcloud.com>
Tue, 20 Aug 2024 04:25:48 +0000 (12:25 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 12 Sep 2024 05:51:34 +0000 (05:51 +0000)
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 <ys@whamcloud.com>
Change-Id: Ic13da773691ada3c21b9803f65ea3e2533f7885a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56093
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/llite/file.c
lustre/llite/pcc.c
lustre/llite/pcc.h

index 9739eae..98c498f 100644 (file)
@@ -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 = {
index 7ad8416..64e47e8 100644 (file)
@@ -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)
index 609b383..53c8fab 100644 (file)
@@ -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);