Whamcloud - gitweb
LU-867 gss: adapt to 2.6.32 kernel changes cache_detail
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
index 4fea8cc..10fea4d 100644 (file)
@@ -979,11 +979,10 @@ EXTRA_KCFLAGS="-Werror"
 LB_LINUX_TRY_COMPILE([
         #include <linux/fs.h>
 ],[
-        struct super_operations *sop = NULL;
-        sop->statfs((struct dentry *)0, (struct kstatfs*)0);
+        ((struct super_operations *)0)->statfs((struct dentry *)0, (struct kstatfs*)0);
 ],[
         AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
-                [super_ops.statfs() first parameter is dentry])
+                  [super_ops.statfs() first parameter is dentry])
         AC_MSG_RESULT([yes])
 ],[
         AC_MSG_RESULT([no])
@@ -1159,19 +1158,20 @@ LB_LINUX_TRY_COMPILE([
 AC_DEFUN([LC_PAGE_CHECKED],
 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
 LB_LINUX_TRY_COMPILE([
+        #include <linux/mm.h>
 #ifdef HAVE_LINUX_MMTYPES_H
         #include <linux/mm_types.h>
 #endif
-       #include <linux/page-flags.h>
+        #include <linux/page-flags.h>
 ],[
-       struct page *p;
+        struct page *p = NULL;
 
         /* before 2.6.26 this define*/
         #ifndef PageChecked    
-       /* 2.6.26 use function instead of define for it */
-       SetPageChecked(p);
-       PageChecked(p);
-       #endif
+        /* 2.6.26 use function instead of define for it */
+        SetPageChecked(p);
+        PageChecked(p);
+        #endif
 ],[
         AC_MSG_RESULT(yes)
         AC_DEFINE(HAVE_PAGE_CHECKED, 1,
@@ -1879,7 +1879,23 @@ AC_DEFUN([LC_EXPORT_ADD_TO_PAGE_CACHE_LRU],
 ])
 ])
 
-# 2.6.31
+#
+# 2.6.29 introduce sb_any_quota_loaded.
+#
+AC_DEFUN([LC_SB_ANY_QUOTA_LOADED],
+[AC_MSG_CHECKING([Kernel has sb_any_quota_loaded])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/quotaops.h>
+],[
+        sb_any_quota_loaded(NULL);
+],[
+        AC_DEFINE(HAVE_SB_ANY_QUOTA_LOADED, 1,
+                [Kernel has a sb_any_quota_loaded])
+        AC_MSG_RESULT([yes])
+],[
+        AC_MSG_RESULT([no])
+])
+])
 
 # 2.6.30 x86 node_to_cpumask has been removed. must use cpumask_of_node
 AC_DEFUN([LC_EXPORT_CPUMASK_OF_NODE],
@@ -1908,6 +1924,24 @@ LB_LINUX_TRY_COMPILE([
 
 # 2.6.32
 
+# 2.6.32 changes cache_detail's member cache_request to cache_upcall
+# in kernel commit bc74b4f5e63a09fb78e245794a0de1e5a2716bbe
+AC_DEFUN([LC_CACHE_UPCALL],
+[AC_MSG_CHECKING([if cache_detail has cache_upcall field])
+        LB_LINUX_TRY_COMPILE([
+                #include <linux/sunrpc/cache.h>
+        ],[
+                struct cache_detail cd;
+                cd.cache_upcall = NULL;
+        ],[
+                AC_MSG_RESULT(yes)
+                AC_DEFINE(HAVE_CACHE_UPCALL, 1,
+                          [cache_detail has cache_upcall field])
+        ],[
+                AC_MSG_RESULT(no)
+        ])
+])
+
 # 2.6.32 add a limits member in struct request_queue.
 AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
 [AC_MSG_CHECKING([if request_queue has a limits field])
@@ -2077,6 +2111,26 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# 2.6.36 fs_struct.lock use spinlock instead of rwlock.
+#
+AC_DEFUN([LC_FS_STRUCT_RWLOCK],
+[AC_MSG_CHECKING([if fs_struct.lock use rwlock])
+LB_LINUX_TRY_COMPILE([
+        #include <asm/atomic.h>
+        #include <linux/spinlock.h>
+        #include <linux/fs_struct.h>
+],[
+        ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
+],[
+        AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1,
+                  [fs_struct.lock use rwlock])
+        AC_MSG_RESULT([yes])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
+#
 # 2.6.36 super_operations add evict_inode method. it hybird of
 # delete_inode & clear_inode.
 #
@@ -2146,6 +2200,28 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# 2.6.38 use path as 4th parameter in quota_on.
+#
+AC_DEFUN([LC_QUOTA_ON_USE_PATH],
+[AC_MSG_CHECKING([quota_on use path as parameter])
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+        #include <linux/quota.h>
+],[
+        ((struct quotactl_ops *)0)->quota_on(NULL, 0, 0, ((struct path*)0));
+],[
+        AC_DEFINE(HAVE_QUOTA_ON_USE_PATH, 1,
+                [quota_on use path as 4th paramter])
+        AC_MSG_RESULT([yes])
+],[
+        AC_MSG_RESULT([no])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+])
+
+#
 # 2.6.39 remove unplug_fn from request_queue.
 #
 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN],
@@ -2184,6 +2260,18 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# 2.6.38 export simple_setattr
+#
+AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR],
+[LB_CHECK_SYMBOL_EXPORT([simple_setattr],
+[fs/libfs.c],[
+AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
+            [simple_setattr is exported by the kernel])
+],[
+])
+])
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -2324,6 +2412,9 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_SB_HAS_QUOTA_ACTIVE
          LC_EXPORT_ADD_TO_PAGE_CACHE_LRU
 
+         # 2.6.29
+         LC_SB_ANY_QUOTA_LOADED
+
          # 2.6.30
          LC_EXPORT_CPUMASK_OF_NODE
 
@@ -2337,17 +2428,21 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_BLK_QUEUE_MAX_SECTORS
          LC_BLK_QUEUE_MAX_SEGMENTS
          LC_SET_CPUS_ALLOWED
+         LC_CACHE_UPCALL
 
          # 2.6.35
          LC_FILE_FSYNC
+         LC_EXPORT_SIMPLE_SETATTR
 
          # 2.6.36
+         LC_FS_STRUCT_RWLOCK
          LC_SBOPS_EVICT_INODE
 
          # 2.6.38
          LC_ATOMIC_MNT_COUNT
          LC_BLKDEV_GET_BY_DEV
          LC_GENERIC_PERMISSION
+         LC_QUOTA_ON_USE_PATH
 
          # 2.6.39
          LC_REQUEST_QUEUE_UNPLUG_FN