From 0e06eb78f293bb295b0fe12da24abd8dc1160149 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills Date: Sun, 9 Jul 2023 18:52:23 -0600 Subject: [PATCH] Linux 6.5: Replace generic_file_splice_read The Linux 6.5 commit: 'splice: Remove generic_file_splice_read()' (c6585011bc) replaces the function generic_file_splice_read() with the function filemap_splice_read(). The Linux function 'filemap_splice_read()' was introduced with the Linux 6.3 commits: 'splice: Add a func to do a splice from a buffered file without ITER_PIPE' (07073eb01c) 'splice: Export filemap/direct_splice_read()' (7c8e01ebf2) With updates in Linux 6.5: 'splice: Fix filemap_splice_read() to use the correct inode' (c37222082f) -- which fixes a problem in the code. 'splice: Make filemap_splice_read() check s_maxbytes' (83aeff881e) Due to the fact that there could be problems with splice support prior to Linux 6.5 (where filemap_splice_read()'s use was expanded to additional filesystems other than just cifs), we only want to use 'filemap_splice_read()' in Linux 6.5 and later. The LINUX/osi_vnodeops.c file is updated to use 'filemap_splice_read()', for Linux 6.5 and later, for the splice_read member of the file_operations structure. Change-Id: Ia07c66ddc5d4f836f230b5d03567803e124b93b8 Reviewed-on: https://gerrit.openafs.org/15486 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk --- src/afs/LINUX/osi_vnodeops.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index aa71dc8d11..43c9ad339d 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -960,7 +960,11 @@ struct file_operations afs_file_fops = { # else .splice_write = generic_file_splice_write, # endif +# if LINUX_VERSION_CODE >= KERNEL_VERSION(6,5,0) + .splice_read = filemap_splice_read, +# else .splice_read = generic_file_splice_read, +# endif #endif .release = afs_linux_release, .fsync = afs_linux_fsync,