Whamcloud - gitweb
LU-8364 ldiskfs: fixes for failover mode.
[fs/lustre-release.git] / config / lustre-build-ldiskfs.m4
index 39cb853..7de591f 100644 (file)
@@ -2,16 +2,29 @@
 # LDISKFS_LINUX_SERIES
 #
 AC_DEFUN([LDISKFS_LINUX_SERIES], [
-LDISKFS_SERIES=
 AC_MSG_CHECKING([which ldiskfs series to use])
+case x$LDISKFS_SERIES in
+       x)                      # not set
+               ;;
+       *.series)               # set externally
+               ;;
+       *) LDISKFS_SERIES=
+esac
+AS_IF([test -z "$LDISKFS_SERIES"], [
 AS_IF([test x$RHEL_KERNEL = xyes], [
-       AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32-431],[
-       AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32-343],[
-       AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32],[],
-       [LDISKFS_SERIES="2.6-rhel6.series"],  [LDISKFS_SERIES="2.6-rhel6.series"])],
-       [LDISKFS_SERIES="2.6-rhel6.4.series"],[LDISKFS_SERIES="2.6-rhel6.4.series"])],
-       [LDISKFS_SERIES="2.6-rhel6.5.series"],[LDISKFS_SERIES="2.6-rhel6.5.series"])
+       case $RHEL_RELEASE_NO in
+       73)     LDISKFS_SERIES="3.10-rhel7.3.series"    ;;
+       72)     LDISKFS_SERIES="3.10-rhel7.2.series"    ;;
+       71)     LDISKFS_SERIES="3.10-rhel7.series"      ;;
+       68)     LDISKFS_SERIES="2.6-rhel6.8.series"     ;;
+       67)     LDISKFS_SERIES="2.6-rhel6.7.series"     ;;
+       66)     LDISKFS_SERIES="2.6-rhel6.6.series"     ;;
+       65)     LDISKFS_SERIES="2.6-rhel6.5.series"     ;;
+       64)     LDISKFS_SERIES="2.6-rhel6.4.series"     ;;
+       6[0-3]) LDISKFS_SERIES="2.6-rhel6.series"       ;;
+       esac
 ], [test x$SUSE_KERNEL = xyes], [
+       AS_VERSION_COMPARE([$LINUXRELEASE],[3.12.0],[
        AS_VERSION_COMPARE([$LINUXRELEASE],[3.0.0],[
        AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32], [],
        [LDISKFS_SERIES="2.6-sles11.series"],[LDISKFS_SERIES="2.6-sles11.series"])],
@@ -20,14 +33,23 @@ AS_IF([test x$RHEL_KERNEL = xyes], [
                case $PLEV in
                2) LDISKFS_SERIES="3.0-sles11.series"
                        ;;
-               3) LDISKFS_SERIES="3.0-sles11sp3.series"
+               3|4) LDISKFS_SERIES="3.0-sles11sp3.series"
+                       ;;
+               esac
+       ])],[LDISKFS_SERIES="3.12-sles12.series"],[
+               PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
+               case $PLEV in
+               1) LDISKFS_SERIES="3.12-sles12sp1.series"
+                       ;;
+               *) LDISKFS_SERIES="3.12-sles12.series"
                        ;;
                esac
        ])
 ])
+])
 AS_IF([test -z "$LDISKFS_SERIES"],
-       [AC_MSG_WARN([Unknown kernel version $LDISKFS_VERSIONRELEASE])])
-AC_MSG_RESULT([$LDISKFS_SERIES])
+       [AC_MSG_RESULT([failed to identify series])],
+       [AC_MSG_RESULT([$LDISKFS_SERIES])])
 AC_SUBST(LDISKFS_SERIES)
 ]) # LDISKFS_LINUX_SERIES
 
@@ -85,6 +107,42 @@ ext4_journal_start, [
 ]) # LB_EXT4_JOURNAL_START_3ARGS
 
 #
+# LB_LDISKFS_MAP_BLOCKS
+#
+# Since 2.6.35 brought ext4_map_blocks() for IO.
+# We just check this function whether existed.
+# it must be exported by ldiskfs patches.
+#
+AC_DEFUN([LB_LDISKFS_MAP_BLOCKS], [
+LB_CHECK_COMPILE([if kernel has ext4_map_blocks],
+ext4_map_blocks, [
+       #include <linux/fs.h>
+       #include "$EXT4_SRC_DIR/ext4.h"
+],[
+       ext4_map_blocks(NULL, NULL, NULL, 0);
+],[
+       AC_DEFINE(HAVE_LDISKFS_MAP_BLOCKS, 1, [kernel has ext4_map_blocks])
+])
+])
+
+#
+# LB_EXT4_BREAD_4ARGS
+#
+# 3.18 ext4_bread has 4 arguments
+#
+AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
+LB_CHECK_COMPILE([if ext4_bread takes 4 arguments],
+ext4_bread, [
+       #include <linux/fs.h>
+       #include "$EXT4_SRC_DIR/ext4.h"
+],[
+       ext4_bread(NULL, NULL, 0, 0);
+],[
+       AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1, [ext4_bread takes 4 arguments])
+])
+]) # LB_EXT4_BREAD_4ARGS
+
+#
 # LDISKFS_AC_PATCH_PROGRAM
 #
 # Determine which program should be used to apply the patches to
@@ -162,6 +220,8 @@ AS_IF([test x$enable_ldiskfs != xno],[
        LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
        LB_EXT_PBLOCK
        LB_EXT4_JOURNAL_START_3ARGS
+       LB_LDISKFS_MAP_BLOCKS
+       LB_EXT4_BREAD_4ARGS
        AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
        AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
        AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
@@ -179,7 +239,7 @@ AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
 #
 # LB_VALIDATE_EXT4_SRC_DIR
 #
-# Spot check the existance of several source files common to ext4.
+# Spot check the existence of several source files common to ext4.
 # Detecting this at configure time allows us to avoid a potential build
 # failure and provide a useful error message to explain what is wrong.
 #
@@ -233,7 +293,7 @@ AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
        EXT4_SRC_DIR="$linux_src/fs/ext4"
 ], [
        # Kernel ext source provided by kernel-debuginfo-common package
-       linux_src=$(ls -1d /usr/src/debug/*/linux-$LINUXRELEASE \
+       linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
                2>/dev/null | tail -1)
        AS_IF([test -e "$linux_src/fs/ext4/super.c"],
                [EXT4_SRC_DIR="$linux_src/fs/ext4"],