diff options
Diffstat (limited to '0003-LINUX-5.7-replace-__pagevec_lru_add-with-lru_cache_a.patch')
-rw-r--r-- | 0003-LINUX-5.7-replace-__pagevec_lru_add-with-lru_cache_a.patch | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/0003-LINUX-5.7-replace-__pagevec_lru_add-with-lru_cache_a.patch b/0003-LINUX-5.7-replace-__pagevec_lru_add-with-lru_cache_a.patch new file mode 100644 index 000000000000..9368cfd69196 --- /dev/null +++ b/0003-LINUX-5.7-replace-__pagevec_lru_add-with-lru_cache_a.patch @@ -0,0 +1,144 @@ +From e111c3009fde64b50e42d3c7a759909fbd66b208 Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills <cwills@sinenomine.net> +Date: Fri, 15 May 2020 10:40:20 -0600 +Subject: [PATCH 3/3] LINUX-5.7: replace __pagevec_lru_add with + lru_cache_add_file + +The Linux function __pagevec_lru_add is no longer exported in Linux +5.7-rc1 commit bde07cfc65da5fe6c63fe23f035f5ccc0ffd89e0 +"mm/swap.c: not necessary to export __pagevec_lru_add()". + +As a replacement, the Linux function lru_cache_add_file can be used for +adding a page to the lru cache. The internal processing of +lru_cache_add_file manages its own internal pagevec and performs the +following: + get_page(...) + if(!pagevec_add(...)) + __pagevec_lru_add_file(...) + +Introduce an autoconf test for lru_cache_add_file and replace the calls +associated with __pagevec_lru_add with lru_cache_add_file. + +NOTE: see Linux commit a0b8cab3b9b2efadabdcff264c450ca515e2619c +"mm: remove lru parameter from __pagevec_lru_add and remove parts of +pagevec API" as a reference for this change. + +The lru_cache_add_file was introduced in Linux 2.6.28, therefore this +change affects systems with Linux 2.6.28 kernels and later. + +Reviewed-on: https://gerrit.openafs.org/14159 +Reviewed-by: Andrew Deason <adeason@sinenomine.net> +Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> +Tested-by: BuildBot <buildbot@rampaginggeek.com> +(cherry picked from commit 17b42fe67c18fab0003fb712092d36f06c93f2eb) + +Change-Id: I206925d1659164a54e0c3a41b82a1733cb656b41 +--- + src/afs/LINUX/osi_vnodeops.c | 49 ++++++++++++++++++++++++++++++------ + src/cf/linux-kernel-func.m4 | 5 ++++ + 2 files changed, 47 insertions(+), 7 deletions(-) + +diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c +index 96d7a2e33..00995b27a 100644 +--- a/src/afs/LINUX/osi_vnodeops.c ++++ b/src/afs/LINUX/osi_vnodeops.c +@@ -31,7 +31,11 @@ + #endif + #include <linux/pagemap.h> + #include <linux/writeback.h> +-#include <linux/pagevec.h> ++#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) ++# include <linux/swap.h> ++#else ++# include <linux/pagevec.h> ++#endif + #include <linux/aio.h> + #include "afs/lock.h" + #include "afs/afs_bypasscache.h" +@@ -67,6 +71,36 @@ extern struct vcache *afs_globalVp; + + /* Handle interfacing with Linux's pagevec/lru facilities */ + ++#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) ++ ++/* ++ * Linux's lru_cache_add_file provides a simplified LRU interface without ++ * needing a pagevec ++ */ ++struct afs_lru_pages { ++ char unused; ++}; ++ ++static inline void ++afs_lru_cache_init(struct afs_lru_pages *alrupages) ++{ ++ return; ++} ++ ++static inline void ++afs_lru_cache_add(struct afs_lru_pages *alrupages, struct page *page) ++{ ++ lru_cache_add_file(page); ++} ++ ++static inline void ++afs_lru_cache_finalize(struct afs_lru_pages *alrupages) ++{ ++ return; ++} ++#else ++ ++/* Linux's pagevec/lru interfaces require a pagevec */ + struct afs_lru_pages { + struct pagevec lrupv; + }; +@@ -74,16 +108,16 @@ struct afs_lru_pages { + static inline void + afs_lru_cache_init(struct afs_lru_pages *alrupages) + { +-#if defined(PAGEVEC_INIT_COLD_ARG) ++# if defined(PAGEVEC_INIT_COLD_ARG) + pagevec_init(&alrupages->lrupv, 0); +-#else ++# else + pagevec_init(&alrupages->lrupv); +-#endif ++# endif + } + +-#ifndef HAVE_LINUX_PAGEVEC_LRU_ADD_FILE +-# define __pagevec_lru_add_file __pagevec_lru_add +-#endif ++# ifndef HAVE_LINUX_PAGEVEC_LRU_ADD_FILE ++# define __pagevec_lru_add_file __pagevec_lru_add ++# endif + + static inline void + afs_lru_cache_add(struct afs_lru_pages *alrupages, struct page *page) +@@ -99,6 +133,7 @@ afs_lru_cache_finalize(struct afs_lru_pages *alrupages) + if (pagevec_count(&alrupages->lrupv)) + __pagevec_lru_add_file(&alrupages->lrupv); + } ++#endif /* !HAVE_LINUX_LRU_ADD_FILE */ + + /* This function converts a positive error code from AFS into a negative + * code suitable for passing into the Linux VFS layer. It checks that the +diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4 +index 597730f5f..07627db52 100644 +--- a/src/cf/linux-kernel-func.m4 ++++ b/src/cf/linux-kernel-func.m4 +@@ -146,6 +146,11 @@ AC_CHECK_LINUX_FUNC([inode_lock], + [#include <linux/fs.h>], + [inode_lock(NULL);]) + ++dnl lru_cache_add_file added to Linux 2.6.28. ++AC_CHECK_LINUX_FUNC([lru_cache_add_file], ++ [#include <linux/swap.h>], ++ [lru_cache_add_file(NULL);]) ++ + 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"], +-- +2.27.0 + |