aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-04-14 02:00:05 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-16 04:10:59 -0400
commit1d54ad6da9192fed5dd3b60224d9f2dfea0dcd82 (patch)
treefd5917f144ec820b933795bedd7eddea96bee374 /block
parent9908c30997b8a73c95f836170b9998dae9aa3f4a (diff)
blktrace: add trace/ to /sys/block/sda
Impact: allow ftrace-plugin blktrace to trace device-mapper devices To trace a single partition: # echo 1 > /sys/block/sda/sda1/enable To trace the whole sda instead: # echo 1 > /sys/block/sda/enable Thus we also fix an issue reported by Ted, that ftrace-plugin blktrace can't be used to trace device-mapper devices. Now: # echo 1 > /sys/block/dm-0/trace/enable echo: write error: No such device or address # mount -t ext4 /dev/dm-0 /mnt # echo 1 > /sys/block/dm-0/trace/enable # echo blk > /debug/tracing/current_tracer Reported-by: Theodore Tso <tytso@mit.edu> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Shawn Du <duyuyang@gmail.com> Cc: Jens Axboe <jens.axboe@oracle.com> LKML-Reference: <49E42665.6020506@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'block')
-rw-r--r--block/blk-sysfs.c7
1 files changed, 6 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 = {
387int blk_register_queue(struct gendisk *disk) 387int 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;