diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-04-14 23:02:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-16 04:11:01 -0400 |
commit | f3948f8857ef5de239f28a61dddb1554a0ae4c2c (patch) | |
tree | 62e5568c18b944d086366510fb0ff8ed71682897 /kernel | |
parent | 1d54ad6da9192fed5dd3b60224d9f2dfea0dcd82 (diff) |
blktrace: fix context-info when mixed-using blk tracer and trace events
When current tracer is set to blk tracer, TRACE_ITER_CONTEXT_INFO is
unset, but actually context-info is printed:
pdflush-431 [000] 821.181576: 8,0 P N [pdflush]
And then if we enable TRACE_ITER_CONTEXT_INFO:
# echo context-info > trace_options
We'll see context-info printed twice. What's worse, when we use blk
tracer and trace events at the same time, we'll see no context-info
for trace events at all:
jbd2_commit_logging: dev dm-0:8 transaction 333227
jbd2_end_commit: dev dm-0:8 transaction 333227 head 332814
rm-25433 [001] 9578.307485: 8,18 m N cfq25433 slice expired t=0
rm-25433 [001] 9578.307486: 8,18 m N cfq25433 put_queue
This patch adds blk_tracer->set_flags(), and context-info flag is unset
only when we set the output to classic mode.
Note after this patch, one should unset context-info explicitly if he
wants to get binary output that can be parsed by blkparse:
# echo nocontext-info > trace_options
# echo bin > trace_options
# echo blk > current_tracer
# cat trace_pipe | blkparse -i -
Reported-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <49E54E60.50408@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/blktrace.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 8e7c5da3a3e6..c32062bd10b3 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -1211,7 +1211,6 @@ static void blk_tracer_print_header(struct seq_file *m) | |||
1211 | static void blk_tracer_start(struct trace_array *tr) | 1211 | static void blk_tracer_start(struct trace_array *tr) |
1212 | { | 1212 | { |
1213 | blk_tracer_enabled = true; | 1213 | blk_tracer_enabled = true; |
1214 | trace_flags &= ~TRACE_ITER_CONTEXT_INFO; | ||
1215 | } | 1214 | } |
1216 | 1215 | ||
1217 | static int blk_tracer_init(struct trace_array *tr) | 1216 | static int blk_tracer_init(struct trace_array *tr) |
@@ -1224,7 +1223,6 @@ static int blk_tracer_init(struct trace_array *tr) | |||
1224 | static void blk_tracer_stop(struct trace_array *tr) | 1223 | static void blk_tracer_stop(struct trace_array *tr) |
1225 | { | 1224 | { |
1226 | blk_tracer_enabled = false; | 1225 | blk_tracer_enabled = false; |
1227 | trace_flags |= TRACE_ITER_CONTEXT_INFO; | ||
1228 | } | 1226 | } |
1229 | 1227 | ||
1230 | static void blk_tracer_reset(struct trace_array *tr) | 1228 | static void blk_tracer_reset(struct trace_array *tr) |
@@ -1289,9 +1287,6 @@ out: | |||
1289 | static enum print_line_t blk_trace_event_print(struct trace_iterator *iter, | 1287 | static enum print_line_t blk_trace_event_print(struct trace_iterator *iter, |
1290 | int flags) | 1288 | int flags) |
1291 | { | 1289 | { |
1292 | if (!trace_print_context(iter)) | ||
1293 | return TRACE_TYPE_PARTIAL_LINE; | ||
1294 | |||
1295 | return print_one_line(iter, false); | 1290 | return print_one_line(iter, false); |
1296 | } | 1291 | } |
1297 | 1292 | ||
@@ -1326,6 +1321,18 @@ static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter) | |||
1326 | return print_one_line(iter, true); | 1321 | return print_one_line(iter, true); |
1327 | } | 1322 | } |
1328 | 1323 | ||
1324 | static int blk_tracer_set_flag(u32 old_flags, u32 bit, int set) | ||
1325 | { | ||
1326 | /* don't output context-info for blk_classic output */ | ||
1327 | if (bit == TRACE_BLK_OPT_CLASSIC) { | ||
1328 | if (set) | ||
1329 | trace_flags &= ~TRACE_ITER_CONTEXT_INFO; | ||
1330 | else | ||
1331 | trace_flags |= TRACE_ITER_CONTEXT_INFO; | ||
1332 | } | ||
1333 | return 0; | ||
1334 | } | ||
1335 | |||
1329 | static struct tracer blk_tracer __read_mostly = { | 1336 | static struct tracer blk_tracer __read_mostly = { |
1330 | .name = "blk", | 1337 | .name = "blk", |
1331 | .init = blk_tracer_init, | 1338 | .init = blk_tracer_init, |
@@ -1335,6 +1342,7 @@ static struct tracer blk_tracer __read_mostly = { | |||
1335 | .print_header = blk_tracer_print_header, | 1342 | .print_header = blk_tracer_print_header, |
1336 | .print_line = blk_tracer_print_line, | 1343 | .print_line = blk_tracer_print_line, |
1337 | .flags = &blk_tracer_flags, | 1344 | .flags = &blk_tracer_flags, |
1345 | .set_flag = blk_tracer_set_flag, | ||
1338 | }; | 1346 | }; |
1339 | 1347 | ||
1340 | static struct trace_event trace_blk_event = { | 1348 | static struct trace_event trace_blk_event = { |