aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/blktrace_api.h
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 /include/linux/blktrace_api.h
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 'include/linux/blktrace_api.h')
-rw-r--r--include/linux/blktrace_api.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index d2e908586e3d..67b4d4dfc19c 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -28,10 +28,12 @@ struct blk_trace {
28 atomic_t dropped; 28 atomic_t dropped;
29}; 29};
30 30
31struct blkcg;
32
31extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); 33extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
32extern void blk_trace_shutdown(struct request_queue *); 34extern void blk_trace_shutdown(struct request_queue *);
33extern __printf(2, 3) 35extern __printf(3, 4)
34void __trace_note_message(struct blk_trace *, const char *fmt, ...); 36void __trace_note_message(struct blk_trace *, struct blkcg *blkcg, const char *fmt, ...);
35 37
36/** 38/**
37 * blk_add_trace_msg - Add a (simple) message to the blktrace stream 39 * blk_add_trace_msg - Add a (simple) message to the blktrace stream
@@ -46,12 +48,14 @@ void __trace_note_message(struct blk_trace *, const char *fmt, ...);
46 * NOTE: Can not use 'static inline' due to presence of var args... 48 * NOTE: Can not use 'static inline' due to presence of var args...
47 * 49 *
48 **/ 50 **/
49#define blk_add_trace_msg(q, fmt, ...) \ 51#define blk_add_cgroup_trace_msg(q, cg, fmt, ...) \
50 do { \ 52 do { \
51 struct blk_trace *bt = (q)->blk_trace; \ 53 struct blk_trace *bt = (q)->blk_trace; \
52 if (unlikely(bt)) \ 54 if (unlikely(bt)) \
53 __trace_note_message(bt, fmt, ##__VA_ARGS__); \ 55 __trace_note_message(bt, cg, fmt, ##__VA_ARGS__);\
54 } while (0) 56 } while (0)
57#define blk_add_trace_msg(q, fmt, ...) \
58 blk_add_cgroup_trace_msg(q, NULL, fmt, ##__VA_ARGS__)
55#define BLK_TN_MAX_MSG 128 59#define BLK_TN_MAX_MSG 128
56 60
57static inline bool blk_trace_note_message_enabled(struct request_queue *q) 61static inline bool blk_trace_note_message_enabled(struct request_queue *q)
@@ -82,6 +86,7 @@ extern struct attribute_group blk_trace_attr_group;
82# define blk_trace_startstop(q, start) (-ENOTTY) 86# define blk_trace_startstop(q, start) (-ENOTTY)
83# define blk_trace_remove(q) (-ENOTTY) 87# define blk_trace_remove(q) (-ENOTTY)
84# define blk_add_trace_msg(q, fmt, ...) do { } while (0) 88# define blk_add_trace_msg(q, fmt, ...) do { } while (0)
89# define blk_add_cgroup_trace_msg(q, cg, fmt, ...) do { } while (0)
85# define blk_trace_remove_sysfs(dev) do { } while (0) 90# define blk_trace_remove_sysfs(dev) do { } while (0)
86# define blk_trace_note_message_enabled(q) (false) 91# define blk_trace_note_message_enabled(q) (false)
87static inline int blk_trace_init_sysfs(struct device *dev) 92static inline int blk_trace_init_sysfs(struct device *dev)