Whamcloud - gitweb
LU-73 Make register_shrinker argument more visible.
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
index fe3afd5..5f020d5 100644 (file)
@@ -1598,7 +1598,29 @@ AC_DEFUN([LC_REGISTER_SHRINKER],
 [mm/vmscan.c],[
         AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
                   [kernel exports register_shrinker])
+# 2.6.32 added another argument to struct shrinker->shrink
+        AC_MSG_CHECKING([if passing shrinker as first argument])
+        tmp_flags="$EXTRA_KCFLAGS"
+        EXTRA_KCFLAGS="-Werror"
+        LB_LINUX_TRY_COMPILE([
+                #include <linux/mm.h>
+                int test_shrink(struct shrinker *, int, gfp_t);
+        ],[
+                struct shrinker *shr = NULL;
+                shr->shrink = test_shrink;
+        ],[
+                AC_MSG_RESULT([yes])
+                AC_DEFINE(SHRINKER_FIRST_ARG, [struct shrinker *shrinker,],
+                        [kernel is passing shrinker as first argument])
+        ],[
+                AC_DEFINE(SHRINKER_FIRST_ARG, ,
+                        [kernel is not passing shrinker as first argument])
+        ])
+        EXTRA_KCFLAGS="$tmp_flags"
 ],[
+       AC_DEFINE(SHRINKER_FIRST_ARG, ,
+                  [kernel does not exports register_shrinker,
+                  so SHRINKER_FIRST_ARG is empty])
 ])
 ])
 
@@ -1921,6 +1943,9 @@ AC_DEFUN([LC_HAVE_QUOTAIO_V1_H],
 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v1.h],[
         AC_DEFINE(HAVE_QUOTAIO_V1_H, 1,
                 [kernel has include/linux/quotaio_v1.h])
+],[LB_CHECK_FILE([$LINUX/fs/quotaio_v1.h],[
+               AC_DEFINE(HAVE_FS_QUOTAIO_V1_H, 1,
+                [kernel has fs/quotaio_v1.h])
 ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v1.h],[
                AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_V1_H, 1,
                 [kernel has fs/quota/quotaio_v1.h])
@@ -1929,6 +1954,7 @@ AC_DEFUN([LC_HAVE_QUOTAIO_V1_H],
 ])
 ])
 ])
+])
 
 # sles10 sp2 need 5 parameter for vfs_symlink
 AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
@@ -2079,23 +2105,6 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-# 2.6.32-71 adds an argument to shrink callback
-AC_DEFUN([LC_SHRINK_3ARGS],
-[AC_MSG_CHECKING([if shrink has 3 arguments])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/mm.h>
-],[
-        struct shrinker s;
-        return s.shrink(NULL, 0, 0);
-],[
-        AC_MSG_RESULT(yes)
-        AC_DEFINE(HAVE_SHRINK_3ARGS, 1,
-                  [shrink has 3 arguments])
-],[
-        AC_MSG_RESULT(no)
-])
-])
-
 #
 # LC_EXT4_SINGLEDATA_TRANS_BLOCKS_SB
 #
@@ -2121,7 +2130,11 @@ EXTRA_KCFLAGS="$tmp_flags"
 
 #
 # LC_QUOTA64
-# linux kernel have 64-bit limits support
+#
+# Check if kernel has been patched for 64-bit quota limits support.
+# The upstream version of this patch in RHEL6 2.6.32 kernels introduces
+# the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
+# that in the absence of quotaio_v1.h in the kernel headers.
 #
 AC_DEFUN([LC_QUOTA64],[
         AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
@@ -2134,13 +2147,15 @@ EXTRA_KCFLAGS="-I$LINUX/fs"
                 # include <linux/quotaio_v2.h>
                 int versions[] = V2_INITQVERSIONS_R1;
                 struct v2_disk_dqblk_r1 dqblk_r1;
-                #else
-                # ifdef HAVE_FS_QUOTA_QUOTAIO_V1_H
-                #  include <quota/quotaio_v2.h>
-                # else
-                #  include <quotaio_v2.h>
-                # endif
+                #elif defined(HAVE_FS_QUOTA_QUOTAIO_V1_H)
+                # include <quota/quotaio_v2.h>
                 struct v2r1_disk_dqblk dqblk_r1;
+                #elif defined(HAVE_FS_QUOTAIO_V1_H)
+                # include <quotaio_v2.h>
+                struct v2r1_disk_dqblk dqblk_r1;
+                #else
+                #include <linux/quota.h>
+                int ver = QFMT_VFS_V1;
                 #endif
         ],[],[
                 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
@@ -2336,7 +2351,6 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_SB_BDI
          LC_BLK_QUEUE_MAX_SECTORS
          LC_BLK_QUEUE_MAX_SEGMENTS
-         LC_SHRINK_3ARGS
          LC_EXT4_SINGLEDATA_TRANS_BLOCKS_SB
 
          #