OSDN Git Service

ext4: add commit_tid info in jbd debug log
authorRitesh Harjani <riteshh@linux.ibm.com>
Sat, 12 Mar 2022 05:39:53 +0000 (11:09 +0530)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 15 Mar 2022 21:45:36 +0000 (17:45 -0400)
This adds commit_tid argument in ext4_fc_update_stats()
so that we can add this information too in jbd_debug logs.
This is also required in a later patch to pass the commit_tid info in
ext4_fc_commit_start/stop() trace events.

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Link: https://lore.kernel.org/r/dabda3f2919a60e01887e798bf5915216b451733.1647057583.git.riteshh@linux.ibm.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/fast_commit.c

index 849fd4d..88ed99e 100644 (file)
@@ -1164,11 +1164,12 @@ out:
 }
 
 static void ext4_fc_update_stats(struct super_block *sb, int status,
-                                u64 commit_time, int nblks)
+                                u64 commit_time, int nblks, tid_t commit_tid)
 {
        struct ext4_fc_stats *stats = &EXT4_SB(sb)->s_fc_stats;
 
-       jbd_debug(1, "Fast commit ended with status = %d", status);
+       jbd_debug(1, "Fast commit ended with status = %d for tid %u",
+                       status, commit_tid);
        if (status == EXT4_FC_STATUS_OK) {
                stats->fc_num_commits++;
                stats->fc_numblks += nblks;
@@ -1218,14 +1219,16 @@ restart_fc:
                if (atomic_read(&sbi->s_fc_subtid) <= subtid &&
                        commit_tid > journal->j_commit_sequence)
                        goto restart_fc;
-               ext4_fc_update_stats(sb, EXT4_FC_STATUS_SKIPPED, 0, 0);
+               ext4_fc_update_stats(sb, EXT4_FC_STATUS_SKIPPED, 0, 0,
+                               commit_tid);
                return 0;
        } else if (ret) {
                /*
                 * Commit couldn't start. Just update stats and perform a
                 * full commit.
                 */
-               ext4_fc_update_stats(sb, EXT4_FC_STATUS_FAILED, 0, 0);
+               ext4_fc_update_stats(sb, EXT4_FC_STATUS_FAILED, 0, 0,
+                               commit_tid);
                return jbd2_complete_transaction(journal, commit_tid);
        }
 
@@ -1257,12 +1260,12 @@ restart_fc:
         * don't react too strongly to vast changes in the commit time
         */
        commit_time = ktime_to_ns(ktime_sub(ktime_get(), start_time));
-       ext4_fc_update_stats(sb, status, commit_time, nblks);
+       ext4_fc_update_stats(sb, status, commit_time, nblks, commit_tid);
        return ret;
 
 fallback:
        ret = jbd2_fc_end_commit_fallback(journal);
-       ext4_fc_update_stats(sb, status, 0, 0);
+       ext4_fc_update_stats(sb, status, 0, 0, commit_tid);
        return ret;
 }