diff options
author | Lukas Czerner <lczerner@redhat.com> | 2011-05-23 12:33:02 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2011-06-25 11:29:51 -0400 |
commit | 99cb1a318c37bf462c53d43f4dacb7b4896ce0c9 (patch) | |
tree | 32a9046649777e8cc589bbc8e0afb382642ba450 | |
parent | 785c4bcc0d88ff006a0b2120815a71e86ecf21ce (diff) |
jbd: Add fixed tracepoints
This commit adds fixed tracepoint for jbd. It has been based on fixed
tracepoints for jbd2, however there are missing those for collecting
statistics, since I think that it will require more intrusive patch so I
should have its own commit, if someone decide that it is needed. Also
there are new tracepoints in __journal_drop_transaction() and
journal_update_superblock().
The list of jbd tracepoints:
jbd_checkpoint
jbd_start_commit
jbd_commit_locking
jbd_commit_flushing
jbd_commit_logging
jbd_drop_transaction
jbd_end_commit
jbd_do_submit_data
jbd_cleanup_journal_tail
jbd_update_superblock_end
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | fs/jbd/checkpoint.c | 4 | ||||
-rw-r--r-- | fs/jbd/commit.c | 11 | ||||
-rw-r--r-- | fs/jbd/journal.c | 4 | ||||
-rw-r--r-- | include/trace/events/jbd.h | 203 |
4 files changed, 222 insertions, 0 deletions
diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c index e4b87bc1fa56..dea7503b47e8 100644 --- a/fs/jbd/checkpoint.c +++ b/fs/jbd/checkpoint.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/jbd.h> | 22 | #include <linux/jbd.h> |
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <trace/events/jbd.h> | ||
25 | 26 | ||
26 | /* | 27 | /* |
27 | * Unlink a buffer from a transaction checkpoint list. | 28 | * Unlink a buffer from a transaction checkpoint list. |
@@ -358,6 +359,7 @@ int log_do_checkpoint(journal_t *journal) | |||
358 | * journal straight away. | 359 | * journal straight away. |
359 | */ | 360 | */ |
360 | result = cleanup_journal_tail(journal); | 361 | result = cleanup_journal_tail(journal); |
362 | trace_jbd_checkpoint(journal, result); | ||
361 | jbd_debug(1, "cleanup_journal_tail returned %d\n", result); | 363 | jbd_debug(1, "cleanup_journal_tail returned %d\n", result); |
362 | if (result <= 0) | 364 | if (result <= 0) |
363 | return result; | 365 | return result; |
@@ -503,6 +505,7 @@ int cleanup_journal_tail(journal_t *journal) | |||
503 | if (blocknr < journal->j_tail) | 505 | if (blocknr < journal->j_tail) |
504 | freed = freed + journal->j_last - journal->j_first; | 506 | freed = freed + journal->j_last - journal->j_first; |
505 | 507 | ||
508 | trace_jbd_cleanup_journal_tail(journal, first_tid, blocknr, freed); | ||
506 | jbd_debug(1, | 509 | jbd_debug(1, |
507 | "Cleaning journal tail from %d to %d (offset %u), " | 510 | "Cleaning journal tail from %d to %d (offset %u), " |
508 | "freeing %u\n", | 511 | "freeing %u\n", |
@@ -752,6 +755,7 @@ void __journal_drop_transaction(journal_t *journal, transaction_t *transaction) | |||
752 | J_ASSERT(journal->j_committing_transaction != transaction); | 755 | J_ASSERT(journal->j_committing_transaction != transaction); |
753 | J_ASSERT(journal->j_running_transaction != transaction); | 756 | J_ASSERT(journal->j_running_transaction != transaction); |
754 | 757 | ||
758 | trace_jbd_drop_transaction(journal, transaction); | ||
755 | jbd_debug(1, "Dropping transaction %d, all done\n", transaction->t_tid); | 759 | jbd_debug(1, "Dropping transaction %d, all done\n", transaction->t_tid); |
756 | kfree(transaction); | 760 | kfree(transaction); |
757 | } | 761 | } |
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 72ffa974b0b8..eedd201374a8 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/pagemap.h> | 21 | #include <linux/pagemap.h> |
22 | #include <linux/bio.h> | 22 | #include <linux/bio.h> |
23 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
24 | #include <trace/events/jbd.h> | ||
24 | 25 | ||
25 | /* | 26 | /* |
26 | * Default IO end handler for temporary BJ_IO buffer_heads. | 27 | * Default IO end handler for temporary BJ_IO buffer_heads. |
@@ -204,6 +205,8 @@ write_out_data: | |||
204 | if (!trylock_buffer(bh)) { | 205 | if (!trylock_buffer(bh)) { |
205 | BUFFER_TRACE(bh, "needs blocking lock"); | 206 | BUFFER_TRACE(bh, "needs blocking lock"); |
206 | spin_unlock(&journal->j_list_lock); | 207 | spin_unlock(&journal->j_list_lock); |
208 | trace_jbd_do_submit_data(journal, | ||
209 | commit_transaction); | ||
207 | /* Write out all data to prevent deadlocks */ | 210 | /* Write out all data to prevent deadlocks */ |
208 | journal_do_submit_data(wbuf, bufs, write_op); | 211 | journal_do_submit_data(wbuf, bufs, write_op); |
209 | bufs = 0; | 212 | bufs = 0; |
@@ -236,6 +239,8 @@ write_out_data: | |||
236 | jbd_unlock_bh_state(bh); | 239 | jbd_unlock_bh_state(bh); |
237 | if (bufs == journal->j_wbufsize) { | 240 | if (bufs == journal->j_wbufsize) { |
238 | spin_unlock(&journal->j_list_lock); | 241 | spin_unlock(&journal->j_list_lock); |
242 | trace_jbd_do_submit_data(journal, | ||
243 | commit_transaction); | ||
239 | journal_do_submit_data(wbuf, bufs, write_op); | 244 | journal_do_submit_data(wbuf, bufs, write_op); |
240 | bufs = 0; | 245 | bufs = 0; |
241 | goto write_out_data; | 246 | goto write_out_data; |
@@ -266,6 +271,7 @@ write_out_data: | |||
266 | } | 271 | } |
267 | } | 272 | } |
268 | spin_unlock(&journal->j_list_lock); | 273 | spin_unlock(&journal->j_list_lock); |
274 | trace_jbd_do_submit_data(journal, commit_transaction); | ||
269 | journal_do_submit_data(wbuf, bufs, write_op); | 275 | journal_do_submit_data(wbuf, bufs, write_op); |
270 | 276 | ||
271 | return err; | 277 | return err; |
@@ -316,12 +322,14 @@ void journal_commit_transaction(journal_t *journal) | |||
316 | commit_transaction = journal->j_running_transaction; | 322 | commit_transaction = journal->j_running_transaction; |
317 | J_ASSERT(commit_transaction->t_state == T_RUNNING); | 323 | J_ASSERT(commit_transaction->t_state == T_RUNNING); |
318 | 324 | ||
325 | trace_jbd_start_commit(journal, commit_transaction); | ||
319 | jbd_debug(1, "JBD: starting commit of transaction %d\n", | 326 | jbd_debug(1, "JBD: starting commit of transaction %d\n", |
320 | commit_transaction->t_tid); | 327 | commit_transaction->t_tid); |
321 | 328 | ||
322 | spin_lock(&journal->j_state_lock); | 329 | spin_lock(&journal->j_state_lock); |
323 | commit_transaction->t_state = T_LOCKED; | 330 | commit_transaction->t_state = T_LOCKED; |
324 | 331 | ||
332 | trace_jbd_commit_locking(journal, commit_transaction); | ||
325 | spin_lock(&commit_transaction->t_handle_lock); | 333 | spin_lock(&commit_transaction->t_handle_lock); |
326 | while (commit_transaction->t_updates) { | 334 | while (commit_transaction->t_updates) { |
327 | DEFINE_WAIT(wait); | 335 | DEFINE_WAIT(wait); |
@@ -392,6 +400,7 @@ void journal_commit_transaction(journal_t *journal) | |||
392 | */ | 400 | */ |
393 | journal_switch_revoke_table(journal); | 401 | journal_switch_revoke_table(journal); |
394 | 402 | ||
403 | trace_jbd_commit_flushing(journal, commit_transaction); | ||
395 | commit_transaction->t_state = T_FLUSH; | 404 | commit_transaction->t_state = T_FLUSH; |
396 | journal->j_committing_transaction = commit_transaction; | 405 | journal->j_committing_transaction = commit_transaction; |
397 | journal->j_running_transaction = NULL; | 406 | journal->j_running_transaction = NULL; |
@@ -493,6 +502,7 @@ void journal_commit_transaction(journal_t *journal) | |||
493 | commit_transaction->t_state = T_COMMIT; | 502 | commit_transaction->t_state = T_COMMIT; |
494 | spin_unlock(&journal->j_state_lock); | 503 | spin_unlock(&journal->j_state_lock); |
495 | 504 | ||
505 | trace_jbd_commit_logging(journal, commit_transaction); | ||
496 | J_ASSERT(commit_transaction->t_nr_buffers <= | 506 | J_ASSERT(commit_transaction->t_nr_buffers <= |
497 | commit_transaction->t_outstanding_credits); | 507 | commit_transaction->t_outstanding_credits); |
498 | 508 | ||
@@ -946,6 +956,7 @@ restart_loop: | |||
946 | } | 956 | } |
947 | spin_unlock(&journal->j_list_lock); | 957 | spin_unlock(&journal->j_list_lock); |
948 | 958 | ||
959 | trace_jbd_end_commit(journal, commit_transaction); | ||
949 | jbd_debug(1, "JBD: commit %d complete, head %d\n", | 960 | jbd_debug(1, "JBD: commit %d complete, head %d\n", |
950 | journal->j_commit_sequence, journal->j_tail_sequence); | 961 | journal->j_commit_sequence, journal->j_tail_sequence); |
951 | 962 | ||
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index e2d4285fbe90..ab019ee77888 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -38,6 +38,9 @@ | |||
38 | #include <linux/debugfs.h> | 38 | #include <linux/debugfs.h> |
39 | #include <linux/ratelimit.h> | 39 | #include <linux/ratelimit.h> |
40 | 40 | ||
41 | #define CREATE_TRACE_POINTS | ||
42 | #include <trace/events/jbd.h> | ||
43 | |||
41 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
42 | #include <asm/page.h> | 45 | #include <asm/page.h> |
43 | 46 | ||
@@ -1065,6 +1068,7 @@ void journal_update_superblock(journal_t *journal, int wait) | |||
1065 | } else | 1068 | } else |
1066 | write_dirty_buffer(bh, WRITE); | 1069 | write_dirty_buffer(bh, WRITE); |
1067 | 1070 | ||
1071 | trace_jbd_update_superblock_end(journal, wait); | ||
1068 | out: | 1072 | out: |
1069 | /* If we have just flushed the log (by marking s_start==0), then | 1073 | /* If we have just flushed the log (by marking s_start==0), then |
1070 | * any future commit will have to be careful to update the | 1074 | * any future commit will have to be careful to update the |
diff --git a/include/trace/events/jbd.h b/include/trace/events/jbd.h new file mode 100644 index 000000000000..aff64d82d713 --- /dev/null +++ b/include/trace/events/jbd.h | |||
@@ -0,0 +1,203 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM jbd | ||
3 | |||
4 | #if !defined(_TRACE_JBD_H) || defined(TRACE_HEADER_MULTI_READ) | ||
5 | #define _TRACE_JBD_H | ||
6 | |||
7 | #include <linux/jbd.h> | ||
8 | #include <linux/tracepoint.h> | ||
9 | |||
10 | TRACE_EVENT(jbd_checkpoint, | ||
11 | |||
12 | TP_PROTO(journal_t *journal, int result), | ||
13 | |||
14 | TP_ARGS(journal, result), | ||
15 | |||
16 | TP_STRUCT__entry( | ||
17 | __field( dev_t, dev ) | ||
18 | __field( int, result ) | ||
19 | ), | ||
20 | |||
21 | TP_fast_assign( | ||
22 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
23 | __entry->result = result; | ||
24 | ), | ||
25 | |||
26 | TP_printk("dev %d,%d result %d", | ||
27 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
28 | __entry->result) | ||
29 | ); | ||
30 | |||
31 | DECLARE_EVENT_CLASS(jbd_commit, | ||
32 | |||
33 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | ||
34 | |||
35 | TP_ARGS(journal, commit_transaction), | ||
36 | |||
37 | TP_STRUCT__entry( | ||
38 | __field( dev_t, dev ) | ||
39 | __field( char, sync_commit ) | ||
40 | __field( int, transaction ) | ||
41 | ), | ||
42 | |||
43 | TP_fast_assign( | ||
44 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
45 | __entry->sync_commit = commit_transaction->t_synchronous_commit; | ||
46 | __entry->transaction = commit_transaction->t_tid; | ||
47 | ), | ||
48 | |||
49 | TP_printk("dev %d,%d transaction %d sync %d", | ||
50 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
51 | __entry->transaction, __entry->sync_commit) | ||
52 | ); | ||
53 | |||
54 | DEFINE_EVENT(jbd_commit, jbd_start_commit, | ||
55 | |||
56 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | ||
57 | |||
58 | TP_ARGS(journal, commit_transaction) | ||
59 | ); | ||
60 | |||
61 | DEFINE_EVENT(jbd_commit, jbd_commit_locking, | ||
62 | |||
63 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | ||
64 | |||
65 | TP_ARGS(journal, commit_transaction) | ||
66 | ); | ||
67 | |||
68 | DEFINE_EVENT(jbd_commit, jbd_commit_flushing, | ||
69 | |||
70 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | ||
71 | |||
72 | TP_ARGS(journal, commit_transaction) | ||
73 | ); | ||
74 | |||
75 | DEFINE_EVENT(jbd_commit, jbd_commit_logging, | ||
76 | |||
77 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | ||
78 | |||
79 | TP_ARGS(journal, commit_transaction) | ||
80 | ); | ||
81 | |||
82 | TRACE_EVENT(jbd_drop_transaction, | ||
83 | |||
84 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | ||
85 | |||
86 | TP_ARGS(journal, commit_transaction), | ||
87 | |||
88 | TP_STRUCT__entry( | ||
89 | __field( dev_t, dev ) | ||
90 | __field( char, sync_commit ) | ||
91 | __field( int, transaction ) | ||
92 | ), | ||
93 | |||
94 | TP_fast_assign( | ||
95 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
96 | __entry->sync_commit = commit_transaction->t_synchronous_commit; | ||
97 | __entry->transaction = commit_transaction->t_tid; | ||
98 | ), | ||
99 | |||
100 | TP_printk("dev %d,%d transaction %d sync %d", | ||
101 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
102 | __entry->transaction, __entry->sync_commit) | ||
103 | ); | ||
104 | |||
105 | TRACE_EVENT(jbd_end_commit, | ||
106 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | ||
107 | |||
108 | TP_ARGS(journal, commit_transaction), | ||
109 | |||
110 | TP_STRUCT__entry( | ||
111 | __field( dev_t, dev ) | ||
112 | __field( char, sync_commit ) | ||
113 | __field( int, transaction ) | ||
114 | __field( int, head ) | ||
115 | ), | ||
116 | |||
117 | TP_fast_assign( | ||
118 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
119 | __entry->sync_commit = commit_transaction->t_synchronous_commit; | ||
120 | __entry->transaction = commit_transaction->t_tid; | ||
121 | __entry->head = journal->j_tail_sequence; | ||
122 | ), | ||
123 | |||
124 | TP_printk("dev %d,%d transaction %d sync %d head %d", | ||
125 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
126 | __entry->transaction, __entry->sync_commit, __entry->head) | ||
127 | ); | ||
128 | |||
129 | TRACE_EVENT(jbd_do_submit_data, | ||
130 | TP_PROTO(journal_t *journal, transaction_t *commit_transaction), | ||
131 | |||
132 | TP_ARGS(journal, commit_transaction), | ||
133 | |||
134 | TP_STRUCT__entry( | ||
135 | __field( dev_t, dev ) | ||
136 | __field( char, sync_commit ) | ||
137 | __field( int, transaction ) | ||
138 | ), | ||
139 | |||
140 | TP_fast_assign( | ||
141 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
142 | __entry->sync_commit = commit_transaction->t_synchronous_commit; | ||
143 | __entry->transaction = commit_transaction->t_tid; | ||
144 | ), | ||
145 | |||
146 | TP_printk("dev %d,%d transaction %d sync %d", | ||
147 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
148 | __entry->transaction, __entry->sync_commit) | ||
149 | ); | ||
150 | |||
151 | TRACE_EVENT(jbd_cleanup_journal_tail, | ||
152 | |||
153 | TP_PROTO(journal_t *journal, tid_t first_tid, | ||
154 | unsigned long block_nr, unsigned long freed), | ||
155 | |||
156 | TP_ARGS(journal, first_tid, block_nr, freed), | ||
157 | |||
158 | TP_STRUCT__entry( | ||
159 | __field( dev_t, dev ) | ||
160 | __field( tid_t, tail_sequence ) | ||
161 | __field( tid_t, first_tid ) | ||
162 | __field(unsigned long, block_nr ) | ||
163 | __field(unsigned long, freed ) | ||
164 | ), | ||
165 | |||
166 | TP_fast_assign( | ||
167 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
168 | __entry->tail_sequence = journal->j_tail_sequence; | ||
169 | __entry->first_tid = first_tid; | ||
170 | __entry->block_nr = block_nr; | ||
171 | __entry->freed = freed; | ||
172 | ), | ||
173 | |||
174 | TP_printk("dev %d,%d from %u to %u offset %lu freed %lu", | ||
175 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
176 | __entry->tail_sequence, __entry->first_tid, | ||
177 | __entry->block_nr, __entry->freed) | ||
178 | ); | ||
179 | |||
180 | TRACE_EVENT(jbd_update_superblock_end, | ||
181 | TP_PROTO(journal_t *journal, int wait), | ||
182 | |||
183 | TP_ARGS(journal, wait), | ||
184 | |||
185 | TP_STRUCT__entry( | ||
186 | __field( dev_t, dev ) | ||
187 | __field( int, wait ) | ||
188 | ), | ||
189 | |||
190 | TP_fast_assign( | ||
191 | __entry->dev = journal->j_fs_dev->bd_dev; | ||
192 | __entry->wait = wait; | ||
193 | ), | ||
194 | |||
195 | TP_printk("dev %d,%d wait %d", | ||
196 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
197 | __entry->wait) | ||
198 | ); | ||
199 | |||
200 | #endif /* _TRACE_JBD_H */ | ||
201 | |||
202 | /* This part must be outside protection */ | ||
203 | #include <trace/define_trace.h> | ||