aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-sysfs.c11
-rw-r--r--include/linux/blktrace_api.h2
-rw-r--r--kernel/trace/blktrace.c5
3 files changed, 13 insertions, 5 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index b78c9c3e2670..8a6d81afb284 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -452,6 +452,7 @@ int blk_register_queue(struct gendisk *disk)
452 if (ret) { 452 if (ret) {
453 kobject_uevent(&q->kobj, KOBJ_REMOVE); 453 kobject_uevent(&q->kobj, KOBJ_REMOVE);
454 kobject_del(&q->kobj); 454 kobject_del(&q->kobj);
455 blk_trace_remove_sysfs(disk_to_dev(disk));
455 return ret; 456 return ret;
456 } 457 }
457 458
@@ -465,11 +466,11 @@ void blk_unregister_queue(struct gendisk *disk)
465 if (WARN_ON(!q)) 466 if (WARN_ON(!q))
466 return; 467 return;
467 468
468 if (q->request_fn) { 469 if (q->request_fn)
469 elv_unregister_queue(q); 470 elv_unregister_queue(q);
470 471
471 kobject_uevent(&q->kobj, KOBJ_REMOVE); 472 kobject_uevent(&q->kobj, KOBJ_REMOVE);
472 kobject_del(&q->kobj); 473 kobject_del(&q->kobj);
473 kobject_put(&disk_to_dev(disk)->kobj); 474 blk_trace_remove_sysfs(disk_to_dev(disk));
474 } 475 kobject_put(&disk_to_dev(disk)->kobj);
475} 476}
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7e4350ece0f8..622939a23299 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);
199extern int blk_trace_startstop(struct request_queue *q, int start); 199extern int blk_trace_startstop(struct request_queue *q, int start);
200extern int blk_trace_remove(struct request_queue *q); 200extern int blk_trace_remove(struct request_queue *q);
201extern void blk_trace_remove_sysfs(struct device *dev);
201extern int blk_trace_init_sysfs(struct device *dev); 202extern int blk_trace_init_sysfs(struct device *dev);
202 203
203extern struct attribute_group blk_trace_attr_group; 204extern struct attribute_group blk_trace_attr_group;
@@ -211,6 +212,7 @@ extern struct attribute_group blk_trace_attr_group;
211# define blk_trace_startstop(q, start) (-ENOTTY) 212# define blk_trace_startstop(q, start) (-ENOTTY)
212# define blk_trace_remove(q) (-ENOTTY) 213# define blk_trace_remove(q) (-ENOTTY)
213# define blk_add_trace_msg(q, fmt, ...) do { } while (0) 214# define blk_add_trace_msg(q, fmt, ...) do { } while (0)
215# define blk_trace_remove_sysfs(struct device *dev) do { } while (0)
214static inline int blk_trace_init_sysfs(struct device *dev) 216static inline int blk_trace_init_sysfs(struct device *dev)
215{ 217{
216 return 0; 218 return 0;
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 3eb159c277c8..60b5c5a3d4b4 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1657,6 +1657,11 @@ int blk_trace_init_sysfs(struct device *dev)
1657 return sysfs_create_group(&dev->kobj, &blk_trace_attr_group); 1657 return sysfs_create_group(&dev->kobj, &blk_trace_attr_group);
1658} 1658}
1659 1659
1660void blk_trace_remove_sysfs(struct device *dev)
1661{
1662 sysfs_remove_group(&dev->kobj, &blk_trace_attr_group);
1663}
1664
1660#endif /* CONFIG_BLK_DEV_IO_TRACE */ 1665#endif /* CONFIG_BLK_DEV_IO_TRACE */
1661 1666
1662#ifdef CONFIG_EVENT_TRACING 1667#ifdef CONFIG_EVENT_TRACING