Whamcloud - gitweb
LU-9503 kernel: kernel update [SLES11 SP4 3.0.101-100]
[fs/lustre-release.git] / config / lustre-build-ldiskfs.m4
index d990354..83b4cbc 100644 (file)
-AC_DEFUN([LDISKFS_LINUX_SERIES],
-[
-LDISKFS_SERIES=
+#
+# LDISKFS_LINUX_SERIES
+#
+AC_DEFUN([LDISKFS_LINUX_SERIES], [
 AC_MSG_CHECKING([which ldiskfs series to use])
-
-SER=
+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-343],[
-       AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32],[],
-       [SER="2.6-rhel6.series"],[SER="2.6-rhel6.series"])],
-       [SER="2.6-rhel6.4.series"],[SER="2.6-rhel6.4.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"      ;;
+       69)     LDISKFS_SERIES="2.6-rhel6.9.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],[4.4.0],[
+       AS_VERSION_COMPARE([$LINUXRELEASE],[3.12.0],[
        AS_VERSION_COMPARE([$LINUXRELEASE],[3.0.0],[
-       AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32],[],
-       [SER="2.6-sles11.series"],[SER="2.6-sles11.series"])],
-       [SER="3.0-sles11.series"],[
+       AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32], [],
+       [LDISKFS_SERIES="2.6-sles11.series"],[LDISKFS_SERIES="2.6-sles11.series"])],
+       [LDISKFS_SERIES="3.0-sles11.series"],[
                PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
                case $PLEV in
-               2) SER="3.0-sles11.series"
+               2) LDISKFS_SERIES="3.0-sles11.series"
                        ;;
-               3) SER="3.0-sles11sp3.series"
+               3) LDISKFS_SERIES="3.0-sles11sp3.series"
+                       ;;
+               4) LDISKFS_SERIES="3.0-sles11sp4.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
+       ])],[LDISKFS_SERIES="4.4-sles12sp2.series"],
+           [LDISKFS_SERIES="4.4-sles12sp2.series"])
+])
 ])
-LDISKFS_SERIES=$SER
-
 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
 
 #
+# LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
+#
 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
+# Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
 #
-AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD],
-[AC_MSG_CHECKING([if ext4_free_blocks needs struct buffer_head])
- LB_LINUX_TRY_COMPILE([
+AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
+LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
+ext4_free_blocks_with_buffer_head, [
        #include <linux/fs.h>
        #include "$EXT4_SRC_DIR/ext4.h"
 ],[
        ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
 ],[
-       AC_MSG_RESULT([yes])
        AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
-                 [ext4_free_blocks do not require struct buffer_head])
-],[
-       AC_MSG_RESULT([no])
-])
+               [ext4_free_blocks do not require struct buffer_head])
 ])
+]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
 
 #
+# LB_EXT_PBLOCK
+#
 # 2.6.35 renamed ext_pblock to ext4_ext_pblock(ex)
 #
-AC_DEFUN([LB_EXT_PBLOCK],
-[AC_MSG_CHECKING([if kernel has ext_pblocks])
- LB_LINUX_TRY_COMPILE([
+AC_DEFUN([LB_EXT_PBLOCK], [
+LB_CHECK_COMPILE([if Linux kernel has 'ext_pblock'],
+ext_pblock, [
        #include <linux/fs.h>
        #include "$EXT4_SRC_DIR/ext4_extents.h"
 ],[
        ext_pblock(NULL);
 ],[
-       AC_MSG_RESULT([yes])
-       AC_DEFINE(HAVE_EXT_PBLOCK, 1,
-                 [kernel has ext_pblocks])
+       AC_DEFINE(HAVE_EXT_PBLOCK, 1, [Linux kernel has ext_pblock])
+])
+]) # LB_EXT_PBLOCK
+
+#
+# LB_EXT4_JOURNAL_START_3ARGS
+#
+# 3.9 added a type argument to ext4_journal_start and friends
+#
+AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
+LB_CHECK_COMPILE([if ext4_journal_start takes 3 arguments],
+ext4_journal_start, [
+       #include <linux/fs.h>
+       #include "$EXT4_SRC_DIR/ext4_jbd2.h"
+],[
+       ext4_journal_start(NULL, 0, 0);
+],[
+       AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1, [ext4_journal_start takes 3 arguments])
+])
+]) # 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_MSG_RESULT([no])
+       AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1, [ext4_bread takes 4 arguments])
 ])
+]) # LB_EXT4_BREAD_4ARGS
+
+#
+# LB_EXT4_HAVE_INFO_DQUOT
+#
+# in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
+#
+AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
+LB_CHECK_COMPILE([if i_dquot is in ext4_inode_info],
+ext4_info_dquot, [
+       #include <linux/fs.h>
+       #include <linux/quota.h>
+       #include "$EXT4_SRC_DIR/ext4.h"
+],[
+       struct ext4_inode_info in;
+       struct dquot *dq;
+
+       dq = in.i_dquot[0];
+],[
+       AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1, [i_dquot is in ext4_inode_info])
 ])
+]) # LB_EXT4_HAVE_INFO_DQUOT
 
 #
 # LDISKFS_AC_PATCH_PROGRAM
@@ -101,23 +199,24 @@ AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
                        AC_MSG_ERROR([*** Need "quilt" or "patch" command])
                ])
        ])
-])
+]) # LDISKFS_AC_PATCH_PROGRAM
 
 #
-# LB_CONDITIONAL_LDISKFS
+# LB_CONFIG_LDISKFS
 #
-AC_DEFUN([LB_CONFIG_LDISKFS],
-[
+AC_DEFUN([LB_CONFIG_LDISKFS], [
 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
 # However we continue to support this option through Lustre 2.5.
 AC_ARG_WITH([ldiskfs],
        [],
        [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
        AS_IF([test x$withval != xyes -a x$withval != xno],
-               [AC_MSG_ERROR([the ldiskfs option is deprecated, and
-                       no longer supports paths to external ldiskfs source])])
-       ]
-)
+               [AC_MSG_ERROR([
+
+The ldiskfs option is deprecated,
+and no longer supports paths to external ldiskfs source
+])])
+])
 
 AC_ARG_ENABLE([ldiskfs],
        [AS_HELP_STRING([--disable-ldiskfs],
@@ -127,15 +226,13 @@ AC_ARG_ENABLE([ldiskfs],
        [AS_IF([test "${with_ldiskfs+set}" = set],
                [enable_ldiskfs=$with_ldiskfs],
                [enable_ldiskfs=maybe])
-       ]
-)
+])
 
 AS_IF([test x$enable_server = xno],
        [AS_CASE([$enable_ldiskfs],
                [maybe], [enable_ldiskfs=no],
                [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
-       )]
-)
+       )])
 
 AS_IF([test x$enable_ldiskfs != xno],[
        # In the future, we chould change enable_ldiskfs from maybe to
@@ -148,9 +245,15 @@ AS_IF([test x$enable_ldiskfs != xno],[
        LDISKFS_AC_PATCH_PROGRAM
        LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
        LB_EXT_PBLOCK
+       LB_EXT4_JOURNAL_START_3ARGS
+       LB_LDISKFS_MAP_BLOCKS
+       LB_EXT4_BREAD_4ARGS
+       LB_EXT4_HAVE_INFO_DQUOT
        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])
+       AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
+       AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1, [enable encryption for ldiskfs])
        AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
        AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
 ])
@@ -159,36 +262,39 @@ AC_MSG_CHECKING([whether to build ldiskfs])
 AC_MSG_RESULT([$enable_ldiskfs])
 
 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
-])
+]) # LB_CONFIG_LDISKFS
 
 #
 # 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.
 #
-AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR],
-[
-if test x$EXT4_SRC_DIR = x; then
-       enable_ldiskfs_build='no'
-else
+AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
+enable_ldiskfs_build="no"
+AS_IF([test -n "$EXT4_SRC_DIR"], [
+       enable_ldiskfs_build="yes"
        LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
-               enable_ldiskfs_build='no'
-               AC_MSG_WARN([ext4 must exist for ldiskfs build])])
+               enable_ldiskfs_build="no"
+               AC_MSG_WARN([ext4 must exist for ldiskfs build])
+       ])
        LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
-               enable_ldiskfs_build='no'
-               AC_MSG_WARN([ext4 must exist for ldiskfs build])])
+               enable_ldiskfs_build="no"
+               AC_MSG_WARN([ext4 must exist for ldiskfs build])
+       ])
        LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
-               enable_ldiskfs_build='no'
-               AC_MSG_WARN([ext4 must exist for ldiskfs build])])
+               enable_ldiskfs_build="no"
+               AC_MSG_WARN([ext4 must exist for ldiskfs build])
+       ])
        LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
-               enable_ldiskfs_build='no'
-               AC_MSG_WARN([ext4 must exist for ldiskfs build])])
-fi
+               enable_ldiskfs_build="no"
+               AC_MSG_WARN([ext4 must exist for ldiskfs build])
+       ])
+])
 
-if test x$enable_ldiskfs_build = xno; then
-       enable_ldiskfs='no'
+AS_IF([test "x$enable_ldiskfs_build" = xno], [
+       enable_ldiskfs="no"
 
        AC_MSG_WARN([
 
@@ -197,11 +303,9 @@ Disabling ldiskfs support because complete ext4 source does not exist.
 If you are building using kernel-devel packages and require ldiskfs
 server support then ensure that the matching kernel-debuginfo-common
 and kernel-debuginfo-common-<arch> packages are installed.
-
 ])
-
-fi
 ])
+]) # LB_VALIDATE_EXT4_SRC_DIR
 
 #
 # LB_EXT4_SRC_DIR
@@ -209,44 +313,40 @@ fi
 # Determine the location of the ext4 source code.  It it required
 # for several configure tests and to build ldiskfs.
 #
-AC_DEFUN([LB_EXT4_SRC_DIR],
-[
+AC_DEFUN([LB_EXT4_SRC_DIR], [
+AC_MSG_CHECKING([ext4 source directory])
 # Kernel ext source located with devel headers
 linux_src=$LINUX
-if test -e "$linux_src/fs/ext4/super.c"; then
-       EXT4_SRC_DIR=$linux_src/fs/ext4
-else
+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)
-       if test -e "$linux_src/fs/ext4/super.c"; then
-               EXT4_SRC_DIR=$linux_src/fs/ext4
-       else
-               EXT4_SRC_DIR=
-       fi
-fi
-
-AC_MSG_CHECKING([ext4 source directory])
+       AS_IF([test -e "$linux_src/fs/ext4/super.c"],
+               [EXT4_SRC_DIR="$linux_src/fs/ext4"],
+               [EXT4_SRC_DIR=""])
+])
 AC_MSG_RESULT([$EXT4_SRC_DIR])
 AC_SUBST(EXT4_SRC_DIR)
 
 LB_VALIDATE_EXT4_SRC_DIR
-])
+]) # LB_EXT4_SRC_DIR
 
 #
 # LB_DEFINE_E2FSPROGS_NAMES
 #
 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
 #
-AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES],
-[
+AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
+AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
 AC_ARG_WITH([ldiskfsprogs],
-        AC_HELP_STRING([--with-ldiskfsprogs],
-                       [use alternate names for ldiskfs-enabled e2fsprogs]),
-       [],[withval='no'])
+       AC_HELP_STRING([--with-ldiskfsprogs],
+               [use alternate names for ldiskfs-enabled e2fsprogs]),
+       [], [withval="no"])
 
-AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
-if test x$withval = xyes ; then
+AS_IF([test "x$withval" = xyes], [
+       AC_MSG_RESULT([enabled])
        AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
        E2FSPROGS="ldiskfsprogs"
        MKE2FS="mkfs.ldiskfs"
@@ -256,8 +356,8 @@ if test x$withval = xyes ; then
        DUMPE2FS="dumpfs.ldiskfs"
        E2FSCK="fsck.ldiskfs"
        PFSCK="pfsck.ldiskfs"
-       AC_MSG_RESULT([enabled])
-else
+], [
+       AC_MSG_RESULT([disabled])
        E2FSPROGS="e2fsprogs"
        MKE2FS="mke2fs"
        DEBUGFS="debugfs"
@@ -266,8 +366,7 @@ else
        DUMPE2FS="dumpe2fs"
        E2FSCK="e2fsck"
        PFSCK="fsck"
-       AC_MSG_RESULT([disabled])
-fi
+])
 
 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
@@ -286,4 +385,4 @@ AC_SUBST([E2LABEL], [$E2LABEL])
 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
 AC_SUBST([E2FSCK], [$E2FSCK])
 AC_SUBST([PFSCK], [$PFSCK])
-])
+]) # LB_DEFINE_E2FSPROGS_NAMES