summarylogtreecommitdiffstats
path: root/0004-LINUX-5.8-use-lru_cache_add.patch
diff options
context:
space:
mode:
Diffstat (limited to '0004-LINUX-5.8-use-lru_cache_add.patch')
-rw-r--r--0004-LINUX-5.8-use-lru_cache_add.patch108
1 files changed, 108 insertions, 0 deletions
diff --git a/0004-LINUX-5.8-use-lru_cache_add.patch b/0004-LINUX-5.8-use-lru_cache_add.patch
new file mode 100644
index 000000000000..b4a49c6cbb88
--- /dev/null
+++ b/0004-LINUX-5.8-use-lru_cache_add.patch
@@ -0,0 +1,108 @@
+From db3408925dd69a70c14249a97d178d2762329f15 Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Fri, 3 Jul 2020 10:35:06 -0600
+Subject: [PATCH 4/4] LINUX 5.8: use lru_cache_add
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+With Linux-5.8-rc1 commit 'mm: fold and remove lru_cache_add_anon() and
+lru_cache_add_file()' (6058eaec), the lru_cache_add_file function is
+removed since it was functionally equivalent to lru_cache_add.
+
+Replace lru_cache_add_file with lru_cache_add.
+
+Introduce a new autoconf test to determine if lru_cache_add is present
+
+For reference, the Linux changes associated with the lru caches:
+
+ __pagevec_lru_add introduced before v2.6.12-rc2
+
+ lru_cache_add_file introduced in v2.6.28-rc1
+ __pagevec_lru_add_file replaces __pagevec_lru_add in v2.6.28-rc1
+ vmscan: split LRU lists into anon & file sets (4f98a2fee)
+
+ __pagevec_lru_add removed in v5.7 with a note to use lru_cache_add_file
+ mm/swap.c: not necessary to export __pagevec_lru_add() (bde07cfc6)
+
+ lru_cache_add_file removed in v5.8
+ mm: fold and remove lru_cache_add_anon() and lru_cache_add_file()
+ (6058eaec)
+ lru_cache_add exported
+ mm: fold and remove lru_cache_add_anon() and lru_cache_add_file()
+ (6058eaec)
+
+Openafs will use:
+ lru_cache_add on 5.8 kernels
+ lru_cache_add_file from 2.6.28 through 5.7 kernels
+ __pagevec_lru_add/__pagevec_lru_add_file on pre 2.6.28 kernels
+
+Reviewed-on: https://gerrit.openafs.org/14249
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Yadavendra Yadav <yadayada@in.ibm.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit 7d85ce221d6ccc19cf76ce7680c74311e4ed2632)
+
+Change-Id: Iba6ef4441687dbf60d227a708e2a032c2c0dc79f
+Reviewed-on: https://gerrit.openafs.org/14269
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/afs/LINUX/osi_vnodeops.c | 8 +++++++-
+ src/cf/linux-kernel-func.m4 | 7 +++++++
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index 00995b27a..36a4f685e 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -71,7 +71,7 @@ extern struct vcache *afs_globalVp;
+
+ /* Handle interfacing with Linux's pagevec/lru facilities */
+
+-#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
++#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) || defined(HAVE_LINUX_LRU_CACHE_ADD)
+
+ /*
+ * Linux's lru_cache_add_file provides a simplified LRU interface without
+@@ -90,7 +90,13 @@ afs_lru_cache_init(struct afs_lru_pages *alrupages)
+ static inline void
+ afs_lru_cache_add(struct afs_lru_pages *alrupages, struct page *page)
+ {
++# if defined(HAVE_LINUX_LRU_CACHE_ADD)
++ lru_cache_add(page);
++# elif defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
+ lru_cache_add_file(page);
++# else
++# error need a kernel function to add a page to the kernel lru cache
++# endif
+ }
+
+ static inline void
+diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
+index 78ff48294..11d071806 100644
+--- a/src/cf/linux-kernel-func.m4
++++ b/src/cf/linux-kernel-func.m4
+@@ -147,10 +147,17 @@ AC_CHECK_LINUX_FUNC([inode_lock],
+ [inode_lock(NULL);])
+
+ dnl lru_cache_add_file added to Linux 2.6.28.
++dnl removed in Linux 5.8
+ AC_CHECK_LINUX_FUNC([lru_cache_add_file],
+ [#include <linux/swap.h>],
+ [lru_cache_add_file(NULL);])
+
++dnl lru_cache_add exported in Linux 5.8
++dnl replaces lru_cache_add_file
++AC_CHECK_LINUX_FUNC([lru_cache_add],
++ [#include <linux/swap.h>],
++ [lru_cache_add(NULL);])
++
+ dnl Linux 5.8 replaced kernel_setsockopt with helper functions
+ dnl e.g. ip_sock_set_mtu_discover, ip_sock_set_recverr
+ AC_CHECK_LINUX_FUNC([ip_sock_set],
+--
+2.27.0
+