From bbac6b83b5bfaca0cd40c03caff6d706d3bbba72 Mon Sep 17 00:00:00 2001
From: adilger <adilger>
Date: Wed, 22 Oct 2008 23:39:19 +0000
Subject: [PATCH] Branch HEAD Make releasepage check failsafe for newer
 kernels, per Robert's suggestion.

---
 lustre/autoconf/lustre-core.m4 | 18 +++++++++---------
 lustre/llite/rw26.c            |  6 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index bb5e8b1488..6c963ad3b1 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -123,19 +123,18 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
-# LC_FUNC_RELEASEPAGE_WITH_GFP
+# LC_FUNC_RELEASEPAGE_WITH_INT
 #
-# if ->releasepage() takes a gfp_t arg in 2.6.9
+# if ->releasepage() takes an int arg in 2.6.9
 # This kernel defines gfp_t (HAS_GFP_T) but doesn't use it for this function,
 # while others either don't have gfp_t or pass gfp_t as the parameter.
 #
-AC_DEFUN([LC_FUNC_RELEASEPAGE_WITH_GFP],
-[AC_MSG_CHECKING([if releasepage has a gfp_t parameter])
-RELEASEPAGE_WITH_GFP="`grep -c 'releasepage.*gfp_t'
-$LINUX/include/linux/fs.h`"
-if test "$RELEASEPAGE_WITH_GFP" != 0 ; then
-        AC_DEFINE(HAVE_RELEASEPAGE_WITH_GFP, 1,
-                  [releasepage with gfp_t parameter])
+AC_DEFUN([LC_FUNC_RELEASEPAGE_WITH_INT],
+[AC_MSG_CHECKING([if releasepage has a int parameter])
+RELEASEPAGE_WITH_INT="`grep -c 'releasepage.*int' $LINUX/include/linux/fs.h`"
+if test "$RELEASEPAGE_WITH_INT" != 0 ; then
+        AC_DEFINE(HAVE_RELEASEPAGE_WITH_INT, 1,
+                  [releasepage with int parameter])
         AC_MSG_RESULT([yes])
 else
         AC_MSG_RESULT([no])
@@ -1548,6 +1547,7 @@ AC_DEFUN([LC_PROG_LINUX],
 
          LC_STRUCT_KIOBUF
          LC_FUNC_COND_RESCHED
+         LC_FUNC_RELEASEPAGE_WITH_INT
          LC_FUNC_ZAP_PAGE_RANGE
          LC_FUNC_PDE
          LC_FUNC_DIRECT_IO
diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c
index 39585881d5..f82c41b23d 100644
--- a/lustre/llite/rw26.c
+++ b/lustre/llite/rw26.c
@@ -94,10 +94,10 @@ static void ll_invalidatepage(struct page *page, unsigned long offset)
 }
 #endif
 
-#ifdef HAVE_RELEASEPAGE_WITH_GFP
-#define RELEASEPAGE_ARG_TYPE gfp_t
-#else
+#ifdef HAVE_RELEASEPAGE_WITH_INT
 #define RELEASEPAGE_ARG_TYPE int
+#else
+#define RELEASEPAGE_ARG_TYPE gfp_t
 #endif
 static int ll_releasepage(struct page *page, RELEASEPAGE_ARG_TYPE gfp_mask)
 {
-- 
GitLab