Skip to content

Commit 75afb35

Browse files
nomuranecaxboe
authored andcommitted
block: Add nr_bios to block_rq_remap tracepoint
Adding the number of bios in a remapped request to 'block_rq_remap' tracepoint. Request remapper clones bios in a request to track the completion status of each bio. So the number of bios can be useful information for investigation. Related discussions: http://www.redhat.com/archives/dm-devel/2013-August/msg00084.html http://www.redhat.com/archives/dm-devel/2013-September/msg00024.html Signed-off-by: Jun'ichi Nomura <[email protected]> Acked-by: Mike Snitzer <[email protected]> Cc: Jens Axboe <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 7652113 commit 75afb35

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

include/linux/blkdev.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,17 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
862862
return blk_queue_get_max_sectors(q, rq->cmd_flags);
863863
}
864864

865+
static inline unsigned int blk_rq_count_bios(struct request *rq)
866+
{
867+
unsigned int nr_bios = 0;
868+
struct bio *bio;
869+
870+
__rq_for_each_bio(bio, rq)
871+
nr_bios++;
872+
873+
return nr_bios;
874+
}
875+
865876
/*
866877
* Request issue related functions.
867878
*/

include/trace/events/block.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ TRACE_EVENT(block_rq_remap,
618618
__field( unsigned int, nr_sector )
619619
__field( dev_t, old_dev )
620620
__field( sector_t, old_sector )
621+
__field( unsigned int, nr_bios )
621622
__array( char, rwbs, RWBS_LEN)
622623
),
623624

@@ -627,15 +628,16 @@ TRACE_EVENT(block_rq_remap,
627628
__entry->nr_sector = blk_rq_sectors(rq);
628629
__entry->old_dev = dev;
629630
__entry->old_sector = from;
631+
__entry->nr_bios = blk_rq_count_bios(rq);
630632
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
631633
),
632634

633-
TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
635+
TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
634636
MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
635637
(unsigned long long)__entry->sector,
636638
__entry->nr_sector,
637639
MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
638-
(unsigned long long)__entry->old_sector)
640+
(unsigned long long)__entry->old_sector, __entry->nr_bios)
639641
);
640642

641643
#endif /* _TRACE_BLOCK_H */

0 commit comments

Comments
 (0)