aboutsummaryrefslogtreecommitdiffstats
path: root/block/blktrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blktrace.c')
-rw-r--r--block/blktrace.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/block/blktrace.c b/block/blktrace.c
index b2cbb4e5d767..7ae87cc4a163 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -75,6 +75,23 @@ static void trace_note_time(struct blk_trace *bt)
75 local_irq_restore(flags); 75 local_irq_restore(flags);
76} 76}
77 77
78void __trace_note_message(struct blk_trace *bt, const char *fmt, ...)
79{
80 int n;
81 va_list args;
82 char *buf;
83
84 preempt_disable();
85 buf = per_cpu_ptr(bt->msg_data, smp_processor_id());
86 va_start(args, fmt);
87 n = vscnprintf(buf, BLK_TN_MAX_MSG, fmt, args);
88 va_end(args);
89
90 trace_note(bt, 0, BLK_TN_MESSAGE, buf, n);
91 preempt_enable();
92}
93EXPORT_SYMBOL_GPL(__trace_note_message);
94
78static int act_log_check(struct blk_trace *bt, u32 what, sector_t sector, 95static int act_log_check(struct blk_trace *bt, u32 what, sector_t sector,
79 pid_t pid) 96 pid_t pid)
80{ 97{
@@ -232,6 +249,7 @@ static void blk_trace_cleanup(struct blk_trace *bt)
232 debugfs_remove(bt->dropped_file); 249 debugfs_remove(bt->dropped_file);
233 blk_remove_tree(bt->dir); 250 blk_remove_tree(bt->dir);
234 free_percpu(bt->sequence); 251 free_percpu(bt->sequence);
252 free_percpu(bt->msg_data);
235 kfree(bt); 253 kfree(bt);
236} 254}
237 255
@@ -346,6 +364,10 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
346 if (!bt->sequence) 364 if (!bt->sequence)
347 goto err; 365 goto err;
348 366
367 bt->msg_data = __alloc_percpu(BLK_TN_MAX_MSG);
368 if (!bt->msg_data)
369 goto err;
370
349 ret = -ENOENT; 371 ret = -ENOENT;
350 dir = blk_create_tree(buts->name); 372 dir = blk_create_tree(buts->name);
351 if (!dir) 373 if (!dir)
@@ -392,6 +414,7 @@ err:
392 if (bt->dropped_file) 414 if (bt->dropped_file)
393 debugfs_remove(bt->dropped_file); 415 debugfs_remove(bt->dropped_file);
394 free_percpu(bt->sequence); 416 free_percpu(bt->sequence);
417 free_percpu(bt->msg_data);
395 if (bt->rchan) 418 if (bt->rchan)
396 relay_close(bt->rchan); 419 relay_close(bt->rchan);
397 kfree(bt); 420 kfree(bt);