aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-03-25 05:21:26 -0400
committerIngo Molnar <mingo@elte.hu>2009-03-31 11:27:08 -0400
commit5554720482a631702146a959db22fe417740e0a6 (patch)
treefd7a304638269e3b3826faeb5dbc35f04af4deeb /kernel
parentb5230b56ee6caeb27cedb7753c0c319646383bb4 (diff)
blktrace: fix the original blktrace
Currently the original blktrace, which is using relay and is used via ioctl, is broken. You can use ftrace to see the output of blktrace, but user-space blktrace is unusable. It's broken by "blktrace: add ftrace plugin" (c71a896154119f4ca9e89d6078f5f63ad60ef199) - if (unlikely(bt->trace_state != Blktrace_running)) + if (unlikely(bt->trace_state != Blktrace_running || !blk_tracer_enabled)) return; With this patch, both ioctl and ftrace can be used, but of course you can't use both of them at the same time. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Jens Axboe <jens.axboe@oracle.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/blktrace.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 95f89faca73..a7f7ff5db38 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -110,7 +110,7 @@ void __trace_note_message(struct blk_trace *bt, const char *fmt, ...)
110 unsigned long flags; 110 unsigned long flags;
111 char *buf; 111 char *buf;
112 112
113 if (blk_tr) { 113 if (blk_tracer_enabled) {
114 va_start(args, fmt); 114 va_start(args, fmt);
115 ftrace_vprintk(fmt, args); 115 ftrace_vprintk(fmt, args);
116 va_end(args); 116 va_end(args);
@@ -169,7 +169,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
169 pid_t pid; 169 pid_t pid;
170 int cpu, pc = 0; 170 int cpu, pc = 0;
171 171
172 if (unlikely(bt->trace_state != Blktrace_running || 172 if (unlikely(bt->trace_state != Blktrace_running &&
173 !blk_tracer_enabled)) 173 !blk_tracer_enabled))
174 return; 174 return;
175 175
@@ -185,7 +185,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
185 return; 185 return;
186 cpu = raw_smp_processor_id(); 186 cpu = raw_smp_processor_id();
187 187
188 if (blk_tr) { 188 if (blk_tracer_enabled) {
189 tracing_record_cmdline(current); 189 tracing_record_cmdline(current);
190 190
191 pc = preempt_count(); 191 pc = preempt_count();
@@ -235,7 +235,7 @@ record_it:
235 if (pdu_len) 235 if (pdu_len)
236 memcpy((void *) t + sizeof(*t), pdu_data, pdu_len); 236 memcpy((void *) t + sizeof(*t), pdu_data, pdu_len);
237 237
238 if (blk_tr) { 238 if (blk_tracer_enabled) {
239 trace_buffer_unlock_commit(blk_tr, event, 0, pc); 239 trace_buffer_unlock_commit(blk_tr, event, 0, pc);
240 return; 240 return;
241 } 241 }
@@ -267,8 +267,7 @@ int blk_trace_remove(struct request_queue *q)
267 if (!bt) 267 if (!bt)
268 return -EINVAL; 268 return -EINVAL;
269 269
270 if (bt->trace_state == Blktrace_setup || 270 if (bt->trace_state != Blktrace_running)
271 bt->trace_state == Blktrace_stopped)
272 blk_trace_cleanup(bt); 271 blk_trace_cleanup(bt);
273 272
274 return 0; 273 return 0;
@@ -1273,7 +1272,6 @@ static int blk_trace_setup_queue(struct request_queue *q, dev_t dev)
1273 bt->dev = dev; 1272 bt->dev = dev;
1274 bt->act_mask = (u16)-1; 1273 bt->act_mask = (u16)-1;
1275 bt->end_lba = -1ULL; 1274 bt->end_lba = -1ULL;
1276 bt->trace_state = Blktrace_running;
1277 1275
1278 old_bt = xchg(&q->blk_trace, bt); 1276 old_bt = xchg(&q->blk_trace, bt);
1279 if (old_bt != NULL) { 1277 if (old_bt != NULL) {