Skip to content

Commit d9bf099

Browse files
riteshharjanitytso
authored andcommitted
ext4: add commit_tid info in jbd debug log
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>
1 parent 1d2e244 commit d9bf099

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

fs/ext4/fast_commit.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,11 +1164,12 @@ static int ext4_fc_perform_commit(journal_t *journal)
11641164
}
11651165

11661166
static void ext4_fc_update_stats(struct super_block *sb, int status,
1167-
u64 commit_time, int nblks)
1167+
u64 commit_time, int nblks, tid_t commit_tid)
11681168
{
11691169
struct ext4_fc_stats *stats = &EXT4_SB(sb)->s_fc_stats;
11701170

1171-
jbd_debug(1, "Fast commit ended with status = %d", status);
1171+
jbd_debug(1, "Fast commit ended with status = %d for tid %u",
1172+
status, commit_tid);
11721173
if (status == EXT4_FC_STATUS_OK) {
11731174
stats->fc_num_commits++;
11741175
stats->fc_numblks += nblks;
@@ -1218,14 +1219,16 @@ int ext4_fc_commit(journal_t *journal, tid_t commit_tid)
12181219
if (atomic_read(&sbi->s_fc_subtid) <= subtid &&
12191220
commit_tid > journal->j_commit_sequence)
12201221
goto restart_fc;
1221-
ext4_fc_update_stats(sb, EXT4_FC_STATUS_SKIPPED, 0, 0);
1222+
ext4_fc_update_stats(sb, EXT4_FC_STATUS_SKIPPED, 0, 0,
1223+
commit_tid);
12221224
return 0;
12231225
} else if (ret) {
12241226
/*
12251227
* Commit couldn't start. Just update stats and perform a
12261228
* full commit.
12271229
*/
1228-
ext4_fc_update_stats(sb, EXT4_FC_STATUS_FAILED, 0, 0);
1230+
ext4_fc_update_stats(sb, EXT4_FC_STATUS_FAILED, 0, 0,
1231+
commit_tid);
12291232
return jbd2_complete_transaction(journal, commit_tid);
12301233
}
12311234

@@ -1257,12 +1260,12 @@ int ext4_fc_commit(journal_t *journal, tid_t commit_tid)
12571260
* don't react too strongly to vast changes in the commit time
12581261
*/
12591262
commit_time = ktime_to_ns(ktime_sub(ktime_get(), start_time));
1260-
ext4_fc_update_stats(sb, status, commit_time, nblks);
1263+
ext4_fc_update_stats(sb, status, commit_time, nblks, commit_tid);
12611264
return ret;
12621265

12631266
fallback:
12641267
ret = jbd2_fc_end_commit_fallback(journal);
1265-
ext4_fc_update_stats(sb, status, 0, 0);
1268+
ext4_fc_update_stats(sb, status, 0, 0, commit_tid);
12661269
return ret;
12671270
}
12681271

0 commit comments

Comments
 (0)