aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-09-30 00:32:06 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-09-30 00:32:06 -0400
commitbf6993276f74d46776f35c45ddef29b981b1d1c6 (patch)
tree5c9cb128fed29a83add1932b12443edaa6fd06cc /include
parent296c355cd6443d89fa251885a8d78778fe111dc4 (diff)
jbd2: Use tracepoints for history file
The /proc/fs/jbd2/<dev>/history was maintained manually; by using tracepoints, we can get all of the existing functionality of the /proc file plus extra capabilities thanks to the ftrace infrastructure. We save memory as a bonus. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'include')
-rw-r--r--include/linux/jbd2.h27
-rw-r--r--include/trace/events/jbd2.h78
2 files changed, 85 insertions, 20 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 52695d3dfd0..f1011f7f3d4 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -464,9 +464,9 @@ struct handle_s
464 */ 464 */
465struct transaction_chp_stats_s { 465struct transaction_chp_stats_s {
466 unsigned long cs_chp_time; 466 unsigned long cs_chp_time;
467 unsigned long cs_forced_to_close; 467 __u32 cs_forced_to_close;
468 unsigned long cs_written; 468 __u32 cs_written;
469 unsigned long cs_dropped; 469 __u32 cs_dropped;
470}; 470};
471 471
472/* The transaction_t type is the guts of the journaling mechanism. It 472/* The transaction_t type is the guts of the journaling mechanism. It
@@ -668,23 +668,16 @@ struct transaction_run_stats_s {
668 unsigned long rs_flushing; 668 unsigned long rs_flushing;
669 unsigned long rs_logging; 669 unsigned long rs_logging;
670 670
671 unsigned long rs_handle_count; 671 __u32 rs_handle_count;
672 unsigned long rs_blocks; 672 __u32 rs_blocks;
673 unsigned long rs_blocks_logged; 673 __u32 rs_blocks_logged;
674}; 674};
675 675
676struct transaction_stats_s { 676struct transaction_stats_s {
677 int ts_type;
678 unsigned long ts_tid; 677 unsigned long ts_tid;
679 union { 678 struct transaction_run_stats_s run;
680 struct transaction_run_stats_s run;
681 struct transaction_chp_stats_s chp;
682 } u;
683}; 679};
684 680
685#define JBD2_STATS_RUN 1
686#define JBD2_STATS_CHECKPOINT 2
687
688static inline unsigned long 681static inline unsigned long
689jbd2_time_diff(unsigned long start, unsigned long end) 682jbd2_time_diff(unsigned long start, unsigned long end)
690{ 683{
@@ -988,12 +981,6 @@ struct journal_s
988 /* 981 /*
989 * Journal statistics 982 * Journal statistics
990 */ 983 */
991 struct transaction_stats_s *j_history;
992 int j_history_max;
993 int j_history_cur;
994 /*
995 * Protect the transactions statistics history
996 */
997 spinlock_t j_history_lock; 984 spinlock_t j_history_lock;
998 struct proc_dir_entry *j_proc_entry; 985 struct proc_dir_entry *j_proc_entry;
999 struct transaction_stats_s j_stats; 986 struct transaction_stats_s j_stats;
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index b851f0b4701..3c60b75adb9 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -7,6 +7,9 @@
7#include <linux/jbd2.h> 7#include <linux/jbd2.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9 9
10struct transaction_chp_stats_s;
11struct transaction_run_stats_s;
12
10TRACE_EVENT(jbd2_checkpoint, 13TRACE_EVENT(jbd2_checkpoint,
11 14
12 TP_PROTO(journal_t *journal, int result), 15 TP_PROTO(journal_t *journal, int result),
@@ -162,6 +165,81 @@ TRACE_EVENT(jbd2_submit_inode_data,
162 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino) 165 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
163); 166);
164 167
168TRACE_EVENT(jbd2_run_stats,
169 TP_PROTO(dev_t dev, unsigned long tid,
170 struct transaction_run_stats_s *stats),
171
172 TP_ARGS(dev, tid, stats),
173
174 TP_STRUCT__entry(
175 __field( dev_t, dev )
176 __field( unsigned long, tid )
177 __field( unsigned long, wait )
178 __field( unsigned long, running )
179 __field( unsigned long, locked )
180 __field( unsigned long, flushing )
181 __field( unsigned long, logging )
182 __field( __u32, handle_count )
183 __field( __u32, blocks )
184 __field( __u32, blocks_logged )
185 ),
186
187 TP_fast_assign(
188 __entry->dev = dev;
189 __entry->tid = tid;
190 __entry->wait = stats->rs_wait;
191 __entry->running = stats->rs_running;
192 __entry->locked = stats->rs_locked;
193 __entry->flushing = stats->rs_flushing;
194 __entry->logging = stats->rs_logging;
195 __entry->handle_count = stats->rs_handle_count;
196 __entry->blocks = stats->rs_blocks;
197 __entry->blocks_logged = stats->rs_blocks_logged;
198 ),
199
200 TP_printk("dev %s tid %lu wait %u running %u locked %u flushing %u "
201 "logging %u handle_count %u blocks %u blocks_logged %u",
202 jbd2_dev_to_name(__entry->dev), __entry->tid,
203 jiffies_to_msecs(__entry->wait),
204 jiffies_to_msecs(__entry->running),
205 jiffies_to_msecs(__entry->locked),
206 jiffies_to_msecs(__entry->flushing),
207 jiffies_to_msecs(__entry->logging),
208 __entry->handle_count, __entry->blocks,
209 __entry->blocks_logged)
210);
211
212TRACE_EVENT(jbd2_checkpoint_stats,
213 TP_PROTO(dev_t dev, unsigned long tid,
214 struct transaction_chp_stats_s *stats),
215
216 TP_ARGS(dev, tid, stats),
217
218 TP_STRUCT__entry(
219 __field( dev_t, dev )
220 __field( unsigned long, tid )
221 __field( unsigned long, chp_time )
222 __field( __u32, forced_to_close )
223 __field( __u32, written )
224 __field( __u32, dropped )
225 ),
226
227 TP_fast_assign(
228 __entry->dev = dev;
229 __entry->tid = tid;
230 __entry->chp_time = stats->cs_chp_time;
231 __entry->forced_to_close= stats->cs_forced_to_close;
232 __entry->written = stats->cs_written;
233 __entry->dropped = stats->cs_dropped;
234 ),
235
236 TP_printk("dev %s tid %lu chp_time %u forced_to_close %u "
237 "written %u dropped %u",
238 jbd2_dev_to_name(__entry->dev), __entry->tid,
239 jiffies_to_msecs(__entry->chp_time),
240 __entry->forced_to_close, __entry->written, __entry->dropped)
241);
242
165#endif /* _TRACE_JBD2_H */ 243#endif /* _TRACE_JBD2_H */
166 244
167/* This part must be outside protection */ 245/* This part must be outside protection */