Whamcloud - gitweb
LU-18103 llite: Apply the change of splice_read 70/59170/2
authorYang Sheng <ys@whamcloud.com>
Fri, 9 May 2025 20:18:14 +0000 (13:18 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 15 May 2025 07:32:07 +0000 (07:32 +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.

Lustre-change: https://review.whamcloud.com/56093
Lustre-commit: 3f24011b01a8a072751899bae84839655d899620

Signed-off-by: Yang Sheng <ys@whamcloud.com>
Change-Id: Ic13da773691ada3c21b9803f65ea3e2533f7885a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59170
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/file.c
lustre/llite/pcc.c
lustre/llite/pcc.h

index ca4c214..a53b0ed 100644 (file)
@@ -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 = {
index ee3555b..8250b8d 100644 (file)
@@ -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)
index 067daef..77f32b7 100644 (file)
@@ -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);