Skip to content

Commit 0094f98

Browse files
jankaratytso
authored andcommitted
jbd2: Provide trace event for handle restarts
Provide trace event for handle restarts to ease debugging. Reviewed-by: Theodore Ts'o <[email protected]> Signed-off-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 83448bd commit 0094f98

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

fs/jbd2/transaction.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, int revoke_records,
747747
journal_t *journal;
748748
tid_t tid;
749749
int need_to_start;
750+
int ret;
750751

751752
/* If we've had an abort of any type, don't even think about
752753
* actually doing the restart! */
@@ -776,7 +777,12 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, int revoke_records,
776777
DIV_ROUND_UP(revoke_records,
777778
journal->j_revoke_records_per_block);
778779
handle->h_revoke_credits = revoke_records;
779-
return start_this_handle(journal, handle, gfp_mask);
780+
ret = start_this_handle(journal, handle, gfp_mask);
781+
trace_jbd2_handle_restart(journal->j_fs_dev->bd_dev,
782+
ret ? 0 : handle->h_transaction->t_tid,
783+
handle->h_type, handle->h_line_no,
784+
handle->h_total_credits);
785+
return ret;
780786
}
781787
EXPORT_SYMBOL(jbd2__journal_restart);
782788

include/trace/events/jbd2.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ TRACE_EVENT(jbd2_submit_inode_data,
133133
(unsigned long) __entry->ino)
134134
);
135135

136-
TRACE_EVENT(jbd2_handle_start,
136+
DECLARE_EVENT_CLASS(jbd2_handle_start_class,
137137
TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
138138
unsigned int line_no, int requested_blocks),
139139

@@ -161,6 +161,20 @@ TRACE_EVENT(jbd2_handle_start,
161161
__entry->type, __entry->line_no, __entry->requested_blocks)
162162
);
163163

164+
DEFINE_EVENT(jbd2_handle_start_class, jbd2_handle_start,
165+
TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
166+
unsigned int line_no, int requested_blocks),
167+
168+
TP_ARGS(dev, tid, type, line_no, requested_blocks)
169+
);
170+
171+
DEFINE_EVENT(jbd2_handle_start_class, jbd2_handle_restart,
172+
TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
173+
unsigned int line_no, int requested_blocks),
174+
175+
TP_ARGS(dev, tid, type, line_no, requested_blocks)
176+
);
177+
164178
TRACE_EVENT(jbd2_handle_extend,
165179
TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
166180
unsigned int line_no, int buffer_credits,

0 commit comments

Comments
 (0)