Whamcloud - gitweb
b=23460 make page state changes tracking optinal
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
index 4322364..c632a48 100644 (file)
@@ -8,6 +8,7 @@
 AC_DEFUN([LC_CONFIG_SRCDIR],
 [AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
 libcfs_is_module=yes
+ldiskfs_is_ext4=yes
 ])
 
 #
@@ -420,6 +421,7 @@ 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])
@@ -430,19 +432,7 @@ AC_DEFUN([LC_POSIX_ACL_XATTR_H],
         ])
 $1
 ],[
-AC_MSG_RESULT([no])
-])
-])
-
-#
-# LC_EXPORT___IGET
-# starting from 2.6.19 linux kernel exports __iget()
-#
-AC_DEFUN([LC_EXPORT___IGET],
-[LB_CHECK_SYMBOL_EXPORT([__iget],
-[fs/inode.c],[
-        AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
-],[
+        AC_MSG_RESULT([no])
 ])
 ])
 
@@ -646,6 +636,29 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+# LC_FLUSH_OWNER_ID
+# starting from 2.6.18 the file_operations .flush
+# method has a new "fl_owner_t id" parameter
+#
+AC_DEFUN([LC_FLUSH_OWNER_ID],
+[AC_MSG_CHECKING([if file_operations .flush has an fl_owner_t id])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+],[
+        struct file_operations *fops = NULL;
+        fl_owner_t id;
+        int i;
+
+        i = fops->flush(NULL, id);
+],[
+        AC_DEFINE(HAVE_FLUSH_OWNER_ID, 1,
+                [file_operations .flush method has an fl_owner_t id])
+        AC_MSG_RESULT([yes])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
 #
 # LC_STATFS_DENTRY_PARAM
 # starting from 2.6.18 linux kernel uses dentry instead of
@@ -687,6 +700,26 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# LC_D_OBTAIN_ALIAS
+# starting from 2.6.18 kernel don't export do_kern_mount
+# and want to use vfs_kern_mount instead.
+#
+AC_DEFUN([LC_D_OBTAIN_ALIAS],
+[AC_MSG_CHECKING([d_obtain_alias exist in kernel])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/dcache.h>
+],[
+        d_obtain_alias(NULL);
+],[
+        AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
+                [d_obtain_alias exist in kernel])
+        AC_MSG_RESULT([yes])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
+#
 # LC_INVALIDATEPAGE_RETURN_INT
 # 2.6.17 changes return type for invalidatepage to 'void' from 'int'
 #
@@ -852,26 +885,28 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 # LC_CANCEL_DIRTY_PAGE
-# 2.6.20 introduse cancel_dirty_page instead of
-# clear_page_dirty.
+# 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
-[AC_MSG_CHECKING([kernel has cancel_dirty_page])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/mm.h>
-        #include <linux/page-flags.h>
+        [AC_MSG_CHECKING([kernel has cancel_dirty_page])
+        # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
+        # backport is broken, so ignore it
+        if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
+           test "$(sed -ne '/^static inline void cancel_dirty_page(struct page \*page, unsigned int account_size)$/,/^}$/p' $OFED_BACKPORT_PATH/linux/mm.h | md5sum)" = "c518cb32d6394760c5bca14cb7538d3e  -"; then
+                AC_MSG_RESULT(no)
+        else
+                LB_LINUX_TRY_COMPILE([
+                        #include <linux/mm.h>
+                        #include <linux/page-flags.h>
 ],[
-        /* tmp workaround for broken OFED 1.4.1 at SLES10 */
-        #if defined(CONFIG_SLE_VERSION) && CONFIG_SLE_VERSION == 10 && defined(_BACKPORT_LINUX_MM_H_)
-        #error badly implementation of cancel_dirty_pages
-        #endif
-        cancel_dirty_page(NULL, 0);
+                        cancel_dirty_page(NULL, 0);
 ],[
-        AC_MSG_RESULT(yes)
-        AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
-                  [kernel has cancel_dirty_page instead of clear_page_dirty])
+                        AC_MSG_RESULT(yes)
+                        AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
+                                  [kernel has cancel_dirty_page instead of clear_page_dirty])
 ],[
-        AC_MSG_RESULT(no)
+                        AC_MSG_RESULT(no)
 ])
+        fi
 ])
 
 #
@@ -1374,7 +1409,7 @@ EXTRA_KCFLAGS="$tmp_flags"
 AC_DEFUN([LC_CONST_ACL_SIZE],
 [AC_MSG_CHECKING([calc acl size])
 tmp_flags="$CFLAGS"
-CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 $EXTRA_KCFLAGS"
+CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 -I$LINUX/arch/`uname -m|sed -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include $EXTRA_KCFLAGS"
 AC_TRY_RUN([
 #define __KERNEL__
 #include <linux/autoconf.h>
@@ -1632,15 +1667,21 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-# 2.6.27 sles11 move the quotaio_v1.h to fs
+#
+# 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
+# 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
 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/quota/quotaio_v1.h],[
+               AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_V1_H, 1,
+                [kernel has fs/quota/quotaio_v1.h])
 ],[
         AC_MSG_RESULT([no])
 ])
 ])
+])
 
 # sles10 sp2 need 5 parameter for vfs_symlink
 AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
@@ -1792,20 +1833,96 @@ AC_DEFUN([LC_LINUX_FIEMAP_H],
 [])
 ])
 
-# 2.6.17 super_block use s_vfs_rename_mutex instead of s_vfs_rename_sem
-AC_DEFUN([LC_VFS_RENAME_MUTEX],
-[AC_MSG_CHECKING([super_block has s_vfs_rename_mutex])
+# LC_LOCK_MAP_ACQUIRE
+# after 2.6.27 lock_map_acquire replaces lock_acquire
+AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
+[AC_MSG_CHECKING([if lock_map_acquire is defined])
 LB_LINUX_TRY_COMPILE([
-        #include <linux/fs.h>
+        #include <linux/lockdep.h>
 ],[
-        struct super_block sb;
-        mutex_lock(&sb.s_vfs_rename_mutex);
+        lock_map_acquire(NULL);
 ],[
-        AC_DEFINE(HAVE_VFS_RENAME_MUTEX, 1,
-                [super_block has s_vfs_rename_mutex])
-        AC_MSG_RESULT([yes])
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
+                [lock_map_acquire is defined])
+],[
+        AC_MSG_RESULT(no)
+])
+])
+
+# 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
+AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
+[AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/blkdev.h>
+],[
+        blk_queue_logical_block_size(NULL, 0);
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
+                  [blk_queue_logical_block_size is defined])
+],[
+        AC_MSG_RESULT(no)
+])
+])
+
+# 2.6.32 without DQUOT_INIT defined.
+AC_DEFUN([LC_DQUOT_INIT],
+[AC_MSG_CHECKING([if DQUOT_INIT is defined])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/quotaops.h>
+],[
+        DQUOT_INIT(NULL);
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_DQUOT_INIT, 1,
+                  [DQUOT_INIT is defined])
+],[
+        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])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/blkdev.h>
+],[
+        struct request_queue rq;
+        rq.limits.io_min = 0;
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
+                  [request_queue has a limits field])
+],[
+        AC_MSG_RESULT(no)
+])
+])
+
+# 2.6.32 has new BDI interface.
+AC_DEFUN([LC_NEW_BACKING_DEV_INFO],
+[AC_MSG_CHECKING([if backing_dev_info has a wb_cnt field])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/backing-dev.h>
+],[
+        struct backing_dev_info bdi;
+        bdi.wb_cnt = 0;
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_NEW_BACKING_DEV_INFO, 1,
+                  [backing_dev_info has a wb_cnt field])
+],[
+        AC_MSG_RESULT(no)
+])
+])
+
+# 2.6.24 has bdi_init()/bdi_destroy() functions.
+AC_DEFUN([LC_EXPORT_BDI_INIT],
+[LB_CHECK_SYMBOL_EXPORT([bdi_init],
+[mm/backing-dev.c],[
+        AC_DEFINE(HAVE_BDI_INIT, 1,
+                [bdi_init/bdi_destroy functions are present])
 ],[
-        AC_MSG_RESULT([no])
 ])
 ])
 
@@ -1861,7 +1978,7 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_COOKIE_FOLLOW_LINK
          LC_FUNC_RCU
          LC_PERCPU_COUNTER
-         LC_QUOTA64
+         LC_TASK_CLENV_STORE
          LC_4ARGS_VFS_SYMLINK
 
          # does the kernel have VFS intent patches?
@@ -1884,7 +2001,6 @@ AC_DEFUN([LC_PROG_LINUX],
          # 2.6.17
          LC_INODE_IPRIVATE
          LC_DQUOTOFF_MUTEX
-         LC_VFS_RENAME_MUTEX
 
          # 2.6.18
          LC_NR_PAGECACHE
@@ -1894,6 +2010,7 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_UMOUNTBEGIN_HAS_VFSMOUNT
          LC_SEQ_LOCK
          LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
+         LC_FLUSH_OWNER_ID
          if test x$enable_server = xyes ; then
                 LC_EXPORT_INVALIDATE_MAPPING_PAGES
          fi
@@ -1921,6 +2038,7 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_STRUCT_HASH_DESC
          LC_STRUCT_BLKCIPHER_DESC
          LC_FS_RENAME_DOES_D_MOVE
+
          # 2.6.23
          LC_UNREGISTER_BLKDEV_RETURN_INT
          LC_KERNEL_SPLICE_READ
@@ -1934,6 +2052,7 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_BIO_ENDIO_2ARG
          LC_FH_TO_DENTRY
          LC_PROCFS_DELETED
+         LC_EXPORT_BDI_INIT
 
          #2.6.25
          LC_MAPPING_CAP_WRITEBACK_DIRTY
@@ -1950,6 +2069,7 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_QUOTA_ON_5ARGS
          LC_QUOTA_OFF_3ARGS
          LC_VFS_DQ_OFF
+         LC_LOCK_MAP_ACQUIRE
 
          # 2.6.27.15-2 sles11
          LC_BI_HW_SEGMENTS
@@ -1957,6 +2077,21 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_VFS_SYMLINK_5ARGS
          LC_SB_ANY_QUOTA_ACTIVE
          LC_SB_HAS_QUOTA_ACTIVE
+
+         # 2.6.31
+         LC_BLK_QUEUE_LOG_BLK_SIZE
+
+         # 2.6.32
+         LC_DQUOT_INIT
+         LC_REQUEST_QUEUE_LIMITS
+         LC_NEW_BACKING_DEV_INFO
+
+         #
+         if test x$enable_server = xyes ; then
+                if test x$enable_quota_module = xyes ; then
+                        LC_QUOTA64    # must after LC_HAVE_QUOTAIO_V1_H
+                fi
+         fi
 ])
 
 #
@@ -2014,6 +2149,63 @@ if test x$enable_liblustre_acl = xyes ; then
   AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
 fi
 
+# 2.6.29 change prepare/commit_write to write_begin/end
+AC_DEFUN([LC_WRITE_BEGIN_END],
+[AC_MSG_CHECKING([if kernel has .write_begin/end])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+        #include <linux/pagemap.h>
+#ifdef HAVE_LINUX_MMTYPES_H
+        #include <linux/mm_types.h>
+#endif
+],[
+        struct address_space_operations aops;
+        struct page *page;
+
+        aops.write_begin = NULL;
+        aops.write_end = NULL;
+        page = grab_cache_page_write_begin(NULL, 0, 0);
+], [
+        AC_MSG_RESULT([yes])
+        AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
+                [kernel has .write_begin/end])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
+# 2.6.29 blkdev_put has 2 arguments
+AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
+[AC_MSG_CHECKING([blkdev_put needs 2 parameters])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+],[
+        blkdev_put(NULL, 0);
+],[
+        AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
+                [blkdev_put needs 2 paramters])
+        AC_MSG_RESULT([yes])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
+# 2.6.29 dentry_open has 4 arguments
+AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
+[AC_MSG_CHECKING([dentry_open needs 4 parameters])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+],[
+        dentry_open(NULL, NULL, 0, NULL);
+],[
+        AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
+                [dentry_open needs 4 paramters])
+        AC_MSG_RESULT([yes])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
 #
 # --enable-mpitest
 #
@@ -2206,26 +2398,25 @@ LB_LINUX_TRY_COMPILE([
 # LC_QUOTA64
 # linux kernel have 64-bit limits support
 #
-AC_DEFUN([LC_QUOTA64],
-[if test x$enable_quota_module = xyes -a x$enable_server = xyes ; then
+AC_DEFUN([LC_QUOTA64],[
         AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-I$LINUX/fs"
         LB_LINUX_TRY_COMPILE([
                 #include <linux/kernel.h>
                 #include <linux/fs.h>
-                #include <linux/quotaio_v2.h>
+                #ifdef HAVE_QUOTAIO_V1_H
+                # include <linux/quotaio_v2.h>
                 int versions[] = V2_INITQVERSIONS_R1;
                 struct v2_disk_dqblk_r1 dqblk_r1;
-        ],[],[
-                AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
-                AC_MSG_RESULT([yes])
-        ],[
-        tmp_flags="$EXTRA_KCFLAGS"
-        EXTRA_KCFLAGS="-I $LINUX/fs"
-        LB_LINUX_TRY_COMPILE([
-                #include <linux/kernel.h>
-                #include <linux/fs.h>
-                #include <quotaio_v2.h>
+                #else
+                # ifdef HAVE_FS_QUOTA_QUOTAIO_V1_H
+                #  include <quota/quotaio_v2.h>
+                # else
+                #  include <quotaio_v2.h>
+                # endif
                 struct v2r1_disk_dqblk dqblk_r1;
+                #endif
         ],[],[
                 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
                 AC_MSG_RESULT([yes])
@@ -2235,9 +2426,7 @@ AC_DEFUN([LC_QUOTA64],
                 ],[])
                 AC_MSG_RESULT([no])
         ])
-        EXTRA_KCFLAGS=$tmp_flags
-        ])
-fi
+EXTRA_KCFLAGS=$tmp_flags
 ])
 
 # LC_SECURITY_PLUG  # for SLES10 SP2
@@ -2287,6 +2476,30 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
+[AC_MSG_CHECKING([tux_info])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/sched.h>
+],[
+        struct task_struct task;
+        &task.tux_info;
+],[
+        AC_MSG_RESULT([yes])
+        AC_DEFINE(LL_TASK_CL_ENV, tux_info, [have tux_info])
+        have_task_clenv_store='yes'
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
+AC_DEFUN([LC_TASK_CLENV_STORE],
+[
+        AC_MSG_CHECKING([if we can store cl_env in task_struct])
+        if test x$have_task_clenv_store != xyes ; then
+                LC_TASK_CLENV_TUX_INFO
+        fi
+])
+
 #
 # LC_CONFIGURE
 #
@@ -2378,6 +2591,23 @@ if test x$enable_lu_ref = xyes ; then
         AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
 fi
 
+AC_ARG_ENABLE([pgstate-track],
+              AC_HELP_STRING([--enable-pgstate-track],
+                             [enable page state tracking]),
+              [enable_pgstat_track='yes'],[])
+AC_MSG_CHECKING([whether to enable page state tracking])
+AC_MSG_RESULT([$enable_pgstat_track])
+if test x$enable_pgstat_track = xyes ; then
+        AC_DEFINE([LUSTRE_PAGESTATE_TRACKING], 1,
+                  [enable page state tracking code])
+fi
+
+         #2.6.29
+         LC_WRITE_BEGIN_END
+         LC_D_OBTAIN_ALIAS
+         LC_BLKDEV_PUT_2ARGS
+         LC_DENTRY_OPEN_4ARGS
+
 ])
 
 #
@@ -2412,20 +2642,19 @@ AC_DEFUN([LC_CONFIG_FILES],
 lustre/Makefile
 lustre/autoMakefile
 lustre/autoconf/Makefile
+lustre/conf/Makefile
 lustre/contrib/Makefile
 lustre/doc/Makefile
 lustre/include/Makefile
 lustre/include/lustre_ver.h
 lustre/include/linux/Makefile
 lustre/include/lustre/Makefile
-lustre/kernel_patches/targets/2.6-vanilla.target
-lustre/kernel_patches/targets/2.6-rhel4.target
 lustre/kernel_patches/targets/2.6-rhel5.target
-lustre/kernel_patches/targets/2.6-fc5.target
-lustre/kernel_patches/targets/2.6-patchless.target
 lustre/kernel_patches/targets/2.6-sles10.target
 lustre/kernel_patches/targets/2.6-sles11.target
 lustre/kernel_patches/targets/2.6-oel5.target
+lustre/kernel_patches/targets/2.6-fc11.target
+lustre/kernel_patches/targets/2.6-fc12.target
 lustre/ldlm/Makefile
 lustre/fid/Makefile
 lustre/fid/autoMakefile
@@ -2464,8 +2693,8 @@ lustre/osc/Makefile
 lustre/osc/autoMakefile
 lustre/ost/Makefile
 lustre/ost/autoMakefile
-lustre/osd/Makefile
-lustre/osd/autoMakefile
+lustre/osd-ldiskfs/Makefile
+lustre/osd-ldiskfs/autoMakefile
 lustre/mgc/Makefile
 lustre/mgc/autoMakefile
 lustre/mgs/Makefile
@@ -2481,11 +2710,6 @@ lustre/tests/Makefile
 lustre/tests/mpi/Makefile
 lustre/utils/Makefile
 lustre/utils/gss/Makefile
+lustre/obdclass/darwin/Makefile
 ])
-case $lb_target_os in
-        darwin)
-                AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])
-                ;;
-esac
-
 ])