aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blktrace.c40
-rw-r--r--fs/partitions/check.c5
-rw-r--r--include/linux/blktrace_api.h5
3 files changed, 31 insertions, 19 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),
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 01714efdc65a..8a17f7edcc74 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -19,6 +19,7 @@
19#include <linux/kmod.h> 19#include <linux/kmod.h>
20#include <linux/ctype.h> 20#include <linux/ctype.h>
21#include <linux/genhd.h> 21#include <linux/genhd.h>
22#include <linux/blktrace_api.h>
22 23
23#include "check.h" 24#include "check.h"
24 25
@@ -268,10 +269,6 @@ ssize_t part_fail_store(struct device *dev,
268} 269}
269#endif 270#endif
270 271
271#ifdef CONFIG_BLK_DEV_IO_TRACE
272extern struct attribute_group blk_trace_attr_group;
273#endif
274
275static DEVICE_ATTR(partition, S_IRUGO, part_partition_show, NULL); 272static DEVICE_ATTR(partition, S_IRUGO, part_partition_show, NULL);
276static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL); 273static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL);
277static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); 274static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL);
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 1dba3493d520..59b4b2e8ab67 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -142,6 +142,9 @@ struct blk_user_trace_setup {
142 142
143#ifdef __KERNEL__ 143#ifdef __KERNEL__
144#if defined(CONFIG_BLK_DEV_IO_TRACE) 144#if defined(CONFIG_BLK_DEV_IO_TRACE)
145
146#include <linux/sysfs.h>
147
145struct blk_trace { 148struct blk_trace {
146 int trace_state; 149 int trace_state;
147 struct rchan *rchan; 150 struct rchan *rchan;
@@ -192,6 +195,8 @@ extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
192extern int blk_trace_startstop(struct request_queue *q, int start); 195extern int blk_trace_startstop(struct request_queue *q, int start);
193extern int blk_trace_remove(struct request_queue *q); 196extern int blk_trace_remove(struct request_queue *q);
194 197
198extern struct attribute_group blk_trace_attr_group;
199
195#else /* !CONFIG_BLK_DEV_IO_TRACE */ 200#else /* !CONFIG_BLK_DEV_IO_TRACE */
196#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) 201#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
197#define blk_trace_shutdown(q) do { } while (0) 202#define blk_trace_shutdown(q) do { } while (0)