Add tracepoints to zone write plugging plug and unplug events. kworker/u9:3-162 [000] d..1. 2231.939277: disk_zone_wplug_add_bio: 8,0 zone 12, BIO 6291456 + 14 kworker/0:1H-59 [000] d..1. 2231.939884: blk_zone_wplug_bio: 8,0 zone 24, BIO 12775168 + 4 Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx> --- block/blk-zoned.c | 5 ++++ include/trace/events/block.h | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 48f75f58d05e..b881aadbe35f 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -822,6 +822,8 @@ static inline void disk_zone_wplug_add_bio(struct gendisk *disk, * at the tail of the list to preserve the sequential write order. */ bio_list_add(&zwplug->bio_list, bio); + trace_disk_zone_wplug_add_bio(zwplug->disk->queue, zwplug->zone_no, + bio->bi_iter.bi_sector, nr_segs); zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED; @@ -1317,6 +1319,9 @@ static void blk_zone_wplug_bio_work(struct work_struct *work) goto put_zwplug; } + trace_blk_zone_wplug_bio(zwplug->disk->queue, zwplug->zone_no, + bio->bi_iter.bi_sector, bio->__bi_nr_segments); + if (!blk_zone_wplug_prepare_bio(zwplug, bio)) { blk_zone_wplug_bio_io_error(zwplug, bio); goto again; diff --git a/include/trace/events/block.h b/include/trace/events/block.h index 9a25b686fd09..16d5a87f3030 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h @@ -633,6 +633,50 @@ TRACE_EVENT(blkdev_zone_mgmt, (unsigned long long)__entry->sector, __entry->nr_sectors) ); + +DECLARE_EVENT_CLASS(block_zwplug, + + TP_PROTO(struct request_queue *q, unsigned int zno, sector_t sector, + unsigned int nr_segs), + + TP_ARGS(q, zno, sector, nr_segs), + + TP_STRUCT__entry( + __field( dev_t, dev ) + __field( unsigned int, zno ) + __field( sector_t, sector ) + __field( unsigned int, nr_segs ) + ), + + TP_fast_assign( + __entry->dev = disk_devt(q->disk); + __entry->zno = zno; + __entry->sector = sector; + __entry->nr_segs = nr_segs; + ), + + TP_printk("%d,%d zone %u, BIO %llu + %u", + MAJOR(__entry->dev), MINOR(__entry->dev), __entry->zno, + (unsigned long long)__entry->sector, + __entry->nr_segs) +); + +DEFINE_EVENT(block_zwplug, disk_zone_wplug_add_bio, + + TP_PROTO(struct request_queue *q, unsigned int zno, sector_t sector, + unsigned int nr_segs), + + TP_ARGS(q, zno, sector, nr_segs) +); + +DEFINE_EVENT(block_zwplug, blk_zone_wplug_bio, + + TP_PROTO(struct request_queue *q, unsigned int zno, sector_t sector, + unsigned int nr_segs), + + TP_ARGS(q, zno, sector, nr_segs) +); + #endif /* _TRACE_BLOCK_H */ /* This part must be outside protection */ -- 2.50.0