diff options
author | Michael Lass | 2020-06-08 17:56:05 +0200 |
---|---|---|
committer | Michael Lass | 2020-06-08 17:56:05 +0200 |
commit | 13463f42e67fcde7ccb4335786a5a1e23bed529d (patch) | |
tree | 92efcd59b84b2edfbe68b93cf0413553b9bcdb27 | |
parent | ec3a4f29161b6663ff8e02c0bfb99a46be3c5b39 (diff) | |
download | aur-13463f42e67fcde7ccb4335786a5a1e23bed529d.tar.gz |
Compatibility with Linux 5.7
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | 0001-Temporary-fix-for-compilation-with-GCC-10.patch | 4 | ||||
-rw-r--r-- | 0002-libafs-Abstract-the-Linux-lru-cache-interface.patch | 238 | ||||
-rw-r--r-- | 0003-LINUX-5.7-replace-__pagevec_lru_add-with-lru_cache_a.patch | 144 | ||||
-rw-r--r-- | PKGBUILD | 14 |
5 files changed, 401 insertions, 7 deletions
@@ -1,7 +1,7 @@ pkgbase = openafs-modules pkgdesc = Kernel module for OpenAFS pkgver = 1.8.6pre2 - pkgrel = 1 + pkgrel = 2 url = http://www.openafs.org install = openafs-modules.install arch = i686 @@ -16,8 +16,12 @@ pkgbase = openafs-modules options = !emptydirs source = http://openafs.org/dl/openafs/candidate/1.8.6pre2/openafs-1.8.6pre2-src.tar.bz2 source = 0001-Temporary-fix-for-compilation-with-GCC-10.patch + source = 0002-libafs-Abstract-the-Linux-lru-cache-interface.patch + source = 0003-LINUX-5.7-replace-__pagevec_lru_add-with-lru_cache_a.patch sha256sums = ae1aa62c977fc13d61df1f9822ff75af301c50f8ff0528c8fd1f2914fffafcf5 - sha256sums = ebd26d2434689ca7f1c71434cf9a524cf8f2457faa2ba93b90723f4244092451 + sha256sums = b067b59bf856d15ded1ee786d303eb7b7ff47edb5b3e078b1d43862b8db62368 + sha256sums = 22d94f69864cde0027716e8bb251406b9fe3745aa6b0f8a16fcb94748e8c3925 + sha256sums = dec56eff34fd1ea492a12d90558edfd4a46b82f203f6e7a1fd7543eb1fb0bc99 pkgname = openafs-modules diff --git a/0001-Temporary-fix-for-compilation-with-GCC-10.patch b/0001-Temporary-fix-for-compilation-with-GCC-10.patch index 7d3e4c501670..65a310e73bd4 100644 --- a/0001-Temporary-fix-for-compilation-with-GCC-10.patch +++ b/0001-Temporary-fix-for-compilation-with-GCC-10.patch @@ -1,7 +1,7 @@ From 240278523907c8a0e733620d6acf7b3933d5cbdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20La=C3=9F?= <lass@mail.uni-paderborn.de> Date: Tue, 19 May 2020 16:17:01 +0200 -Subject: [PATCH 1/2] Temporary fix for compilation with GCC 10 +Subject: [PATCH 1/3] Temporary fix for compilation with GCC 10 See: * https://bugs.gentoo.org/706738 @@ -29,5 +29,5 @@ index 29a79d7ce..ac11e9310 100644 else case $AFS_SYSNAME in -- -2.26.2 +2.27.0 diff --git a/0002-libafs-Abstract-the-Linux-lru-cache-interface.patch b/0002-libafs-Abstract-the-Linux-lru-cache-interface.patch new file mode 100644 index 000000000000..bc1aeae0fc4b --- /dev/null +++ b/0002-libafs-Abstract-the-Linux-lru-cache-interface.patch @@ -0,0 +1,238 @@ +From 0aa55a7c8cb44837fb6d8d41a5902b9ca7baab95 Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills <cwills@sinenomine.net> +Date: Fri, 15 May 2020 10:39:53 -0600 +Subject: [PATCH 2/3] libafs: Abstract the Linux lru cache interface + +Define static functions afs_lru_cache_init, afs_lru_cache_add and +afs_lru_cache_finalize to handle interfacing with Linux's lru +facilities. + +This change's primary purpose is to isolate the preprocessor +conditionals associated with the details of the system lru interfaces to +just these functions and to simplify the areas that utilize lru caching +by removing the preprocessor conditionals. + +As Linux's lru facilities change, additional conditional code will be +needed. + +Reviewed-on: https://gerrit.openafs.org/14167 +Reviewed-by: Andrew Deason <adeason@sinenomine.net> +Tested-by: BuildBot <buildbot@rampaginggeek.com> +Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> +(cherry picked from commit dca95bcb7efdff38564dcff3e8f4189735f13b3a) + +Change-Id: I863bbc9bb578716c42fdf34672ec8ad85f05ea31 +--- + src/afs/LINUX/osi_vnodeops.c | 101 ++++++++++++++++++----------------- + 1 file changed, 53 insertions(+), 48 deletions(-) + +diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c +index 03635212c..96d7a2e33 100644 +--- a/src/afs/LINUX/osi_vnodeops.c ++++ b/src/afs/LINUX/osi_vnodeops.c +@@ -39,10 +39,6 @@ + #include "osi_compat.h" + #include "osi_pagecopy.h" + +-#ifndef HAVE_LINUX_PAGEVEC_LRU_ADD_FILE +-#define __pagevec_lru_add_file __pagevec_lru_add +-#endif +- + #ifndef MAX_ERRNO + #define MAX_ERRNO 1000L + #endif +@@ -69,6 +65,41 @@ extern struct backing_dev_info *afs_backing_dev_info; + + extern struct vcache *afs_globalVp; + ++/* Handle interfacing with Linux's pagevec/lru facilities */ ++ ++struct afs_lru_pages { ++ struct pagevec lrupv; ++}; ++ ++static inline void ++afs_lru_cache_init(struct afs_lru_pages *alrupages) ++{ ++#if defined(PAGEVEC_INIT_COLD_ARG) ++ pagevec_init(&alrupages->lrupv, 0); ++#else ++ pagevec_init(&alrupages->lrupv); ++#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) ++{ ++ get_page(page); ++ if (!pagevec_add(&alrupages->lrupv, page)) ++ __pagevec_lru_add_file(&alrupages->lrupv); ++} ++ ++static inline void ++afs_lru_cache_finalize(struct afs_lru_pages *alrupages) ++{ ++ if (pagevec_count(&alrupages->lrupv)) ++ __pagevec_lru_add_file(&alrupages->lrupv); ++} ++ + /* 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 + * error code is within the permissable bounds for the ERR_PTR mechanism. +@@ -2093,7 +2124,7 @@ afs_linux_put_link(struct dentry *dentry, struct nameidata *nd) + */ + static int + afs_linux_read_cache(struct file *cachefp, struct page *page, +- int chunk, struct pagevec *lrupv, ++ int chunk, struct afs_lru_pages *alrupages, + struct afs_pagecopy_task *task) { + loff_t offset = page_offset(page); + struct inode *cacheinode = cachefp->f_dentry->d_inode; +@@ -2135,11 +2166,7 @@ afs_linux_read_cache(struct file *cachefp, struct page *page, + if (code == 0) { + cachepage = newpage; + newpage = NULL; +- +- get_page(cachepage); +- if (!pagevec_add(lrupv, cachepage)) +- __pagevec_lru_add_file(lrupv); +- ++ afs_lru_cache_add(alrupages, cachepage); + } else { + put_page(newpage); + newpage = NULL; +@@ -2199,7 +2226,7 @@ afs_linux_readpage_fastpath(struct file *fp, struct page *pp, int *codep) + struct file *cacheFp = NULL; + int code; + int dcLocked = 0; +- struct pagevec lrupv; ++ struct afs_lru_pages lrupages; + + /* Not a UFS cache, don't do anything */ + if (cacheDiskType != AFS_FCACHE_TYPE_UFS) +@@ -2285,16 +2312,12 @@ afs_linux_readpage_fastpath(struct file *fp, struct page *pp, int *codep) + AFS_GLOCK(); + goto out; + } +-#if defined(PAGEVEC_INIT_COLD_ARG) +- pagevec_init(&lrupv, 0); +-#else +- pagevec_init(&lrupv); +-#endif + +- code = afs_linux_read_cache(cacheFp, pp, tdc->f.chunk, &lrupv, NULL); ++ afs_lru_cache_init(&lrupages); + +- if (pagevec_count(&lrupv)) +- __pagevec_lru_add_file(&lrupv); ++ code = afs_linux_read_cache(cacheFp, pp, tdc->f.chunk, &lrupages, NULL); ++ ++ afs_lru_cache_finalize(&lrupages); + + filp_close(cacheFp, NULL); + AFS_GLOCK(); +@@ -2424,7 +2447,7 @@ afs_linux_bypass_readpages(struct file *fp, struct address_space *mapping, + struct iovec* iovecp; + struct nocache_read_request *ancr; + struct page *pp; +- struct pagevec lrupv; ++ struct afs_lru_pages lrupages; + afs_int32 code = 0; + + cred_t *credp; +@@ -2449,11 +2472,7 @@ afs_linux_bypass_readpages(struct file *fp, struct address_space *mapping, + ancr->offset = auio->uio_offset; + ancr->length = auio->uio_resid; + +-#if defined(PAGEVEC_INIT_COLD_ARG) +- pagevec_init(&lrupv, 0); +-#else +- pagevec_init(&lrupv); +-#endif ++ afs_lru_cache_init(&lrupages); + + for(page_ix = 0; page_ix < num_pages; ++page_ix) { + +@@ -2499,27 +2518,18 @@ afs_linux_bypass_readpages(struct file *fp, struct address_space *mapping, + lock_page(pp); + } + +- /* increment page refcount--our original design assumed +- * that locking it would effectively pin it; protect +- * ourselves from the possiblity that this assumption is +- * is faulty, at low cost (provided we do not fail to +- * do the corresponding decref on the other side) */ +- get_page(pp); +- + /* save the page for background map */ + iovecp[page_ix].iov_base = (void*) pp; + + /* and put it on the LRU cache */ +- if (!pagevec_add(&lrupv, pp)) +- __pagevec_lru_add_file(&lrupv); ++ afs_lru_cache_add(&lrupages, pp); + } + } + + /* If there were useful pages in the page list, make sure all pages + * are in the LRU cache, then schedule the read */ + if(page_count) { +- if (pagevec_count(&lrupv)) +- __pagevec_lru_add_file(&lrupv); ++ afs_lru_cache_finalize(&lrupages); + credp = crref(); + code = afs_ReadNoCache(avc, ancr, credp); + crfree(credp); +@@ -2650,7 +2660,7 @@ afs_linux_readpages(struct file *fp, struct address_space *mapping, + int code; + unsigned int page_idx; + loff_t offset; +- struct pagevec lrupv; ++ struct afs_lru_pages lrupages; + struct afs_pagecopy_task *task; + + if (afs_linux_bypass_check(inode)) +@@ -2675,11 +2685,9 @@ afs_linux_readpages(struct file *fp, struct address_space *mapping, + task = afs_pagecopy_init_task(); + + tdc = NULL; +-#if defined(PAGEVEC_INIT_COLD_ARG) +- pagevec_init(&lrupv, 0); +-#else +- pagevec_init(&lrupv); +-#endif ++ ++ afs_lru_cache_init(&lrupages); ++ + for (page_idx = 0; page_idx < num_pages; page_idx++) { + struct page *page = list_entry(page_list->prev, struct page, lru); + list_del(&page->lru); +@@ -2719,18 +2727,15 @@ afs_linux_readpages(struct file *fp, struct address_space *mapping, + + if (tdc && !add_to_page_cache(page, mapping, page->index, + GFP_KERNEL)) { +- get_page(page); +- if (!pagevec_add(&lrupv, page)) +- __pagevec_lru_add_file(&lrupv); ++ afs_lru_cache_add(&lrupages, page); + + /* Note that add_to_page_cache() locked 'page'. + * afs_linux_read_cache() is guaranteed to handle unlocking it. */ +- afs_linux_read_cache(cacheFp, page, tdc->f.chunk, &lrupv, task); ++ afs_linux_read_cache(cacheFp, page, tdc->f.chunk, &lrupages, task); + } + put_page(page); + } +- if (pagevec_count(&lrupv)) +- __pagevec_lru_add_file(&lrupv); ++ afs_lru_cache_finalize(&lrupages); + + out: + if (tdc) +-- +2.27.0 + 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 + @@ -6,7 +6,7 @@ pkgname=openafs-modules _srcname=openafs pkgver=1.8.6pre2 -pkgrel=1 +pkgrel=2 pkgdesc="Kernel module for OpenAFS" arch=('i686' 'x86_64' 'armv7h') url="http://www.openafs.org" @@ -16,10 +16,14 @@ makedepends=('libelf' 'linux-headers') conflicts=('openafs-features-libafs' 'openafs<1.6.6-2') options=(!emptydirs) source=("http://openafs.org/dl/openafs/candidate/${pkgver}/${_srcname}-${pkgver}-src.tar.bz2" - 0001-Temporary-fix-for-compilation-with-GCC-10.patch) + 0001-Temporary-fix-for-compilation-with-GCC-10.patch + 0002-libafs-Abstract-the-Linux-lru-cache-interface.patch + 0003-LINUX-5.7-replace-__pagevec_lru_add-with-lru_cache_a.patch) install=openafs-modules.install sha256sums=('ae1aa62c977fc13d61df1f9822ff75af301c50f8ff0528c8fd1f2914fffafcf5' - 'ebd26d2434689ca7f1c71434cf9a524cf8f2457faa2ba93b90723f4244092451') + 'b067b59bf856d15ded1ee786d303eb7b7ff47edb5b3e078b1d43862b8db62368' + '22d94f69864cde0027716e8bb251406b9fe3745aa6b0f8a16fcb94748e8c3925' + 'dec56eff34fd1ea492a12d90558edfd4a46b82f203f6e7a1fd7543eb1fb0bc99') # Heuristic to determine version of installed kernel # You can modify this if the heuristic fails @@ -32,6 +36,10 @@ prepare() { # Fix compilation with GCC 10 (see https://bugs.gentoo.org/706738 and https://gerrit.openafs.org/14106) patch -p1 < "${srcdir}/0001-Temporary-fix-for-compilation-with-GCC-10.patch" + # Fix compatibility with Linux 5.7 (https://gerrit.openafs.org/14209 and https://gerrit.openafs.org/14210) + patch -p1 < "${srcdir}/0002-libafs-Abstract-the-Linux-lru-cache-interface.patch" + patch -p1 < "${srcdir}/0003-LINUX-5.7-replace-__pagevec_lru_add-with-lru_cache_a.patch" + # Only needed when changes to configure were made ./regen.sh -q } |