The request based block tracepoints already report the I/O priority since commit aa6ff4eb7c10 ("block: Add ioprio to block_rq tracepoint"). Add it to block_bio_complete, the block_bio class (block_bio_backmerge, block_bio_frontmerge, block_bio_queue and block_getrq), block_split, block_bio_remap and block_rq_remap as well, so the I/O priority can be followed through the whole block layer. Reviewed-by: Chaitanya Kulkarni Signed-off-by: Johannes Thumshirn --- include/trace/events/block.h | 50 +++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/include/trace/events/block.h b/include/trace/events/block.h index 9c97a16850b9..5828ed5df872 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h @@ -373,6 +373,7 @@ TRACE_EVENT(block_bio_complete, __field( dev_t, dev ) __field( sector_t, sector ) __field( unsigned, nr_sector ) + __field( unsigned short, ioprio ) __field( int, error ) __array( char, rwbs, RWBS_LEN) ), @@ -381,14 +382,20 @@ TRACE_EVENT(block_bio_complete, __entry->dev = bio_dev(bio); __entry->sector = bio->bi_iter.bi_sector; __entry->nr_sector = bio_sectors(bio); + __entry->ioprio = bio->bi_ioprio; __entry->error = blk_status_to_errno(bio->bi_status); blk_fill_rwbs(__entry->rwbs, bio->bi_opf); ), - TP_printk("%d,%d %s %llu + %u [%d]", + TP_printk("%d,%d %s %llu + %u %s,%u,%u [%d]", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->error) + __entry->nr_sector, + __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), + IOPRIO_CLASS_STRINGS), + IOPRIO_PRIO_HINT(__entry->ioprio), + IOPRIO_PRIO_LEVEL(__entry->ioprio), + __entry->error) ); DECLARE_EVENT_CLASS(block_bio, @@ -401,6 +408,7 @@ DECLARE_EVENT_CLASS(block_bio, __field( dev_t, dev ) __field( sector_t, sector ) __field( unsigned int, nr_sector ) + __field( unsigned short, ioprio ) __array( char, rwbs, RWBS_LEN ) __array( char, comm, TASK_COMM_LEN ) ), @@ -409,14 +417,20 @@ DECLARE_EVENT_CLASS(block_bio, __entry->dev = bio_dev(bio); __entry->sector = bio->bi_iter.bi_sector; __entry->nr_sector = bio_sectors(bio); + __entry->ioprio = bio->bi_ioprio; blk_fill_rwbs(__entry->rwbs, bio->bi_opf); memcpy(__entry->comm, current->comm, TASK_COMM_LEN); ), - TP_printk("%d,%d %s %llu + %u [%s]", + TP_printk("%d,%d %s %llu + %u %s,%u,%u [%s]", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm) + __entry->nr_sector, + __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), + IOPRIO_CLASS_STRINGS), + IOPRIO_PRIO_HINT(__entry->ioprio), + IOPRIO_PRIO_LEVEL(__entry->ioprio), + __entry->comm) ); /** @@ -554,6 +568,7 @@ TRACE_EVENT(block_split, __field( dev_t, dev ) __field( sector_t, sector ) __field( sector_t, new_sector ) + __field( unsigned short, ioprio ) __array( char, rwbs, RWBS_LEN ) __array( char, comm, TASK_COMM_LEN ) ), @@ -562,14 +577,19 @@ TRACE_EVENT(block_split, __entry->dev = bio_dev(bio); __entry->sector = bio->bi_iter.bi_sector; __entry->new_sector = new_sector; + __entry->ioprio = bio->bi_ioprio; blk_fill_rwbs(__entry->rwbs, bio->bi_opf); memcpy(__entry->comm, current->comm, TASK_COMM_LEN); ), - TP_printk("%d,%d %s %llu / %llu [%s]", + TP_printk("%d,%d %s %llu / %llu %s,%u,%u [%s]", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, (unsigned long long)__entry->sector, (unsigned long long)__entry->new_sector, + __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), + IOPRIO_CLASS_STRINGS), + IOPRIO_PRIO_HINT(__entry->ioprio), + IOPRIO_PRIO_LEVEL(__entry->ioprio), __entry->comm) ); @@ -594,6 +614,7 @@ TRACE_EVENT(block_bio_remap, __field( unsigned int, nr_sector ) __field( dev_t, old_dev ) __field( sector_t, old_sector ) + __field( unsigned short, ioprio ) __array( char, rwbs, RWBS_LEN) ), @@ -603,15 +624,20 @@ TRACE_EVENT(block_bio_remap, __entry->nr_sector = bio_sectors(bio); __entry->old_dev = dev; __entry->old_sector = from; + __entry->ioprio = bio->bi_ioprio; blk_fill_rwbs(__entry->rwbs, bio->bi_opf); ), - TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", + TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %s,%u,%u", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, (unsigned long long)__entry->sector, __entry->nr_sector, MAJOR(__entry->old_dev), MINOR(__entry->old_dev), - (unsigned long long)__entry->old_sector) + (unsigned long long)__entry->old_sector, + __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), + IOPRIO_CLASS_STRINGS), + IOPRIO_PRIO_HINT(__entry->ioprio), + IOPRIO_PRIO_LEVEL(__entry->ioprio)) ); /** @@ -637,6 +663,7 @@ TRACE_EVENT(block_rq_remap, __field( dev_t, old_dev ) __field( sector_t, old_sector ) __field( unsigned int, nr_bios ) + __field( unsigned short, ioprio ) __array( char, rwbs, RWBS_LEN) ), @@ -647,15 +674,20 @@ TRACE_EVENT(block_rq_remap, __entry->old_dev = dev; __entry->old_sector = from; __entry->nr_bios = blk_rq_count_bios(rq); + __entry->ioprio = req_get_ioprio(rq); blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); ), - TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u", + TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u %s,%u,%u", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, (unsigned long long)__entry->sector, __entry->nr_sector, MAJOR(__entry->old_dev), MINOR(__entry->old_dev), - (unsigned long long)__entry->old_sector, __entry->nr_bios) + (unsigned long long)__entry->old_sector, __entry->nr_bios, + __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), + IOPRIO_CLASS_STRINGS), + IOPRIO_PRIO_HINT(__entry->ioprio), + IOPRIO_PRIO_LEVEL(__entry->ioprio)) ); /** -- 2.56.1