diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2011-01-10 03:06:44 -0500 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-01-10 03:06:44 -0500 |
commit | 797a455d2c682476c3797dbfecf5bf84c1e3b9d3 (patch) | |
tree | 3e5c4af8661e67841610820c40163093c739bb86 /kernel | |
parent | 23036f1a340beec19cc451ba9719526c4ffb3a57 (diff) |
block: ensure that completion error gets properly traced
We normally just use the BIO_UPTODATE flag to signal 0/-EIO. If
we have more information available, we should pass that along to
the trace output.
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/blktrace.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index fab31aff9d97..153562d0b93c 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -758,54 +758,58 @@ static void blk_add_trace_rq_complete(void *ignore, | |||
758 | * @q: queue the io is for | 758 | * @q: queue the io is for |
759 | * @bio: the source bio | 759 | * @bio: the source bio |
760 | * @what: the action | 760 | * @what: the action |
761 | * @error: error, if any | ||
761 | * | 762 | * |
762 | * Description: | 763 | * Description: |
763 | * Records an action against a bio. Will log the bio offset + size. | 764 | * Records an action against a bio. Will log the bio offset + size. |
764 | * | 765 | * |
765 | **/ | 766 | **/ |
766 | static void blk_add_trace_bio(struct request_queue *q, struct bio *bio, | 767 | static void blk_add_trace_bio(struct request_queue *q, struct bio *bio, |
767 | u32 what) | 768 | u32 what, int error) |
768 | { | 769 | { |
769 | struct blk_trace *bt = q->blk_trace; | 770 | struct blk_trace *bt = q->blk_trace; |
770 | 771 | ||
771 | if (likely(!bt)) | 772 | if (likely(!bt)) |
772 | return; | 773 | return; |
773 | 774 | ||
775 | if (!error && !bio_flagged(bio, BIO_UPTODATE)) | ||
776 | error = EIO; | ||
777 | |||
774 | __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, | 778 | __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, |
775 | !bio_flagged(bio, BIO_UPTODATE), 0, NULL); | 779 | error, 0, NULL); |
776 | } | 780 | } |
777 | 781 | ||
778 | static void blk_add_trace_bio_bounce(void *ignore, | 782 | static void blk_add_trace_bio_bounce(void *ignore, |
779 | struct request_queue *q, struct bio *bio) | 783 | struct request_queue *q, struct bio *bio) |
780 | { | 784 | { |
781 | blk_add_trace_bio(q, bio, BLK_TA_BOUNCE); | 785 | blk_add_trace_bio(q, bio, BLK_TA_BOUNCE, 0); |
782 | } | 786 | } |
783 | 787 | ||
784 | static void blk_add_trace_bio_complete(void *ignore, | 788 | static void blk_add_trace_bio_complete(void *ignore, |
785 | struct request_queue *q, struct bio *bio, | 789 | struct request_queue *q, struct bio *bio, |
786 | int error) | 790 | int error) |
787 | { | 791 | { |
788 | blk_add_trace_bio(q, bio, BLK_TA_COMPLETE); | 792 | blk_add_trace_bio(q, bio, BLK_TA_COMPLETE, error); |
789 | } | 793 | } |
790 | 794 | ||
791 | static void blk_add_trace_bio_backmerge(void *ignore, | 795 | static void blk_add_trace_bio_backmerge(void *ignore, |
792 | struct request_queue *q, | 796 | struct request_queue *q, |
793 | struct bio *bio) | 797 | struct bio *bio) |
794 | { | 798 | { |
795 | blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE); | 799 | blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE, 0); |
796 | } | 800 | } |
797 | 801 | ||
798 | static void blk_add_trace_bio_frontmerge(void *ignore, | 802 | static void blk_add_trace_bio_frontmerge(void *ignore, |
799 | struct request_queue *q, | 803 | struct request_queue *q, |
800 | struct bio *bio) | 804 | struct bio *bio) |
801 | { | 805 | { |
802 | blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE); | 806 | blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE, 0); |
803 | } | 807 | } |
804 | 808 | ||
805 | static void blk_add_trace_bio_queue(void *ignore, | 809 | static void blk_add_trace_bio_queue(void *ignore, |
806 | struct request_queue *q, struct bio *bio) | 810 | struct request_queue *q, struct bio *bio) |
807 | { | 811 | { |
808 | blk_add_trace_bio(q, bio, BLK_TA_QUEUE); | 812 | blk_add_trace_bio(q, bio, BLK_TA_QUEUE, 0); |
809 | } | 813 | } |
810 | 814 | ||
811 | static void blk_add_trace_getrq(void *ignore, | 815 | static void blk_add_trace_getrq(void *ignore, |
@@ -813,7 +817,7 @@ static void blk_add_trace_getrq(void *ignore, | |||
813 | struct bio *bio, int rw) | 817 | struct bio *bio, int rw) |
814 | { | 818 | { |
815 | if (bio) | 819 | if (bio) |
816 | blk_add_trace_bio(q, bio, BLK_TA_GETRQ); | 820 | blk_add_trace_bio(q, bio, BLK_TA_GETRQ, 0); |
817 | else { | 821 | else { |
818 | struct blk_trace *bt = q->blk_trace; | 822 | struct blk_trace *bt = q->blk_trace; |
819 | 823 | ||
@@ -828,7 +832,7 @@ static void blk_add_trace_sleeprq(void *ignore, | |||
828 | struct bio *bio, int rw) | 832 | struct bio *bio, int rw) |
829 | { | 833 | { |
830 | if (bio) | 834 | if (bio) |
831 | blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ); | 835 | blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ, 0); |
832 | else { | 836 | else { |
833 | struct blk_trace *bt = q->blk_trace; | 837 | struct blk_trace *bt = q->blk_trace; |
834 | 838 | ||