Skip to content

Commit

Permalink
jbd2: Provide trace event for handle restarts
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jankara authored and tytso committed Nov 5, 2019
1 parent 83448bd commit 0094f98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
8 changes: 7 additions & 1 deletion fs/jbd2/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, int revoke_records,
journal_t *journal;
tid_t tid;
int need_to_start;
int ret;

/* If we've had an abort of any type, don't even think about
* actually doing the restart! */
Expand Down Expand Up @@ -776,7 +777,12 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, int revoke_records,
DIV_ROUND_UP(revoke_records,
journal->j_revoke_records_per_block);
handle->h_revoke_credits = revoke_records;
return start_this_handle(journal, handle, gfp_mask);
ret = start_this_handle(journal, handle, gfp_mask);
trace_jbd2_handle_restart(journal->j_fs_dev->bd_dev,
ret ? 0 : handle->h_transaction->t_tid,
handle->h_type, handle->h_line_no,
handle->h_total_credits);
return ret;
}
EXPORT_SYMBOL(jbd2__journal_restart);

Expand Down
16 changes: 15 additions & 1 deletion include/trace/events/jbd2.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ TRACE_EVENT(jbd2_submit_inode_data,
(unsigned long) __entry->ino)
);

TRACE_EVENT(jbd2_handle_start,
DECLARE_EVENT_CLASS(jbd2_handle_start_class,
TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
unsigned int line_no, int requested_blocks),

Expand Down Expand Up @@ -161,6 +161,20 @@ TRACE_EVENT(jbd2_handle_start,
__entry->type, __entry->line_no, __entry->requested_blocks)
);

DEFINE_EVENT(jbd2_handle_start_class, jbd2_handle_start,
TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
unsigned int line_no, int requested_blocks),

TP_ARGS(dev, tid, type, line_no, requested_blocks)
);

DEFINE_EVENT(jbd2_handle_start_class, jbd2_handle_restart,
TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
unsigned int line_no, int requested_blocks),

TP_ARGS(dev, tid, type, line_no, requested_blocks)
);

TRACE_EVENT(jbd2_handle_extend,
TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
unsigned int line_no, int buffer_credits,
Expand Down

0 comments on commit 0094f98

Please sign in to comment.