aboutsummaryrefslogtreecommitdiffstats
path: root/block/blktrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blktrace.c')
-rw-r--r--block/blktrace.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/block/blktrace.c b/block/blktrace.c
index 630f167f8240..1b2267c798b6 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -37,7 +37,7 @@ static int __read_mostly blk_tracer_enabled;
37 37
38static struct tracer_opt blk_tracer_opts[] = { 38static struct tracer_opt blk_tracer_opts[] = {
39 /* Default disable the minimalistic output */ 39 /* Default disable the minimalistic output */
40 { TRACER_OPT(blk_classic, TRACE_BLK_OPT_CLASSIC ) }, 40 { TRACER_OPT(blk_classic, TRACE_BLK_OPT_CLASSIC) },
41 { } 41 { }
42}; 42};
43 43
@@ -169,7 +169,8 @@ 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 || !blk_tracer_enabled)) 172 if (unlikely(bt->trace_state != Blktrace_running ||
173 !blk_tracer_enabled))
173 return; 174 return;
174 175
175 what |= ddir_act[rw & WRITE]; 176 what |= ddir_act[rw & WRITE];
@@ -192,7 +193,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
192 sizeof(*t) + pdu_len, &flags); 193 sizeof(*t) + pdu_len, &flags);
193 if (!event) 194 if (!event)
194 return; 195 return;
195 196
196 ent = ring_buffer_event_data(event); 197 ent = ring_buffer_event_data(event);
197 t = (struct blk_io_trace *)ent; 198 t = (struct blk_io_trace *)ent;
198 pc = preempt_count(); 199 pc = preempt_count();
@@ -234,7 +235,7 @@ record_it:
234 if (blk_tr) { 235 if (blk_tr) {
235 ring_buffer_unlock_commit(blk_tr->buffer, event, flags); 236 ring_buffer_unlock_commit(blk_tr->buffer, event, flags);
236 if (pid != 0 && 237 if (pid != 0 &&
237 (blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC) == 0 && 238 !(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC) &&
238 (trace_flags & TRACE_ITER_STACKTRACE) != 0) 239 (trace_flags & TRACE_ITER_STACKTRACE) != 0)
239 __trace_stack(blk_tr, NULL, flags, 5, pc); 240 __trace_stack(blk_tr, NULL, flags, 5, pc);
240 trace_wake_up(); 241 trace_wake_up();
@@ -955,19 +956,27 @@ static void blk_unregister_tracepoints(void)
955 956
956static void fill_rwbs(char *rwbs, const struct blk_io_trace *t) 957static void fill_rwbs(char *rwbs, const struct blk_io_trace *t)
957{ 958{
958 int i = 0; 959 int i = 0;
959 960
960 if (t->action & BLK_TC_DISCARD) rwbs[i++] = 'D'; 961 if (t->action & BLK_TC_DISCARD)
961 else if (t->action & BLK_TC_WRITE) rwbs[i++] = 'W'; 962 rwbs[i++] = 'D';
962 else if (t->bytes) rwbs[i++] = 'R'; 963 else if (t->action & BLK_TC_WRITE)
963 else rwbs[i++] = 'N'; 964 rwbs[i++] = 'W';
965 else if (t->bytes)
966 rwbs[i++] = 'R';
967 else
968 rwbs[i++] = 'N';
964 969
965 if (t->action & BLK_TC_AHEAD) rwbs[i++] = 'A'; 970 if (t->action & BLK_TC_AHEAD)
966 if (t->action & BLK_TC_BARRIER) rwbs[i++] = 'B'; 971 rwbs[i++] = 'A';
967 if (t->action & BLK_TC_SYNC) rwbs[i++] = 'S'; 972 if (t->action & BLK_TC_BARRIER)
968 if (t->action & BLK_TC_META) rwbs[i++] = 'M'; 973 rwbs[i++] = 'B';
974 if (t->action & BLK_TC_SYNC)
975 rwbs[i++] = 'S';
976 if (t->action & BLK_TC_META)
977 rwbs[i++] = 'M';
969 978
970 rwbs[i] = '\0'; 979 rwbs[i] = '\0';
971} 980}
972 981
973static inline 982static inline
@@ -1049,7 +1058,8 @@ static int blk_log_generic(struct trace_seq *s, const struct trace_entry *ent)
1049 return trace_seq_printf(s, "[%s]\n", cmd); 1058 return trace_seq_printf(s, "[%s]\n", cmd);
1050} 1059}
1051 1060
1052static int blk_log_with_error(struct trace_seq *s, const struct trace_entry *ent) 1061static int blk_log_with_error(struct trace_seq *s,
1062 const struct trace_entry *ent)
1053{ 1063{
1054 if (t_sec(ent)) 1064 if (t_sec(ent))
1055 return trace_seq_printf(s, "%llu + %u [%d]\n", t_sector(ent), 1065 return trace_seq_printf(s, "%llu + %u [%d]\n", t_sector(ent),