Whamcloud - gitweb
LU-354 test: Change dev_set_rdonly() check to warning
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
index b069946..061d457 100644 (file)
@@ -85,27 +85,6 @@ AC_TRY_COMPILE([
 ])
 
 #
-# LC_FUNC_RELEASEPAGE_WITH_GFP
-#
-# 2.6.9 ->releasepage() takes a gfp_t arg
-# 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_MSG_RESULT([yes])
-else
-       AC_MSG_RESULT([no])
-fi
-])
-
-
-
-#
 # only for Lustre-patched kernels
 #
 AC_DEFUN([LC_LUSTRE_VERSION_H],
@@ -125,24 +104,15 @@ AC_DEFUN([LC_LUSTRE_VERSION_H],
 #
 # LC_FUNC_DEV_SET_RDONLY
 #
-# check for the old-style dev_set_rdonly which took an extra "devno" param
-# and can only set a single device to discard writes at one time
+# check whether dev_set_rdonly is exported.  This is needed until we
+# have another mechanism to fence IO from the underlying device.
 #
 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
-[AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/fs.h>
-        #include <linux/blkdev.h>
+[LB_CHECK_SYMBOL_EXPORT([dev_set_rdonly],
+[block/ll_rw_block.c,block/blk-core.c],[
+        AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel exports dev_set_rdonly])
 ],[
-        #ifndef HAVE_CLEAR_RDONLY_ON_PUT
-        #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
-        #endif
-],[
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
-],[
-        AC_MSG_ERROR([no, Linux kernel source needs to be patches by lustre
-kernel patches from Lustre version 1.4.3 or above.])
+        AC_MSG_WARN([kernel missing dev_set_rdonly patch for testing])
 ])
 ])
 
@@ -269,7 +239,7 @@ AC_DEFUN([LC_QUOTA_MODULE],
 fi
 ])
 
-# truncate_complete_page() was exported from RHEL5/SLES10/SLES11
+# truncate_complete_page() was exported from RHEL5/SLES10, but not in SLES11 SP0 (2.6.27)
 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
 # delete_from_page_cache() is exported from 2.6.39
 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
@@ -287,15 +257,6 @@ AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
                                             [kernel export delete_from_page_cache])])
          ])
 
-AC_DEFUN([LC_EXPORT_TRUNCATE_RANGE],
-[LB_CHECK_SYMBOL_EXPORT([truncate_inode_pages_range],
-[mm/truncate.c],[
-AC_DEFINE(HAVE_TRUNCATE_RANGE, 1,
-            [kernel export truncate_inode_pages_range])
-],[
-])
-])
-
 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
 [fs/dcache.c],[
@@ -337,46 +298,6 @@ AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
           ])
 
 #
-# LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
-#
-# Check for our patched grab_cache_page_nowait_gfp() function
-# after 2.6.29 we can emulate this using add_to_page_cache_lru()
-#
-AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
-[LB_CHECK_SYMBOL_EXPORT([grab_cache_page_nowait_gfp],
-[mm/filemap.c],[
-        AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
-                  [kernel exports grab_cache_page_nowait_gfp])
-        ],
-        [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
-        [mm/filemap.c],[
-                AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
-                        [kernel exports add_to_page_cache_lru])
-        ],[
-        ])
-        ])
-])
-
-#
-# LC_STRUCT_STATFS
-#
-# AIX does not have statfs.f_namelen
-#
-AC_DEFUN([LC_STRUCT_STATFS],
-[AC_MSG_CHECKING([if struct statfs has a f_namelen field])
-LB_LINUX_TRY_COMPILE([
-       #include <linux/vfs.h>
-],[
-       struct statfs sfs;
-       sfs.f_namelen = 1;
-],[
-       AC_MSG_RESULT([yes])
-       AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
-],[
-       AC_MSG_RESULT([no])
-])
-])
-
 #
 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
 #
@@ -396,23 +317,6 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
-# added in 2.6.15
-#
-AC_DEFUN([LC_D_ADD_UNIQUE],
-[AC_MSG_CHECKING([for d_add_unique])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/dcache.h>
-],[
-       d_add_unique(NULL, NULL);
-],[
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
-#
 # added in 2.6.17
 #
 AC_DEFUN([LC_BIT_SPINLOCK_H],
@@ -433,45 +337,8 @@ AC_DEFUN([LC_BIT_SPINLOCK_H],
 ])
 
 #
-# After 2.6.26 we no longer have xattr_acl.h
+# LC_CONST_ACL_SIZE
 #
-AC_DEFUN([LC_XATTR_ACL],
-[LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
-       AC_MSG_CHECKING([if xattr_acl.h can be compiled])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/xattr_acl.h>
-       ],[],[
-               AC_MSG_RESULT([yes])
-               AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
-       ],[
-               AC_MSG_RESULT([no])
-       ])
-],
-[])
-])
-
-#
-# After 2.6.16 the xattr_acl API is removed, and posix_acl is used instead
-#
-AC_DEFUN([LC_POSIX_ACL_XATTR_H],
-[LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
-        AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
-        LB_LINUX_TRY_COMPILE([
-                #include <linux/fs.h>
-                #include <linux/posix_acl_xattr.h>
-        ],[],[
-                AC_MSG_RESULT([yes])
-                AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
-
-        ],[
-                AC_MSG_RESULT([no])
-        ])
-$1
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
 AC_DEFUN([LC_CONST_ACL_SIZE],
 [AC_MSG_CHECKING([calc acl size])
 tmp_flags="$CFLAGS"
@@ -483,22 +350,16 @@ AC_TRY_RUN([
         // block include
         #define __LINUX_POSIX_ACL_H
 
-        # ifdef CONFIG_FS_POSIX_ACL
-        #  ifdef HAVE_XATTR_ACL
-        #   include <linux/xattr_acl.h>
-        #  endif
-        #  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
-        #   include <linux/posix_acl_xattr.h>
-        #  endif
-        # endif
-
-        #include <lustre_acl.h>
+        #ifdef CONFIG_FS_POSIX_ACL
+        # include <linux/posix_acl_xattr.h>
+        #endif
 
         #include <stdio.h>
 
         int main(void)
         {
-            int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
+                /* LUSTRE_POSIX_ACL_MAX_ENTRIES  = 32 */
+            int size = posix_acl_xattr_size(32);
             FILE *f = fopen("acl.size","w+");
             fprintf(f,"%d", size);
             fclose(f);
@@ -1578,26 +1439,6 @@ AC_DEFUN([LC_EXPORT_BDI_INIT],
 ])
 ])
 
-# 2.6.25
-
-# 2.6.25 change define to inline
-AC_DEFUN([LC_MAPPING_CAP_WRITEBACK_DIRTY],
-[AC_MSG_CHECKING([if kernel have mapping_cap_writeback_dirty])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/backing-dev.h>
-],[
-        #ifndef mapping_cap_writeback_dirty
-        mapping_cap_writeback_dirty(NULL);
-        #endif
-],[
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_MAPPING_CAP_WRITEBACK_DIRTY, 1,
-                [kernel have mapping_cap_writeback_dirty])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
 # 2.6.26
 
 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
@@ -1806,26 +1647,6 @@ AC_DEFUN([LC_HAVE_QUOTAIO_H],
 ])
 ])
 
-# sles10 sp2 need 5 parameter for vfs_symlink
-AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
-[AC_MSG_CHECKING([vfs_symlink need 5 parameter])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/fs.h>
-],[
-        struct inode *dir = NULL;
-        struct dentry *dentry = NULL;
-        struct vfsmount *mnt = NULL;
-        const char * path = NULL;
-        vfs_symlink(dir, dentry, mnt, path, 0);
-],[
-        AC_DEFINE(HAVE_VFS_SYMLINK_5ARGS, 1,
-                [vfs_symlink need 5 parameteres])
-        AC_MSG_RESULT([yes])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
 # 2.6.27 sles11 has sb_any_quota_active
 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
@@ -2083,6 +1904,7 @@ AC_DEFUN([LC_SET_CPUS_ALLOWED],
 # LC_D_OBTAIN_ALIAS
 # starting from 2.6.28 kernel replaces d_alloc_anon() with
 # d_obtain_alias() for getting anonymous dentries
+# RHEL5(2.6.18) has d_obtain_alias but SLES11SP0(2.6.27) not
 #
 AC_DEFUN([LC_D_OBTAIN_ALIAS],
 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
@@ -2100,6 +1922,19 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
+#
+AC_DEFUN([LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE],
+         [LB_CHECK_SYMBOL_EXPORT(
+                        [generic_error_remove_page],
+                        [mm/truncate.c],
+                        [AC_DEFINE(HAS_GENERIC_ERROR_REMOVE_PAGE, 1,
+                                [kernel export generic_error_remove_page])],
+                        [])
+         ]
+)
+
+#
 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
 #
 AC_DEFUN([LC_FS_STRUCT_RWLOCK],
@@ -2277,19 +2112,13 @@ AC_DEFUN([LC_PROG_LINUX],
 
          # RHEL4 patches
          LC_EXPORT_TRUNCATE_COMPLETE
-         LC_EXPORT_TRUNCATE_RANGE
          LC_EXPORT_D_REHASH_COND
          LC_EXPORT___D_REHASH
          LC_EXPORT_NODE_TO_CPUMASK
 
-         LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
-         LC_STRUCT_STATFS
          LC_FILEMAP_POPULATE
-         LC_D_ADD_UNIQUE
          LC_BIT_SPINLOCK_H
 
-         LC_XATTR_ACL
-         LC_POSIX_ACL_XATTR_H
          LC_CONST_ACL_SIZE
 
          LC_STRUCT_INTENT_FILE
@@ -2311,7 +2140,6 @@ AC_DEFUN([LC_PROG_LINUX],
 
          # 2.6.12
          LC_RW_TREE_LOCK
-         LC_EXPORT_SYNCHRONIZE_RCU
 
          # 2.6.15
          LC_INODE_I_MUTEX
@@ -2375,9 +2203,6 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_PROCFS_DELETED
          LC_EXPORT_BDI_INIT
 
-         #2.6.25
-         LC_MAPPING_CAP_WRITEBACK_DIRTY
-
          # 2.6.26
          LC_FS_STRUCT_USE_PATH
 
@@ -2395,7 +2220,6 @@ AC_DEFUN([LC_PROG_LINUX],
          # 2.6.27.15-2 sles11
          LC_BI_HW_SEGMENTS
          LC_HAVE_QUOTAIO_H
-         LC_VFS_SYMLINK_5ARGS
          LC_BDI_NAME
          LC_SB_ANY_QUOTA_ACTIVE
          LC_SB_HAS_QUOTA_ACTIVE
@@ -2418,6 +2242,7 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_BLK_QUEUE_MAX_SEGMENTS
          LC_SET_CPUS_ALLOWED
          LC_CACHE_UPCALL
+         LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
 
          # 2.6.35
          LC_FILE_FSYNC
@@ -2669,6 +2494,7 @@ if test x$enable_split != xno; then
 fi
 ])
 
+# RHEL5(2.6.18) has tux_info
 AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
 [AC_MSG_CHECKING([tux_info])
 LB_LINUX_TRY_COMPILE([
@@ -2860,6 +2686,7 @@ lustre/doc/Makefile
 lustre/include/Makefile
 lustre/include/lustre_ver.h
 lustre/include/linux/Makefile
+lustre/include/darwin/Makefile
 lustre/include/lustre/Makefile
 lustre/kernel_patches/targets/2.6-rhel6.target
 lustre/kernel_patches/targets/2.6-rhel5.target