forked from pool/openafs
d7141e7dbb
- change version to openafs-1.8.12-g... since the new stable release is 1.8.12 - apply intermediate patches for kernel 6.10 * 03b280649f5e22ed74c217d7c98c3416a2fa9052: Linux-6.10: remove includes for asm/ia32_unistd.h * 0f6a3a402f4a66114da9231032bd68cdc4dee7bc: Linux-6.10: Use filemap_alloc_folio when avail * 658942f2791fad5e33ec7542158c16dfc66eed39: Linux-6.10: define a wrapper for vmalloc * d8b56f21994ce66d8daebb7d69e792f34c1a19ed: afs: avoid empty-body warning * 7097eec17bc01bcfc12c4d299136b2d3b94ec3d7: Linux 6.10: Move 'inline' before func return type OBS-URL: https://build.opensuse.org/package/show/filesystems/openafs?expand=0&rev=127
97 lines
3.4 KiB
Plaintext
97 lines
3.4 KiB
Plaintext
commit 0f6a3a402f4a66114da9231032bd68cdc4dee7bc
|
|
Author: Cheyenne Wills <cwills@sinenomine.net>
|
|
Date: Wed Jun 12 14:13:59 2024 -0600
|
|
|
|
Linux-6.10: Use filemap_alloc_folio when avail
|
|
|
|
The Linux 6.10 commit:
|
|
"mm: remove page_cache_alloc()" (3f2ae4ebd5)
|
|
removed the page_cache_alloc(), with a note that callers would be using
|
|
filemap_alloc_folio instead.
|
|
|
|
The function filemap_alloc_folio() was introduced in Linux 5.15 commit:
|
|
"mm/filemap: Add filemap_alloc_folio" (bb3c579e25)
|
|
|
|
Add a configure check for filemap_alloc_folio and update the function
|
|
afs_linux_read_cache() to use a wrapper that calls filemap_alloc_folio()
|
|
if available otherwise calls page_cache_alloc().
|
|
|
|
Minor whitespace/style cleanup
|
|
|
|
Note: The function filemap_alloc_folio() was introduced in Linux 5.15,
|
|
so this change affects builds using the Linux kernel 5.15 and later.
|
|
|
|
Change-Id: Ia17aefc38fe9787e54b315c864da726d610b8bb9
|
|
Reviewed-on: https://gerrit.openafs.org/15764
|
|
Tested-by: BuildBot <buildbot@rampaginggeek.com>
|
|
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
|
|
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
|
|
|
|
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
|
|
index 511b0838f..18809c89f 100644
|
|
--- a/src/afs/LINUX/osi_vnodeops.c
|
|
+++ b/src/afs/LINUX/osi_vnodeops.c
|
|
@@ -2320,6 +2320,24 @@ mapping_read_page(struct address_space *mapping, struct page *page)
|
|
#endif
|
|
}
|
|
|
|
+/*
|
|
+ * small compat wrapper for filemap_alloc_folio/page_cache_alloc
|
|
+ */
|
|
+static struct page *
|
|
+afs_page_cache_alloc(struct address_space *cachemapping)
|
|
+{
|
|
+#if defined(HAVE_LINUX_FILEMAP_ALLOC_FOLIO)
|
|
+ struct folio *folio;
|
|
+ folio = filemap_alloc_folio(mapping_gfp_mask(cachemapping), 0);
|
|
+ if (folio == NULL) {
|
|
+ return NULL;
|
|
+ }
|
|
+ return &folio->page;
|
|
+#else
|
|
+ return page_cache_alloc(cachemapping);
|
|
+#endif
|
|
+}
|
|
+
|
|
/* Populate a page by filling it from the cache file pointed at by cachefp
|
|
* (which contains indicated chunk)
|
|
* If task is NULL, the page copy occurs syncronously, and the routine
|
|
@@ -2358,11 +2376,12 @@ afs_linux_read_cache(struct file *cachefp, struct page *page,
|
|
pageindex = (offset - AFS_CHUNKTOBASE(chunk)) >> PAGE_SHIFT;
|
|
|
|
while (cachepage == NULL) {
|
|
- cachepage = find_get_page(cachemapping, pageindex);
|
|
+ cachepage = find_get_page(cachemapping, pageindex);
|
|
if (!cachepage) {
|
|
- if (!newpage)
|
|
- newpage = page_cache_alloc(cachemapping);
|
|
- if (!newpage) {
|
|
+ if (newpage == NULL) {
|
|
+ newpage = afs_page_cache_alloc(cachemapping);
|
|
+ }
|
|
+ if (newpage == NULL) {
|
|
code = -ENOMEM;
|
|
goto out;
|
|
}
|
|
diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
|
|
index 93f96f5ad..83ea354b0 100644
|
|
--- a/src/cf/linux-kernel-func.m4
|
|
+++ b/src/cf/linux-kernel-func.m4
|
|
@@ -253,6 +253,16 @@ AC_CHECK_LINUX_FUNC([no_strlcpy],
|
|
size_t s;
|
|
s = strlcpy(buff);]])
|
|
|
|
+dnl Linux 5.15 introduced filemap_alloc_folio() as a replacement for
|
|
+dnl page_cache_alloc(). page_cache_alloc() was updated to become just a
|
|
+dnl wrapper for filemap_alloc_folio().
|
|
+dnl Linux 6.10 removed page_cache_alloc().
|
|
+AC_CHECK_LINUX_FUNC([filemap_alloc_folio],
|
|
+ [#include <linux/kernel.h>
|
|
+ #include <linux/pagemap.h>],
|
|
+ [[static struct folio *folio;
|
|
+ folio = filemap_alloc_folio(0, 0);]])
|
|
+
|
|
dnl Consequences - things which get set as a result of the
|
|
dnl above tests
|
|
AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],
|