diff options
Diffstat (limited to 'kernel/trace/blktrace.c')
-rw-r--r-- | kernel/trace/blktrace.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 3eb159c277c8..d9d6206e0b14 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -856,6 +856,37 @@ static void blk_add_trace_remap(struct request_queue *q, struct bio *bio, | |||
856 | } | 856 | } |
857 | 857 | ||
858 | /** | 858 | /** |
859 | * blk_add_trace_rq_remap - Add a trace for a request-remap operation | ||
860 | * @q: queue the io is for | ||
861 | * @rq: the source request | ||
862 | * @dev: target device | ||
863 | * @from: source sector | ||
864 | * | ||
865 | * Description: | ||
866 | * Device mapper remaps request to other devices. | ||
867 | * Add a trace for that action. | ||
868 | * | ||
869 | **/ | ||
870 | static void blk_add_trace_rq_remap(struct request_queue *q, | ||
871 | struct request *rq, dev_t dev, | ||
872 | sector_t from) | ||
873 | { | ||
874 | struct blk_trace *bt = q->blk_trace; | ||
875 | struct blk_io_trace_remap r; | ||
876 | |||
877 | if (likely(!bt)) | ||
878 | return; | ||
879 | |||
880 | r.device_from = cpu_to_be32(dev); | ||
881 | r.device_to = cpu_to_be32(disk_devt(rq->rq_disk)); | ||
882 | r.sector_from = cpu_to_be64(from); | ||
883 | |||
884 | __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq), | ||
885 | rq_data_dir(rq), BLK_TA_REMAP, !!rq->errors, | ||
886 | sizeof(r), &r); | ||
887 | } | ||
888 | |||
889 | /** | ||
859 | * blk_add_driver_data - Add binary message with driver-specific data | 890 | * blk_add_driver_data - Add binary message with driver-specific data |
860 | * @q: queue the io is for | 891 | * @q: queue the io is for |
861 | * @rq: io request | 892 | * @rq: io request |
@@ -922,10 +953,13 @@ static void blk_register_tracepoints(void) | |||
922 | WARN_ON(ret); | 953 | WARN_ON(ret); |
923 | ret = register_trace_block_remap(blk_add_trace_remap); | 954 | ret = register_trace_block_remap(blk_add_trace_remap); |
924 | WARN_ON(ret); | 955 | WARN_ON(ret); |
956 | ret = register_trace_block_rq_remap(blk_add_trace_rq_remap); | ||
957 | WARN_ON(ret); | ||
925 | } | 958 | } |
926 | 959 | ||
927 | static void blk_unregister_tracepoints(void) | 960 | static void blk_unregister_tracepoints(void) |
928 | { | 961 | { |
962 | unregister_trace_block_rq_remap(blk_add_trace_rq_remap); | ||
929 | unregister_trace_block_remap(blk_add_trace_remap); | 963 | unregister_trace_block_remap(blk_add_trace_remap); |
930 | unregister_trace_block_split(blk_add_trace_split); | 964 | unregister_trace_block_split(blk_add_trace_split); |
931 | unregister_trace_block_unplug_io(blk_add_trace_unplug_io); | 965 | unregister_trace_block_unplug_io(blk_add_trace_unplug_io); |
@@ -1657,6 +1691,11 @@ int blk_trace_init_sysfs(struct device *dev) | |||
1657 | return sysfs_create_group(&dev->kobj, &blk_trace_attr_group); | 1691 | return sysfs_create_group(&dev->kobj, &blk_trace_attr_group); |
1658 | } | 1692 | } |
1659 | 1693 | ||
1694 | void blk_trace_remove_sysfs(struct device *dev) | ||
1695 | { | ||
1696 | sysfs_remove_group(&dev->kobj, &blk_trace_attr_group); | ||
1697 | } | ||
1698 | |||
1660 | #endif /* CONFIG_BLK_DEV_IO_TRACE */ | 1699 | #endif /* CONFIG_BLK_DEV_IO_TRACE */ |
1661 | 1700 | ||
1662 | #ifdef CONFIG_EVENT_TRACING | 1701 | #ifdef CONFIG_EVENT_TRACING |