diff options
-rw-r--r-- | block/blk-sysfs.c | 7 | ||||
-rw-r--r-- | include/linux/blktrace_api.h | 6 | ||||
-rw-r--r-- | kernel/trace/blktrace.c | 5 |
3 files changed, 17 insertions, 1 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 73f36beff5cd..8653d710b39e 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -387,16 +387,21 @@ struct kobj_type blk_queue_ktype = { | |||
387 | int blk_register_queue(struct gendisk *disk) | 387 | int blk_register_queue(struct gendisk *disk) |
388 | { | 388 | { |
389 | int ret; | 389 | int ret; |
390 | struct device *dev = disk_to_dev(disk); | ||
390 | 391 | ||
391 | struct request_queue *q = disk->queue; | 392 | struct request_queue *q = disk->queue; |
392 | 393 | ||
393 | if (WARN_ON(!q)) | 394 | if (WARN_ON(!q)) |
394 | return -ENXIO; | 395 | return -ENXIO; |
395 | 396 | ||
397 | ret = blk_trace_init_sysfs(dev); | ||
398 | if (ret) | ||
399 | return ret; | ||
400 | |||
396 | if (!q->request_fn) | 401 | if (!q->request_fn) |
397 | return 0; | 402 | return 0; |
398 | 403 | ||
399 | ret = kobject_add(&q->kobj, kobject_get(&disk_to_dev(disk)->kobj), | 404 | ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), |
400 | "%s", "queue"); | 405 | "%s", "queue"); |
401 | if (ret < 0) | 406 | if (ret < 0) |
402 | return ret; | 407 | return ret; |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 267edc4017ee..62763c952854 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -198,6 +198,7 @@ extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, | |||
198 | char __user *arg); | 198 | char __user *arg); |
199 | extern int blk_trace_startstop(struct request_queue *q, int start); | 199 | extern int blk_trace_startstop(struct request_queue *q, int start); |
200 | extern int blk_trace_remove(struct request_queue *q); | 200 | extern int blk_trace_remove(struct request_queue *q); |
201 | extern int blk_trace_init_sysfs(struct device *dev); | ||
201 | 202 | ||
202 | extern struct attribute_group blk_trace_attr_group; | 203 | extern struct attribute_group blk_trace_attr_group; |
203 | 204 | ||
@@ -210,6 +211,11 @@ extern struct attribute_group blk_trace_attr_group; | |||
210 | # define blk_trace_startstop(q, start) (-ENOTTY) | 211 | # define blk_trace_startstop(q, start) (-ENOTTY) |
211 | # define blk_trace_remove(q) (-ENOTTY) | 212 | # define blk_trace_remove(q) (-ENOTTY) |
212 | # define blk_add_trace_msg(q, fmt, ...) do { } while (0) | 213 | # define blk_add_trace_msg(q, fmt, ...) do { } while (0) |
214 | static inline int blk_trace_init_sysfs(struct device *dev) | ||
215 | { | ||
216 | return 0; | ||
217 | } | ||
218 | |||
213 | #endif /* CONFIG_BLK_DEV_IO_TRACE */ | 219 | #endif /* CONFIG_BLK_DEV_IO_TRACE */ |
214 | 220 | ||
215 | #endif /* __KERNEL__ */ | 221 | #endif /* __KERNEL__ */ |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index d10989880520..8e7c5da3a3e6 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -1644,3 +1644,8 @@ out: | |||
1644 | return ret ? ret : count; | 1644 | return ret ? ret : count; |
1645 | } | 1645 | } |
1646 | 1646 | ||
1647 | int blk_trace_init_sysfs(struct device *dev) | ||
1648 | { | ||
1649 | return sysfs_create_group(&dev->kobj, &blk_trace_attr_group); | ||
1650 | } | ||
1651 | |||