diff options
-rw-r--r-- | block/bfq-iosched.h | 13 | ||||
-rw-r--r-- | block/blk-throttle.c | 6 | ||||
-rw-r--r-- | block/cfq-iosched.c | 15 | ||||
-rw-r--r-- | include/linux/blktrace_api.h | 13 | ||||
-rw-r--r-- | kernel/trace/blktrace.c | 12 |
5 files changed, 35 insertions, 24 deletions
diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index 63e771ab56d8..1f74d71b45cd 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h | |||
@@ -917,13 +917,16 @@ void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq); | |||
917 | struct bfq_group *bfqq_group(struct bfq_queue *bfqq); | 917 | struct bfq_group *bfqq_group(struct bfq_queue *bfqq); |
918 | 918 | ||
919 | #define bfq_log_bfqq(bfqd, bfqq, fmt, args...) do { \ | 919 | #define bfq_log_bfqq(bfqd, bfqq, fmt, args...) do { \ |
920 | blk_add_trace_msg((bfqd)->queue, "bfq%d%c %s " fmt, (bfqq)->pid,\ | 920 | blk_add_cgroup_trace_msg((bfqd)->queue, \ |
921 | bfq_bfqq_sync((bfqq)) ? 'S' : 'A', \ | 921 | bfqg_to_blkg(bfqq_group(bfqq))->blkcg, \ |
922 | bfqq_group(bfqq)->blkg_path, ##args); \ | 922 | "bfq%d%c " fmt, (bfqq)->pid, \ |
923 | bfq_bfqq_sync((bfqq)) ? 'S' : 'A', ##args); \ | ||
923 | } while (0) | 924 | } while (0) |
924 | 925 | ||
925 | #define bfq_log_bfqg(bfqd, bfqg, fmt, args...) \ | 926 | #define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do { \ |
926 | blk_add_trace_msg((bfqd)->queue, "%s " fmt, (bfqg)->blkg_path, ##args) | 927 | blk_add_cgroup_trace_msg((bfqd)->queue, \ |
928 | bfqg_to_blkg(bfqg)->blkcg, fmt, ##args); \ | ||
929 | } while (0) | ||
927 | 930 | ||
928 | #else /* CONFIG_BFQ_GROUP_IOSCHED */ | 931 | #else /* CONFIG_BFQ_GROUP_IOSCHED */ |
929 | 932 | ||
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index a6ebd2bdb4df..6a4c4c493dd5 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -373,10 +373,8 @@ static unsigned int tg_iops_limit(struct throtl_grp *tg, int rw) | |||
373 | if (likely(!blk_trace_note_message_enabled(__td->queue))) \ | 373 | if (likely(!blk_trace_note_message_enabled(__td->queue))) \ |
374 | break; \ | 374 | break; \ |
375 | if ((__tg)) { \ | 375 | if ((__tg)) { \ |
376 | char __pbuf[128]; \ | 376 | blk_add_cgroup_trace_msg(__td->queue, \ |
377 | \ | 377 | tg_to_blkg(__tg)->blkcg, "throtl " fmt, ##args);\ |
378 | blkg_path(tg_to_blkg(__tg), __pbuf, sizeof(__pbuf)); \ | ||
379 | blk_add_trace_msg(__td->queue, "throtl %s " fmt, __pbuf, ##args); \ | ||
380 | } else { \ | 378 | } else { \ |
381 | blk_add_trace_msg(__td->queue, "throtl " fmt, ##args); \ | 379 | blk_add_trace_msg(__td->queue, "throtl " fmt, ##args); \ |
382 | } \ | 380 | } \ |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 3d5c28945719..0fb78fb3c03c 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -656,20 +656,17 @@ static inline void cfqg_put(struct cfq_group *cfqg) | |||
656 | } | 656 | } |
657 | 657 | ||
658 | #define cfq_log_cfqq(cfqd, cfqq, fmt, args...) do { \ | 658 | #define cfq_log_cfqq(cfqd, cfqq, fmt, args...) do { \ |
659 | char __pbuf[128]; \ | 659 | blk_add_cgroup_trace_msg((cfqd)->queue, \ |
660 | \ | 660 | cfqg_to_blkg((cfqq)->cfqg)->blkcg, \ |
661 | blkg_path(cfqg_to_blkg((cfqq)->cfqg), __pbuf, sizeof(__pbuf)); \ | 661 | "cfq%d%c%c " fmt, (cfqq)->pid, \ |
662 | blk_add_trace_msg((cfqd)->queue, "cfq%d%c%c %s " fmt, (cfqq)->pid, \ | ||
663 | cfq_cfqq_sync((cfqq)) ? 'S' : 'A', \ | 662 | cfq_cfqq_sync((cfqq)) ? 'S' : 'A', \ |
664 | cfqq_type((cfqq)) == SYNC_NOIDLE_WORKLOAD ? 'N' : ' ',\ | 663 | cfqq_type((cfqq)) == SYNC_NOIDLE_WORKLOAD ? 'N' : ' ',\ |
665 | __pbuf, ##args); \ | 664 | ##args); \ |
666 | } while (0) | 665 | } while (0) |
667 | 666 | ||
668 | #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) do { \ | 667 | #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) do { \ |
669 | char __pbuf[128]; \ | 668 | blk_add_cgroup_trace_msg((cfqd)->queue, \ |
670 | \ | 669 | cfqg_to_blkg(cfqg)->blkcg, fmt, ##args); \ |
671 | blkg_path(cfqg_to_blkg(cfqg), __pbuf, sizeof(__pbuf)); \ | ||
672 | blk_add_trace_msg((cfqd)->queue, "%s " fmt, __pbuf, ##args); \ | ||
673 | } while (0) | 670 | } while (0) |
674 | 671 | ||
675 | static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg, | 672 | static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg, |
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 | ||
31 | struct blkcg; | ||
32 | |||
31 | extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); | 33 | extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); |
32 | extern void blk_trace_shutdown(struct request_queue *); | 34 | extern void blk_trace_shutdown(struct request_queue *); |
33 | extern __printf(2, 3) | 35 | extern __printf(3, 4) |
34 | void __trace_note_message(struct blk_trace *, const char *fmt, ...); | 36 | void __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 | ||
57 | static inline bool blk_trace_note_message_enabled(struct request_queue *q) | 61 | static 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) |
87 | static inline int blk_trace_init_sysfs(struct device *dev) | 92 | static inline int blk_trace_init_sysfs(struct device *dev) |
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 | ||
157 | void __trace_note_message(struct blk_trace *bt, const char *fmt, ...) | 157 | void __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 | } |
184 | EXPORT_SYMBOL_GPL(__trace_note_message); | 192 | EXPORT_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; |