diff options
Diffstat (limited to 'kernel/trace/blktrace.c')
-rw-r--r-- | kernel/trace/blktrace.c | 138 |
1 files changed, 79 insertions, 59 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index b3bc91a3f510..36ea2b65dcdc 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -675,28 +675,33 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq, | |||
675 | } | 675 | } |
676 | } | 676 | } |
677 | 677 | ||
678 | static void blk_add_trace_rq_abort(struct request_queue *q, struct request *rq) | 678 | static void blk_add_trace_rq_abort(void *ignore, |
679 | struct request_queue *q, struct request *rq) | ||
679 | { | 680 | { |
680 | blk_add_trace_rq(q, rq, BLK_TA_ABORT); | 681 | blk_add_trace_rq(q, rq, BLK_TA_ABORT); |
681 | } | 682 | } |
682 | 683 | ||
683 | static void blk_add_trace_rq_insert(struct request_queue *q, struct request *rq) | 684 | static void blk_add_trace_rq_insert(void *ignore, |
685 | struct request_queue *q, struct request *rq) | ||
684 | { | 686 | { |
685 | blk_add_trace_rq(q, rq, BLK_TA_INSERT); | 687 | blk_add_trace_rq(q, rq, BLK_TA_INSERT); |
686 | } | 688 | } |
687 | 689 | ||
688 | static void blk_add_trace_rq_issue(struct request_queue *q, struct request *rq) | 690 | static void blk_add_trace_rq_issue(void *ignore, |
691 | struct request_queue *q, struct request *rq) | ||
689 | { | 692 | { |
690 | blk_add_trace_rq(q, rq, BLK_TA_ISSUE); | 693 | blk_add_trace_rq(q, rq, BLK_TA_ISSUE); |
691 | } | 694 | } |
692 | 695 | ||
693 | static void blk_add_trace_rq_requeue(struct request_queue *q, | 696 | static void blk_add_trace_rq_requeue(void *ignore, |
697 | struct request_queue *q, | ||
694 | struct request *rq) | 698 | struct request *rq) |
695 | { | 699 | { |
696 | blk_add_trace_rq(q, rq, BLK_TA_REQUEUE); | 700 | blk_add_trace_rq(q, rq, BLK_TA_REQUEUE); |
697 | } | 701 | } |
698 | 702 | ||
699 | static void blk_add_trace_rq_complete(struct request_queue *q, | 703 | static void blk_add_trace_rq_complete(void *ignore, |
704 | struct request_queue *q, | ||
700 | struct request *rq) | 705 | struct request *rq) |
701 | { | 706 | { |
702 | blk_add_trace_rq(q, rq, BLK_TA_COMPLETE); | 707 | blk_add_trace_rq(q, rq, BLK_TA_COMPLETE); |
@@ -724,34 +729,40 @@ static void blk_add_trace_bio(struct request_queue *q, struct bio *bio, | |||
724 | !bio_flagged(bio, BIO_UPTODATE), 0, NULL); | 729 | !bio_flagged(bio, BIO_UPTODATE), 0, NULL); |
725 | } | 730 | } |
726 | 731 | ||
727 | static void blk_add_trace_bio_bounce(struct request_queue *q, struct bio *bio) | 732 | static void blk_add_trace_bio_bounce(void *ignore, |
733 | struct request_queue *q, struct bio *bio) | ||
728 | { | 734 | { |
729 | blk_add_trace_bio(q, bio, BLK_TA_BOUNCE); | 735 | blk_add_trace_bio(q, bio, BLK_TA_BOUNCE); |
730 | } | 736 | } |
731 | 737 | ||
732 | static void blk_add_trace_bio_complete(struct request_queue *q, struct bio *bio) | 738 | static void blk_add_trace_bio_complete(void *ignore, |
739 | struct request_queue *q, struct bio *bio) | ||
733 | { | 740 | { |
734 | blk_add_trace_bio(q, bio, BLK_TA_COMPLETE); | 741 | blk_add_trace_bio(q, bio, BLK_TA_COMPLETE); |
735 | } | 742 | } |
736 | 743 | ||
737 | static void blk_add_trace_bio_backmerge(struct request_queue *q, | 744 | static void blk_add_trace_bio_backmerge(void *ignore, |
745 | struct request_queue *q, | ||
738 | struct bio *bio) | 746 | struct bio *bio) |
739 | { | 747 | { |
740 | blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE); | 748 | blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE); |
741 | } | 749 | } |
742 | 750 | ||
743 | static void blk_add_trace_bio_frontmerge(struct request_queue *q, | 751 | static void blk_add_trace_bio_frontmerge(void *ignore, |
752 | struct request_queue *q, | ||
744 | struct bio *bio) | 753 | struct bio *bio) |
745 | { | 754 | { |
746 | blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE); | 755 | blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE); |
747 | } | 756 | } |
748 | 757 | ||
749 | static void blk_add_trace_bio_queue(struct request_queue *q, struct bio *bio) | 758 | static void blk_add_trace_bio_queue(void *ignore, |
759 | struct request_queue *q, struct bio *bio) | ||
750 | { | 760 | { |
751 | blk_add_trace_bio(q, bio, BLK_TA_QUEUE); | 761 | blk_add_trace_bio(q, bio, BLK_TA_QUEUE); |
752 | } | 762 | } |
753 | 763 | ||
754 | static void blk_add_trace_getrq(struct request_queue *q, | 764 | static void blk_add_trace_getrq(void *ignore, |
765 | struct request_queue *q, | ||
755 | struct bio *bio, int rw) | 766 | struct bio *bio, int rw) |
756 | { | 767 | { |
757 | if (bio) | 768 | if (bio) |
@@ -765,7 +776,8 @@ static void blk_add_trace_getrq(struct request_queue *q, | |||
765 | } | 776 | } |
766 | 777 | ||
767 | 778 | ||
768 | static void blk_add_trace_sleeprq(struct request_queue *q, | 779 | static void blk_add_trace_sleeprq(void *ignore, |
780 | struct request_queue *q, | ||
769 | struct bio *bio, int rw) | 781 | struct bio *bio, int rw) |
770 | { | 782 | { |
771 | if (bio) | 783 | if (bio) |
@@ -779,7 +791,7 @@ static void blk_add_trace_sleeprq(struct request_queue *q, | |||
779 | } | 791 | } |
780 | } | 792 | } |
781 | 793 | ||
782 | static void blk_add_trace_plug(struct request_queue *q) | 794 | static void blk_add_trace_plug(void *ignore, struct request_queue *q) |
783 | { | 795 | { |
784 | struct blk_trace *bt = q->blk_trace; | 796 | struct blk_trace *bt = q->blk_trace; |
785 | 797 | ||
@@ -787,7 +799,7 @@ static void blk_add_trace_plug(struct request_queue *q) | |||
787 | __blk_add_trace(bt, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL); | 799 | __blk_add_trace(bt, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL); |
788 | } | 800 | } |
789 | 801 | ||
790 | static void blk_add_trace_unplug_io(struct request_queue *q) | 802 | static void blk_add_trace_unplug_io(void *ignore, struct request_queue *q) |
791 | { | 803 | { |
792 | struct blk_trace *bt = q->blk_trace; | 804 | struct blk_trace *bt = q->blk_trace; |
793 | 805 | ||
@@ -800,7 +812,7 @@ static void blk_add_trace_unplug_io(struct request_queue *q) | |||
800 | } | 812 | } |
801 | } | 813 | } |
802 | 814 | ||
803 | static void blk_add_trace_unplug_timer(struct request_queue *q) | 815 | static void blk_add_trace_unplug_timer(void *ignore, struct request_queue *q) |
804 | { | 816 | { |
805 | struct blk_trace *bt = q->blk_trace; | 817 | struct blk_trace *bt = q->blk_trace; |
806 | 818 | ||
@@ -813,7 +825,8 @@ static void blk_add_trace_unplug_timer(struct request_queue *q) | |||
813 | } | 825 | } |
814 | } | 826 | } |
815 | 827 | ||
816 | static void blk_add_trace_split(struct request_queue *q, struct bio *bio, | 828 | static void blk_add_trace_split(void *ignore, |
829 | struct request_queue *q, struct bio *bio, | ||
817 | unsigned int pdu) | 830 | unsigned int pdu) |
818 | { | 831 | { |
819 | struct blk_trace *bt = q->blk_trace; | 832 | struct blk_trace *bt = q->blk_trace; |
@@ -839,8 +852,9 @@ static void blk_add_trace_split(struct request_queue *q, struct bio *bio, | |||
839 | * it spans a stripe (or similar). Add a trace for that action. | 852 | * it spans a stripe (or similar). Add a trace for that action. |
840 | * | 853 | * |
841 | **/ | 854 | **/ |
842 | static void blk_add_trace_remap(struct request_queue *q, struct bio *bio, | 855 | static void blk_add_trace_remap(void *ignore, |
843 | dev_t dev, sector_t from) | 856 | struct request_queue *q, struct bio *bio, |
857 | dev_t dev, sector_t from) | ||
844 | { | 858 | { |
845 | struct blk_trace *bt = q->blk_trace; | 859 | struct blk_trace *bt = q->blk_trace; |
846 | struct blk_io_trace_remap r; | 860 | struct blk_io_trace_remap r; |
@@ -869,7 +883,8 @@ static void blk_add_trace_remap(struct request_queue *q, struct bio *bio, | |||
869 | * Add a trace for that action. | 883 | * Add a trace for that action. |
870 | * | 884 | * |
871 | **/ | 885 | **/ |
872 | static void blk_add_trace_rq_remap(struct request_queue *q, | 886 | static void blk_add_trace_rq_remap(void *ignore, |
887 | struct request_queue *q, | ||
873 | struct request *rq, dev_t dev, | 888 | struct request *rq, dev_t dev, |
874 | sector_t from) | 889 | sector_t from) |
875 | { | 890 | { |
@@ -921,64 +936,64 @@ static void blk_register_tracepoints(void) | |||
921 | { | 936 | { |
922 | int ret; | 937 | int ret; |
923 | 938 | ||
924 | ret = register_trace_block_rq_abort(blk_add_trace_rq_abort); | 939 | ret = register_trace_block_rq_abort(blk_add_trace_rq_abort, NULL); |
925 | WARN_ON(ret); | 940 | WARN_ON(ret); |
926 | ret = register_trace_block_rq_insert(blk_add_trace_rq_insert); | 941 | ret = register_trace_block_rq_insert(blk_add_trace_rq_insert, NULL); |
927 | WARN_ON(ret); | 942 | WARN_ON(ret); |
928 | ret = register_trace_block_rq_issue(blk_add_trace_rq_issue); | 943 | ret = register_trace_block_rq_issue(blk_add_trace_rq_issue, NULL); |
929 | WARN_ON(ret); | 944 | WARN_ON(ret); |
930 | ret = register_trace_block_rq_requeue(blk_add_trace_rq_requeue); | 945 | ret = register_trace_block_rq_requeue(blk_add_trace_rq_requeue, NULL); |
931 | WARN_ON(ret); | 946 | WARN_ON(ret); |
932 | ret = register_trace_block_rq_complete(blk_add_trace_rq_complete); | 947 | ret = register_trace_block_rq_complete(blk_add_trace_rq_complete, NULL); |
933 | WARN_ON(ret); | 948 | WARN_ON(ret); |
934 | ret = register_trace_block_bio_bounce(blk_add_trace_bio_bounce); | 949 | ret = register_trace_block_bio_bounce(blk_add_trace_bio_bounce, NULL); |
935 | WARN_ON(ret); | 950 | WARN_ON(ret); |
936 | ret = register_trace_block_bio_complete(blk_add_trace_bio_complete); | 951 | ret = register_trace_block_bio_complete(blk_add_trace_bio_complete, NULL); |
937 | WARN_ON(ret); | 952 | WARN_ON(ret); |
938 | ret = register_trace_block_bio_backmerge(blk_add_trace_bio_backmerge); | 953 | ret = register_trace_block_bio_backmerge(blk_add_trace_bio_backmerge, NULL); |
939 | WARN_ON(ret); | 954 | WARN_ON(ret); |
940 | ret = register_trace_block_bio_frontmerge(blk_add_trace_bio_frontmerge); | 955 | ret = register_trace_block_bio_frontmerge(blk_add_trace_bio_frontmerge, NULL); |
941 | WARN_ON(ret); | 956 | WARN_ON(ret); |
942 | ret = register_trace_block_bio_queue(blk_add_trace_bio_queue); | 957 | ret = register_trace_block_bio_queue(blk_add_trace_bio_queue, NULL); |
943 | WARN_ON(ret); | 958 | WARN_ON(ret); |
944 | ret = register_trace_block_getrq(blk_add_trace_getrq); | 959 | ret = register_trace_block_getrq(blk_add_trace_getrq, NULL); |
945 | WARN_ON(ret); | 960 | WARN_ON(ret); |
946 | ret = register_trace_block_sleeprq(blk_add_trace_sleeprq); | 961 | ret = register_trace_block_sleeprq(blk_add_trace_sleeprq, NULL); |
947 | WARN_ON(ret); | 962 | WARN_ON(ret); |
948 | ret = register_trace_block_plug(blk_add_trace_plug); | 963 | ret = register_trace_block_plug(blk_add_trace_plug, NULL); |
949 | WARN_ON(ret); | 964 | WARN_ON(ret); |
950 | ret = register_trace_block_unplug_timer(blk_add_trace_unplug_timer); | 965 | ret = register_trace_block_unplug_timer(blk_add_trace_unplug_timer, NULL); |
951 | WARN_ON(ret); | 966 | WARN_ON(ret); |
952 | ret = register_trace_block_unplug_io(blk_add_trace_unplug_io); | 967 | ret = register_trace_block_unplug_io(blk_add_trace_unplug_io, NULL); |
953 | WARN_ON(ret); | 968 | WARN_ON(ret); |
954 | ret = register_trace_block_split(blk_add_trace_split); | 969 | ret = register_trace_block_split(blk_add_trace_split, NULL); |
955 | WARN_ON(ret); | 970 | WARN_ON(ret); |
956 | ret = register_trace_block_remap(blk_add_trace_remap); | 971 | ret = register_trace_block_remap(blk_add_trace_remap, NULL); |
957 | WARN_ON(ret); | 972 | WARN_ON(ret); |
958 | ret = register_trace_block_rq_remap(blk_add_trace_rq_remap); | 973 | ret = register_trace_block_rq_remap(blk_add_trace_rq_remap, NULL); |
959 | WARN_ON(ret); | 974 | WARN_ON(ret); |
960 | } | 975 | } |
961 | 976 | ||
962 | static void blk_unregister_tracepoints(void) | 977 | static void blk_unregister_tracepoints(void) |
963 | { | 978 | { |
964 | unregister_trace_block_rq_remap(blk_add_trace_rq_remap); | 979 | unregister_trace_block_rq_remap(blk_add_trace_rq_remap, NULL); |
965 | unregister_trace_block_remap(blk_add_trace_remap); | 980 | unregister_trace_block_remap(blk_add_trace_remap, NULL); |
966 | unregister_trace_block_split(blk_add_trace_split); | 981 | unregister_trace_block_split(blk_add_trace_split, NULL); |
967 | unregister_trace_block_unplug_io(blk_add_trace_unplug_io); | 982 | unregister_trace_block_unplug_io(blk_add_trace_unplug_io, NULL); |
968 | unregister_trace_block_unplug_timer(blk_add_trace_unplug_timer); | 983 | unregister_trace_block_unplug_timer(blk_add_trace_unplug_timer, NULL); |
969 | unregister_trace_block_plug(blk_add_trace_plug); | 984 | unregister_trace_block_plug(blk_add_trace_plug, NULL); |
970 | unregister_trace_block_sleeprq(blk_add_trace_sleeprq); | 985 | unregister_trace_block_sleeprq(blk_add_trace_sleeprq, NULL); |
971 | unregister_trace_block_getrq(blk_add_trace_getrq); | 986 | unregister_trace_block_getrq(blk_add_trace_getrq, NULL); |
972 | unregister_trace_block_bio_queue(blk_add_trace_bio_queue); | 987 | unregister_trace_block_bio_queue(blk_add_trace_bio_queue, NULL); |
973 | unregister_trace_block_bio_frontmerge(blk_add_trace_bio_frontmerge); | 988 | unregister_trace_block_bio_frontmerge(blk_add_trace_bio_frontmerge, NULL); |
974 | unregister_trace_block_bio_backmerge(blk_add_trace_bio_backmerge); | 989 | unregister_trace_block_bio_backmerge(blk_add_trace_bio_backmerge, NULL); |
975 | unregister_trace_block_bio_complete(blk_add_trace_bio_complete); | 990 | unregister_trace_block_bio_complete(blk_add_trace_bio_complete, NULL); |
976 | unregister_trace_block_bio_bounce(blk_add_trace_bio_bounce); | 991 | unregister_trace_block_bio_bounce(blk_add_trace_bio_bounce, NULL); |
977 | unregister_trace_block_rq_complete(blk_add_trace_rq_complete); | 992 | unregister_trace_block_rq_complete(blk_add_trace_rq_complete, NULL); |
978 | unregister_trace_block_rq_requeue(blk_add_trace_rq_requeue); | 993 | unregister_trace_block_rq_requeue(blk_add_trace_rq_requeue, NULL); |
979 | unregister_trace_block_rq_issue(blk_add_trace_rq_issue); | 994 | unregister_trace_block_rq_issue(blk_add_trace_rq_issue, NULL); |
980 | unregister_trace_block_rq_insert(blk_add_trace_rq_insert); | 995 | unregister_trace_block_rq_insert(blk_add_trace_rq_insert, NULL); |
981 | unregister_trace_block_rq_abort(blk_add_trace_rq_abort); | 996 | unregister_trace_block_rq_abort(blk_add_trace_rq_abort, NULL); |
982 | 997 | ||
983 | tracepoint_synchronize_unregister(); | 998 | tracepoint_synchronize_unregister(); |
984 | } | 999 | } |
@@ -1321,7 +1336,7 @@ out: | |||
1321 | } | 1336 | } |
1322 | 1337 | ||
1323 | static enum print_line_t blk_trace_event_print(struct trace_iterator *iter, | 1338 | static enum print_line_t blk_trace_event_print(struct trace_iterator *iter, |
1324 | int flags) | 1339 | int flags, struct trace_event *event) |
1325 | { | 1340 | { |
1326 | return print_one_line(iter, false); | 1341 | return print_one_line(iter, false); |
1327 | } | 1342 | } |
@@ -1343,7 +1358,8 @@ static int blk_trace_synthesize_old_trace(struct trace_iterator *iter) | |||
1343 | } | 1358 | } |
1344 | 1359 | ||
1345 | static enum print_line_t | 1360 | static enum print_line_t |
1346 | blk_trace_event_print_binary(struct trace_iterator *iter, int flags) | 1361 | blk_trace_event_print_binary(struct trace_iterator *iter, int flags, |
1362 | struct trace_event *event) | ||
1347 | { | 1363 | { |
1348 | return blk_trace_synthesize_old_trace(iter) ? | 1364 | return blk_trace_synthesize_old_trace(iter) ? |
1349 | TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; | 1365 | TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; |
@@ -1381,12 +1397,16 @@ static struct tracer blk_tracer __read_mostly = { | |||
1381 | .set_flag = blk_tracer_set_flag, | 1397 | .set_flag = blk_tracer_set_flag, |
1382 | }; | 1398 | }; |
1383 | 1399 | ||
1384 | static struct trace_event trace_blk_event = { | 1400 | static struct trace_event_functions trace_blk_event_funcs = { |
1385 | .type = TRACE_BLK, | ||
1386 | .trace = blk_trace_event_print, | 1401 | .trace = blk_trace_event_print, |
1387 | .binary = blk_trace_event_print_binary, | 1402 | .binary = blk_trace_event_print_binary, |
1388 | }; | 1403 | }; |
1389 | 1404 | ||
1405 | static struct trace_event trace_blk_event = { | ||
1406 | .type = TRACE_BLK, | ||
1407 | .funcs = &trace_blk_event_funcs, | ||
1408 | }; | ||
1409 | |||
1390 | static int __init init_blk_tracer(void) | 1410 | static int __init init_blk_tracer(void) |
1391 | { | 1411 | { |
1392 | if (!register_ftrace_event(&trace_blk_event)) { | 1412 | if (!register_ftrace_event(&trace_blk_event)) { |