aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2017-07-12 14:49:56 -0400
committerJens Axboe <axboe@kernel.dk>2017-07-29 11:00:03 -0400
commit35fe6d763229e8fc0eb5f9b93a401673cfcb5e1e (patch)
treeea38b526a62121671ef7bfff76f7d23e29804b42 /kernel/trace
parent69fd5c391763bd94a40dd152bc72a7f230137150 (diff)
block: use standard blktrace API to output cgroup info for debug notes
Currently cfq/bfq/blk-throttle output cgroup info in trace in their own way. Now we have standard blktrace API for this, so convert them to use it. Note, this changes the behavior a little bit. cgroup info isn't output by default, we only do this with 'blk_cgroup' option enabled. cgroup info isn't output as a string by default too, we only do this with 'blk_cgname' option enabled. Also cgroup info is output in different position of the note string. I think these behavior changes aren't a big issue (actually we make trace data shorter which is good), since the blktrace note is solely for debugging. Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/blktrace.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index e90974ed4532..7724de18d2fe 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -154,7 +154,8 @@ static void trace_note_time(struct blk_trace *bt)
154 local_irq_restore(flags); 154 local_irq_restore(flags);
155} 155}
156 156
157void __trace_note_message(struct blk_trace *bt, const char *fmt, ...) 157void __trace_note_message(struct blk_trace *bt, struct blkcg *blkcg,
158 const char *fmt, ...)
158{ 159{
159 int n; 160 int n;
160 va_list args; 161 va_list args;
@@ -178,7 +179,14 @@ void __trace_note_message(struct blk_trace *bt, const char *fmt, ...)
178 n = vscnprintf(buf, BLK_TN_MAX_MSG, fmt, args); 179 n = vscnprintf(buf, BLK_TN_MAX_MSG, fmt, args);
179 va_end(args); 180 va_end(args);
180 181
182 if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CGROUP))
183 blkcg = NULL;
184#ifdef CONFIG_BLK_CGROUP
185 trace_note(bt, 0, BLK_TN_MESSAGE, buf, n,
186 blkcg ? cgroup_get_kernfs_id(blkcg->css.cgroup) : NULL);
187#else
181 trace_note(bt, 0, BLK_TN_MESSAGE, buf, n, NULL); 188 trace_note(bt, 0, BLK_TN_MESSAGE, buf, n, NULL);
189#endif
182 local_irq_restore(flags); 190 local_irq_restore(flags);
183} 191}
184EXPORT_SYMBOL_GPL(__trace_note_message); 192EXPORT_SYMBOL_GPL(__trace_note_message);
@@ -375,7 +383,7 @@ static ssize_t blk_msg_write(struct file *filp, const char __user *buffer,
375 return PTR_ERR(msg); 383 return PTR_ERR(msg);
376 384
377 bt = filp->private_data; 385 bt = filp->private_data;
378 __trace_note_message(bt, "%s", msg); 386 __trace_note_message(bt, NULL, "%s", msg);
379 kfree(msg); 387 kfree(msg);
380 388
381 return count; 389 return count;