SHA256
1
0
forked from pool/openafs
openafs/b885159.diff
Christof Hanke b1c152b8d6 Accepting request 1069163 from home:hauky:branches:filesystems
- apply patch from upstream for kernel 6.2:
  * b885159.diff
- change BuildArch for subpackage kernel-source to noarch

OBS-URL: https://build.opensuse.org/request/show/1069163
OBS-URL: https://build.opensuse.org/package/show/filesystems/openafs?expand=0&rev=103
2023-03-03 13:27:16 +00:00

84 lines
3.0 KiB
Diff

From b885159cc2bc6c746aec1d54cdd8a515d1115d14 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Wed, 14 Dec 2022 13:40:48 -0700
Subject: [PATCH] Linux: Replace lru_cache_add with folio_add_lru
The Linux 6.2 commit:
"folio-compat: remove lru_cache_add()" (6e1ca48d0)
removed the lru_cache_add() function (which was introduced in Linux 5.8)
The replacement function is folio_add_lru(), which was introduced with
the Linux 5.16 commit:
"mm/lru: Add folio_add_lru()" (0d31125d2d)
Reviewed-on: https://gerrit.openafs.org/15227
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit cfac0df9cd7152be2672c665442aac84215494d6)
Change-Id: I74535bf83cdd47c9dd60a7114ec7694ae9981c9b
Reviewed-on: https://gerrit.openafs.org/15281
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
---
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index 5ff3a16..d875788 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -32,7 +32,7 @@
#endif
#include <linux/pagemap.h>
#include <linux/writeback.h>
-#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
+#if defined(HAVE_LINUX_FOLIO_ADD_LRU) || defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
# include <linux/swap.h>
#else
# include <linux/pagevec.h>
@@ -78,7 +78,8 @@
/* Handle interfacing with Linux's pagevec/lru facilities */
-#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) || defined(HAVE_LINUX_LRU_CACHE_ADD)
+#if defined(HAVE_LINUX_FOLIO_ADD_LRU) || \
+ 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
@@ -97,7 +98,10 @@
static inline void
afs_lru_cache_add(struct afs_lru_pages *alrupages, struct page *page)
{
-# if defined(HAVE_LINUX_LRU_CACHE_ADD)
+# if defined(HAVE_LINUX_FOLIO_ADD_LRU)
+ struct folio *folio = page_folio(page);
+ folio_add_lru(folio);
+# elif defined(HAVE_LINUX_LRU_CACHE_ADD)
lru_cache_add(page);
# elif defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
lru_cache_add_file(page);
diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
index 504c731..a53c186 100644
--- a/src/cf/linux-kernel-func.m4
+++ b/src/cf/linux-kernel-func.m4
@@ -173,10 +173,17 @@
dnl lru_cache_add exported in Linux 5.8
dnl replaces lru_cache_add_file
+dnl removed in linux 6.1. folio_add_lru is a replacement
AC_CHECK_LINUX_FUNC([lru_cache_add],
[#include <linux/swap.h>],
[lru_cache_add(NULL);])
+dnl Linux 5.16 added folio_add_lru as a replacement for
+dnl lru_cache_add
+AC_CHECK_LINUX_FUNC([folio_add_lru],
+ [#include <linux/swap.h>],
+ [folio_add_lru(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],