Whamcloud - gitweb
LU-15703 ldiskfs: Disable unused fast commit buffer 43/46943/8
authorShaun Tancheff <shaun.tancheff@hpe.com>
Tue, 31 May 2022 00:27:52 +0000 (20:27 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 6 Jul 2022 03:34:28 +0000 (03:34 +0000)
Linux commit v5.9-rc7-39-g6866d7b3f2bb
    ext4 / jbd2: add fast commit initialization

Disable journal fast commit buffer via a mount option because it is
not used by lustre's ldiskfs since it will break recovery.

Linux commit v5.10-rc2-9-gede7dc7fa0af
    jbd2: rename j_maxlen to j_total_len and add
          jbd2_journal_max_txn_bufs

Change osd_transaction_size to use jbd2_journal_get_max_txn_bufs
and provide a jbd2_journal_get_max_txn_bufs when it is not
provided.

Test-Parameters: trivial
HPE-bug-id: LUS-10858
Fixes: c93a3e5b15 ("LU-14195 ldiskfs: update patches for Linux 5.10")
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I9bffc3559a8bbce9d4c1c2b6692cb8518f3f991a
Reviewed-on: https://review.whamcloud.com/46943
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
config/lustre-build-ldiskfs.m4
lustre/osd-ldiskfs/osd_internal.h
lustre/utils/libmount_utils_ldiskfs.c

index 106551b..bd08832 100644 (file)
@@ -487,6 +487,28 @@ AC_DEFUN([LB_EXT4_INC_DEC_COUNT_2ARGS], [
 ]) # LB_EXT4_INC_DEC_COUNT_2ARGS
 
 #
+# LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
+# Linux commit v5.10-rc2-9-gede7dc7fa0af
+#  jbd2: rename j_maxlen to j_total_len and add jbd2_journal_max_txn_bufs
+#
+AC_DEFUN([LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if jbd2_journal_get_max_txn_bufs is available],
+jbd2_journal_get_max_txn_bufs, [
+       #include <linux/jbd2.h>
+],[
+       journal_t *journal = NULL;
+       int x = jbd2_journal_get_max_txn_bufs(journal);
+       (void)x;
+],[
+       AC_DEFINE(HAVE_JBD2_JOURNAL_GET_MAX_TXN_BUFS, 1,
+               [if jbd2_journal_get_max_txn_bufs is available])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
+
+#
 # LB_CONFIG_LDISKFS
 #
 AC_DEFUN([LB_CONFIG_LDISKFS], [
@@ -541,6 +563,7 @@ AS_IF([test x$enable_ldiskfs != xno],[
        LB_JBD2_H_TOTAL_CREDITS
        LB_EXT4_GET_BLOCKS_KEEP_SIZE
        LB_EXT4_INC_DEC_COUNT_2ARGS
+       LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
        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])
index 67a5b2b..39e35c0 100644 (file)
@@ -958,6 +958,11 @@ static inline void i_projid_write(struct inode *inode, __u32 projid)
 # define osd_attach_jinode(inode) 0
 #endif /* HAVE_LDISKFS_INFO_JINODE */
 
+#ifndef HAVE_JBD2_JOURNAL_GET_MAX_TXN_BUFS
+#define jbd2_journal_get_max_txn_bufs(jrnl) \
+       (jrnl->j_max_transaction_buffers)
+#endif
+
 #ifdef LDISKFS_HT_MISC
 # define osd_journal_start_sb(sb, type, nblock) \
                ldiskfs_journal_start_sb(sb, type, nblock)
@@ -986,7 +991,7 @@ static inline struct buffer_head *osd_ldiskfs_append(handle_t *handle,
 # define osd_journal_start(inode, type, nblocks) \
                ldiskfs_journal_start(inode, type, nblocks)
 # define osd_transaction_size(dev) \
-               (osd_journal(dev)->j_max_transaction_buffers / 2)
+               (jbd2_journal_get_max_txn_bufs(osd_journal(dev)) / 2)
 #else /* ! defined LDISKFS_HT_MISC */
 # define LDISKFS_HT_MISC       0
 # define osd_journal_start_sb(sb, type, nblock) \
@@ -1018,7 +1023,7 @@ static inline struct buffer_head *osd_ldiskfs_append(handle_t *handle,
 # define osd_journal_start(inode, type, nblocks) \
                ldiskfs_journal_start(inode, nblocks)
 # define osd_transaction_size(dev) \
-               (osd_journal(dev)->j_max_transaction_buffers)
+               jbd2_journal_get_max_txn_bufs(osd_journal(dev))
 #endif /* LDISKFS_HT_MISC */
 
 #ifndef HAVE___LDISKFS_FIND_ENTRY
index 5907213..d548a2c 100644 (file)
@@ -540,6 +540,10 @@ static int enable_default_ext4_features(struct mkfs_opts *mop, char *anchor,
        if (IS_MDT(&mop->mo_ldd) && is_e2fsprogs_feature_supp("-O large_dir"))
                append_unique(anchor, ",", "large_dir", NULL, maxbuflen);
 
+       /* Disable fast_commit since it breaks ldiskfs transactions ordering */
+       if (is_e2fsprogs_feature_supp("fast_commit"))
+               append_unique(anchor, ",", "^fast_commit", NULL, maxbuflen);
+
        /* Cluster inode/block bitmaps and inode table for more efficient IO.
         * Align the flex groups on a 1MB boundary for better performance. */
        /* This -O feature needs to go last, since it adds the "-G" option. */