SHA256
1
0
forked from pool/openafs
openafs/6348262.diff
Christof Hanke a77b606a5f Accepting request 997368 from home:hauky:branches:filesystems
- update to current of upstream-branch openafs-stable-1_8_x
- apply patches for 15.9:
  * 05b722d.diff 6348262.diff cc8edf7.diff
- remove patches now in openafs-stable-1_8_x
  * fix_gcc_12_linux_5.18.diff

OBS-URL: https://build.opensuse.org/request/show/997368
OBS-URL: https://build.opensuse.org/package/show/filesystems/openafs?expand=0&rev=92
2022-08-16 13:16:31 +00:00

128 lines
4.0 KiB
Diff

From 6348262b1ef2cdb54f9a9bd6dab78aa8dc1ddac5 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Tue, 05 Jul 2022 11:45:29 -0600
Subject: [PATCH] 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.
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)
Change-Id: Iab96bd10a143d88fe37ac8aa8980b33339c76852
---
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index b834a40..04f13a1 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -2215,7 +2215,11 @@
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 @@
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;
}
@@ -2848,6 +2857,16 @@
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
@@ -3536,7 +3555,11 @@
};
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 @@
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 597289b..3d4b10b 100644
--- a/src/cf/linux-kernel-struct.m4
+++ b/src/cf/linux-kernel-struct.m4
@@ -7,6 +7,8 @@
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])