summarylogtreecommitdiffstats
path: root/0004-Linux-5.19-Rename-aops-readpage-to-read_folio.patch
diff options
context:
space:
mode:
Diffstat (limited to '0004-Linux-5.19-Rename-aops-readpage-to-read_folio.patch')
-rw-r--r--0004-Linux-5.19-Rename-aops-readpage-to-read_folio.patch132
1 files changed, 132 insertions, 0 deletions
diff --git a/0004-Linux-5.19-Rename-aops-readpage-to-read_folio.patch b/0004-Linux-5.19-Rename-aops-readpage-to-read_folio.patch
new file mode 100644
index 000000000000..1e473316ab3d
--- /dev/null
+++ b/0004-Linux-5.19-Rename-aops-readpage-to-read_folio.patch
@@ -0,0 +1,132 @@
+From f7d5510aa486caeb69c688099bfba77609d82ed5 Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Tue, 5 Jul 2022 11:45:29 -0600
+Subject: [PATCH 4/6] Linux-5.19: Rename aops readpage to read_folio
+
+With Linux commits:
+ mm,fs: Remove aops->readpage (7e0a126519)
+ fs: Introduce aops->read_folio (5efe7448a1)
+
+the address space operations method 'readpage' was replaced with
+read_folio. The operation behaves the same, except instead of taking a
+struct page parameter, the new function takes a folio structure.
+
+Add an autoconf test for the address space operation entry read_folio
+
+Replace the references to an address space operations' readpage with
+read_folio. Note that the function Linux page_folio can be used to
+obtain the required pointer to the folio for a given page.
+
+Introduce afs_linux_read_folio that accepts a folio and calls
+afs_linux_readpage with the page associated with that folio.
+
+Change-Id: I2c43a9bfb26042f7cc2c55807d46b33769f2594a
+Reviewed-on: https://gerrit.openafs.org/15040
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+(cherry picked from commit bfb852197edcbe0c38c499faecd7c1be23308a20)
+---
+ src/afs/LINUX/osi_vnodeops.c | 36 +++++++++++++++++++++++++++++++++++
+ src/cf/linux-kernel-struct.m4 | 2 ++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index b834a405c..04f13a1b1 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -2215,7 +2215,11 @@ afs_linux_put_link(struct dentry *dentry, struct nameidata *nd)
+ static int
+ mapping_read_page(struct address_space *mapping, struct page *page)
+ {
++#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
++ return mapping->a_ops->read_folio(NULL, page_folio(page));
++#else
+ return mapping->a_ops->readpage(NULL, page);
++#endif
+ }
+
+ /* Populate a page by filling it from the cache file pointed at by cachefp
+@@ -2326,8 +2330,13 @@ afs_linux_read_cache(struct file *cachefp, struct page *page,
+ static int inline
+ file_can_read_pages(struct file *fp)
+ {
++#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
++ if (fp->f_dentry->d_inode->i_mapping->a_ops->read_folio != NULL)
++ return 1;
++#else
+ if (fp->f_dentry->d_inode->i_mapping->a_ops->readpage != NULL)
+ return 1;
++#endif
+ return 0;
+ }
+
+@@ -2849,6 +2858,16 @@ afs_linux_readpage(struct file *fp, struct page *pp)
+ return code;
+ }
+
++#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
++static int
++afs_linux_read_folio(struct file *fp, struct folio *folio)
++{
++ struct page *pp = &folio->page;
++
++ return afs_linux_readpage(fp, pp);
++}
++#endif
++
+ /*
+ * Updates the adc and acacheFp parameters
+ * Returns:
+@@ -3536,7 +3555,11 @@ static struct inode_operations afs_file_iops = {
+ };
+
+ static struct address_space_operations afs_file_aops = {
++#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
++ .read_folio = afs_linux_read_folio,
++#else
+ .readpage = afs_linux_readpage,
++#endif
+ #if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READAHEAD)
+ .readahead = afs_linux_readahead,
+ #else
+@@ -3609,9 +3632,22 @@ afs_symlink_filler(struct file *file, struct page *page)
+ unlock_page(page);
+ return code;
+ }
++#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
++static int
++afs_symlink_filler_folio(struct file *file, struct folio *folio)
++{
++ struct page *page = &folio->page;
++ return afs_symlink_filler(file, page);
++}
++#endif
++
+
+ static struct address_space_operations afs_symlink_aops = {
++#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
++ .read_folio = afs_symlink_filler_folio
++#else
+ .readpage = afs_symlink_filler
++#endif
+ };
+ #endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */
+
+diff --git a/src/cf/linux-kernel-struct.m4 b/src/cf/linux-kernel-struct.m4
+index 597289bc8..3d4b10b13 100644
+--- a/src/cf/linux-kernel-struct.m4
++++ b/src/cf/linux-kernel-struct.m4
+@@ -7,6 +7,8 @@ dnl linux 5.18 replaced set_page_dirty with dirty_folio
+ AC_CHECK_LINUX_STRUCT([address_space_operations], [dirty_folio], [fs.h])
+ dnl linux 5.18 replaced readpages with readahead (introduced in 5.8)
+ AC_CHECK_LINUX_STRUCT([address_space_operations], [readahead], [fs.h])
++dnl linux 5.18 replaced readpage with read_folio
++AC_CHECK_LINUX_STRUCT([address_space_operations], [read_folio], [fs.h])
+ AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
+ [backing-dev.h])
+ AC_CHECK_LINUX_STRUCT([cred], [session_keyring], [cred.h])
+--
+2.37.1
+