Skip to content

Commit 5641ace

Browse files
riteshharjanitytso
authored andcommitted
ext4: add commit tid info in ext4_fc_commit_start/stop trace events
This adds commit_tid info in ext4_fc_commit_start/stop which is helpful in debugging fast_commit issues. For e.g. issues where due to jbd2 journal full commit, FC miss to commit updates to a file. Also improves TP_prink format string i.e. all ext4 and jbd2 trace events starts with "dev MAjOR,MINOR". Let's follow the same convention while we are still at it. Signed-off-by: Ritesh Harjani <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Harshad Shirwadkar <[email protected]> Link: https://lore.kernel.org/r/ebcd6b9ab5b718db30f90854497886801ce38c63.1647057583.git.riteshh@linux.ibm.com Signed-off-by: Theodore Ts'o <[email protected]>
1 parent d9bf099 commit 5641ace

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

fs/ext4/fast_commit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ static void ext4_fc_update_stats(struct super_block *sb, int status,
11871187
} else {
11881188
stats->fc_skipped_commits++;
11891189
}
1190-
trace_ext4_fc_commit_stop(sb, nblks, status);
1190+
trace_ext4_fc_commit_stop(sb, nblks, status, commit_tid);
11911191
}
11921192

11931193
/*
@@ -1208,7 +1208,7 @@ int ext4_fc_commit(journal_t *journal, tid_t commit_tid)
12081208
if (!test_opt2(sb, JOURNAL_FAST_COMMIT))
12091209
return jbd2_complete_transaction(journal, commit_tid);
12101210

1211-
trace_ext4_fc_commit_start(sb);
1211+
trace_ext4_fc_commit_start(sb, commit_tid);
12121212

12131213
start_time = ktime_get();
12141214

include/trace/events/ext4.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,26 +2686,29 @@ TRACE_EVENT(ext4_fc_replay,
26862686
);
26872687

26882688
TRACE_EVENT(ext4_fc_commit_start,
2689-
TP_PROTO(struct super_block *sb),
2689+
TP_PROTO(struct super_block *sb, tid_t commit_tid),
26902690

2691-
TP_ARGS(sb),
2691+
TP_ARGS(sb, commit_tid),
26922692

26932693
TP_STRUCT__entry(
26942694
__field(dev_t, dev)
2695+
__field(tid_t, tid)
26952696
),
26962697

26972698
TP_fast_assign(
26982699
__entry->dev = sb->s_dev;
2700+
__entry->tid = commit_tid;
26992701
),
27002702

2701-
TP_printk("fast_commit started on dev %d,%d",
2702-
MAJOR(__entry->dev), MINOR(__entry->dev))
2703+
TP_printk("dev %d,%d tid %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2704+
__entry->tid)
27032705
);
27042706

27052707
TRACE_EVENT(ext4_fc_commit_stop,
2706-
TP_PROTO(struct super_block *sb, int nblks, int reason),
2708+
TP_PROTO(struct super_block *sb, int nblks, int reason,
2709+
tid_t commit_tid),
27072710

2708-
TP_ARGS(sb, nblks, reason),
2711+
TP_ARGS(sb, nblks, reason, commit_tid),
27092712

27102713
TP_STRUCT__entry(
27112714
__field(dev_t, dev)
@@ -2714,6 +2717,7 @@ TRACE_EVENT(ext4_fc_commit_stop,
27142717
__field(int, num_fc)
27152718
__field(int, num_fc_ineligible)
27162719
__field(int, nblks_agg)
2720+
__field(tid_t, tid)
27172721
),
27182722

27192723
TP_fast_assign(
@@ -2724,12 +2728,13 @@ TRACE_EVENT(ext4_fc_commit_stop,
27242728
__entry->num_fc_ineligible =
27252729
EXT4_SB(sb)->s_fc_stats.fc_ineligible_commits;
27262730
__entry->nblks_agg = EXT4_SB(sb)->s_fc_stats.fc_numblks;
2731+
__entry->tid = commit_tid;
27272732
),
27282733

2729-
TP_printk("fc on [%d,%d] nblks %d, reason %d, fc = %d, ineligible = %d, agg_nblks %d",
2734+
TP_printk("dev %d,%d nblks %d, reason %d, fc = %d, ineligible = %d, agg_nblks %d, tid %u",
27302735
MAJOR(__entry->dev), MINOR(__entry->dev),
27312736
__entry->nblks, __entry->reason, __entry->num_fc,
2732-
__entry->num_fc_ineligible, __entry->nblks_agg)
2737+
__entry->num_fc_ineligible, __entry->nblks_agg, __entry->tid)
27332738
);
27342739

27352740
#define FC_REASON_NAME_STAT(reason) \

0 commit comments

Comments
 (0)