Whamcloud - gitweb
LU-13839 kernel: RHEL 8.3 server support
[fs/lustre-release.git] / config / lustre-build-ldiskfs.m4
index e1c64a2..cc282ce 100644 (file)
@@ -13,51 +13,44 @@ esac
 AS_IF([test -z "$LDISKFS_SERIES"], [
 AS_IF([test x$RHEL_KERNEL = xyes], [
        case $RHEL_RELEASE_NO in
+       83)     LDISKFS_SERIES="4.18-rhel8.3.series"    ;;
+       82)     LDISKFS_SERIES="4.18-rhel8.2.series"    ;;
+       81)     LDISKFS_SERIES="4.18-rhel8.1.series"    ;;
        80)     LDISKFS_SERIES="4.18-rhel8.series"      ;;
+       79)     LDISKFS_SERIES="3.10-rhel7.9.series"    ;;
+       78)     LDISKFS_SERIES="3.10-rhel7.8.series"    ;;
+       77)     LDISKFS_SERIES="3.10-rhel7.7.series"    ;;
        76)     LDISKFS_SERIES="3.10-rhel7.6.series"    ;;
-       75)     LDISKFS_SERIES="3.10-rhel7.5.series"    ;;
-       74)     LDISKFS_SERIES="3.10-rhel7.4.series"    ;;
-       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.82],[
-       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], [],
-       [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) LDISKFS_SERIES="3.0-sles11.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"
+       AS_VERSION_COMPARE([$LINUXRELEASE],[5.3.18],[
+       AS_VERSION_COMPARE([$LINUXRELEASE],[4.12.14],[], [], [
+               suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
+               suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
+               suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
+               echo "$suse_conf $suse_vers $suse_patchlevel  ${suse_vers}sp$suse_patchlevel" >> /tmp/log-nb
+               case ${suse_vers}sp$suse_patchlevel in # (
+               15sp0 ) LDISKFS_SERIES="4.12-sles15.series"
+                       if test ! -f $LINUX/arch/x86/kernel/cpu/hygon.c ; then
+                               # This file was added shortly after -150.22 so
+                               # this must be 150.22 or earlier
+                               LDISKFS_SERIES="4.12-sles15-22.series"
+                       fi
+                       ;; # (
+               15sp1 ) LDISKFS_SERIES="4.12-sles15sp1.series"
+                       if test ! -f $LINUX/arch/x86/kernel/cpu/umwait.c ; then
+                               # This file was added after -197.7 so
+                               # this must be -197.7 or earlier
+                               LDISKFS_SERIES="4.12-sles15sp1-7.series"
+                       fi
                        ;;
                esac
-       ])],[LDISKFS_SERIES="4.4-sles12sp2.series"],
-           [LDISKFS_SERIES="4.4-sles12sp2.series"]
-       )], [LDISKFS_SERIES="4.4-sles12sp3.series"],
-            [LDISKFS_SERIES="4.4-sles12sp3.series"])
+       ]
+       )], [LDISKFS_SERIES="5.4.21-ml.series"],
+           [LDISKFS_SERIES="5.4.21-ml.series"])
 ], [test x$UBUNTU_KERNEL = xyes], [
+       AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[
+       AS_VERSION_COMPARE([$LINUXRELEASE],[5.0.0],[
        AS_VERSION_COMPARE([$LINUXRELEASE],[4.15.0],[
        AS_VERSION_COMPARE([$LINUXRELEASE],[4.4.0], [],
        [
@@ -85,12 +78,29 @@ AS_IF([test x$RHEL_KERNEL = xyes], [
                        [test $KPLEV -ge 20], [LDISKFS_SERIES="4.15.0-20-ubuntu18.series"]
                )
        ],
-       [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"])
+       [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"])],
+       [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"],
+       [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"])],
+       [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"],
+       [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"],
+       [LDISKFS_SERIES="5.4.0-ml.series"])
 ])
 ])
+# Not RHEL/SLES or Ubuntu .. probably mainline
+AS_IF([test -z "$LDISKFS_SERIES"],
+       [
+       AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[],
+       [LDISKFS_SERIES="5.4.0-ml.series"],[
+       AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.21],
+               [LDISKFS_SERIES="5.4.0-ml.series"],  # lt
+               [LDISKFS_SERIES="5.4.21-ml.series"], # eq
+               [LDISKFS_SERIES="5.4.21-ml.series"]  # gt
+               )])
+       ],
+[])
 AS_IF([test -z "$LDISKFS_SERIES"],
        [AC_MSG_RESULT([failed to identify series])],
-       [AC_MSG_RESULT([$LDISKFS_SERIES])])
+       [AC_MSG_RESULT([$LDISKFS_SERIES for $LINUXRELEASE])])
 AC_SUBST(LDISKFS_SERIES)
 ]) # LDISKFS_LINUX_SERIES
 
@@ -134,12 +144,24 @@ ext4_journal_start, [
 # LB_EXT4_BREAD_4ARGS
 #
 # 3.18 ext4_bread has 4 arguments
+# NOTE: It may not be exported for modules, use a positive compiler test here.
 #
 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"
+
+       struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
+                                      ext4_lblk_t block, int map_flags)
+       {
+               struct buffer_head *bh = NULL;
+               (void)handle;
+               (void)inode;
+               (void)block;
+               (void)map_flags;
+               return bh;
+       }
 ],[
        ext4_bread(NULL, NULL, 0, 0);
 ],[
@@ -205,6 +227,31 @@ ext4_i_crypt_info, [
 ]) # LB_EXT4_HAVE_I_CRYPT_INFO
 
 #
+# LB_LDISKFS_JOURNAL_ENSURE_CREDITS
+#
+# kernel 4.18.0-240.1.1.el8 and
+# kernel 5.4 commit a413036791d040e33badcc634453a4d0c0705499
+#
+# ext4_journal_ensure_credits was introduced to ensure given handle
+# has at least requested amount of credits available, and possibly
+# restarting transaction if needed.
+#
+AC_DEFUN([LB_LDISKFS_JOURNAL_ENSURE_CREDITS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'ext4_journal_ensure_credits' exists],
+ext4_journal_ensure_credits, [
+       #include "$EXT4_SRC_DIR/ext4_jbd2.h"
+],[
+       ext4_journal_ensure_credits(NULL, 0, 0);
+],[
+       AC_DEFINE(HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS, 1,
+               ['ext4_journal_ensure_credits' exists])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
+
+#
 # LB_LDISKFS_IGET_HAS_FLAGS_ARG
 #
 # kernel 4.19 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
@@ -261,6 +308,94 @@ AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
 ]) # LDISKFS_AC_PATCH_PROGRAM
 
 #
+# LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
+#
+# kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
+# ext4: avoid declaring fs inconsistent due to invalid file handles
+# __ext4_find_entry became a helper function for ext4_find_entry
+# conflicting with previous ldiskfs patches.
+# ldiskfs patches map ext4_find_entry to ldiskfs_find_entry_locked to
+# avoid conflicting with __ext4_find_entry
+#
+# When the following check succeeds __ext4_find_entry helper is not
+# used.
+#
+AC_DEFUN([LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if __ldiskfs_find_entry is available],
+ldiskfs_find_entry_locked, [
+       #include <linux/fs.h>
+       #include "$EXT4_SRC_DIR/ext4.h"
+       #include "$EXT4_SRC_DIR/namei.c"
+
+       static int __ext4_find_entry(void) { return 0; }
+],[
+       int x = __ext4_find_entry();
+       (void)x;
+],[
+       AC_DEFINE(HAVE___LDISKFS_FIND_ENTRY, 1,
+               [if __ldiskfs_find_entry is available])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
+
+#
+# LB_LDISKFSFS_DIRHASH_WANTS_DIR
+#
+# kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
+# ext4fs_dirhash UNICODE support
+#
+AC_DEFUN([LB_LDISKFSFS_DIRHASH_WANTS_DIR], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if ldiskfsfs_dirhash takes an inode argument],
+ext4fs_dirhash, [
+       #include <linux/fs.h>
+       #include "$EXT4_SRC_DIR/ext4.h"
+
+       int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
+                         struct dx_hash_info *hinfo)
+       {
+               (void)dir;
+               (void)name;
+               (void)len;
+               (void)hinfo;
+               return 0;
+       }
+],[
+       int f = ext4fs_dirhash(NULL, NULL, 0, NULL);
+       (void)f;
+],[
+       AC_DEFINE(HAVE_LDISKFSFS_GETHASH_INODE_ARG, 1,
+               [ldiskfsfs_dirhash takes an inode argument])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
+
+#
+# LB_JBD2_H_TOTAL_CREDITS
+#
+# kernel 5.5 commit 933f1c1e0b75bbc29730eef07c9e196c6dfd37e5
+# jbd2: Reserve space for revoke descriptor blocks
+#
+AC_DEFUN([LB_JBD2_H_TOTAL_CREDITS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if struct jbd2_journal_handle has h_total_credits member],
+handle_t_h_revoke_credits, [
+       #include <linux/jbd2.h>
+],[
+       int x = offsetof(struct jbd2_journal_handle, h_total_credits);
+       (void)x;
+],[
+       AC_DEFINE(HAVE_JOURNAL_TOTAL_CREDITS, 1,
+               [struct jbd2_journal_handle has h_total_credits member])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LB_JBD2_H_TOTAL_CREDITS
+
+#
 # LB_CONFIG_LDISKFS
 #
 AC_DEFUN([LB_CONFIG_LDISKFS], [
@@ -308,7 +443,11 @@ AS_IF([test x$enable_ldiskfs != xno],[
        LB_EXT4_BREAD_4ARGS
        LB_EXT4_HAVE_INFO_DQUOT
        LB_EXT4_HAVE_I_CRYPT_INFO
+       LB_LDISKFS_JOURNAL_ENSURE_CREDITS
        LB_LDISKFS_IGET_HAS_FLAGS_ARG
+       LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
+       LB_LDISKFSFS_DIRHASH_WANTS_DIR
+       LB_JBD2_H_TOTAL_CREDITS
        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])
@@ -325,6 +464,10 @@ AC_MSG_RESULT([$enable_ldiskfs])
 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
 ]) # LB_CONFIG_LDISKFS
 
+
+AC_DEFUN([LB_EXT4_SRC_DIR_SRC], [])
+AC_DEFUN([LB_EXT4_SRC_DIR_RESULTS], [])
+
 #
 # LB_VALIDATE_EXT4_SRC_DIR
 #