]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
block: add trace messages to zone write plugging
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Tue, 15 Jul 2025 11:53:24 +0000 (13:53 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 15 Jul 2025 14:03:49 +0000 (08:03 -0600)
Add tracepoints to zone write plugging plug and unplug events.

Examples for these events are:

  kworker/u10:4-393  [001] d..1. 282.991660: disk_zone_wplug_add_bio: 8,0 zone 16, BIO 8388608 + 128
  kworker/0:1H-58    [ [000] d..1. 283.083294: blk_zone_wplug_bio: 8,0 zone 15, BIO 7864320 + 128

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20250715115324.53308-6-johannes.thumshirn@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-zoned.c
include/trace/events/block.h

index 70003a4bc7db7649533eeae758b43148801d64a1..ef43aaca49f4d9791b799bc8f2f7888181f909bd 100644 (file)
@@ -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, bio_sectors(bio));
 
        zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED;
 
@@ -1299,6 +1301,9 @@ again:
                goto put_zwplug;
        }
 
+       trace_blk_zone_wplug_bio(zwplug->disk->queue, zwplug->zone_no,
+                                bio->bi_iter.bi_sector, bio_sectors(bio));
+
        if (!blk_zone_wplug_prepare_bio(zwplug, bio)) {
                blk_zone_wplug_bio_io_error(zwplug, bio);
                goto again;
index ff7698efdfde43273d06c247e6de12779de21f84..3e582d5e3a57253e7e12961fc5b4597b3014d6bb 100644 (file)
@@ -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_sectors),
+
+       TP_ARGS(q, zno, sector, nr_sectors),
+
+       TP_STRUCT__entry(
+               __field( dev_t,         dev             )
+               __field( unsigned int,  zno             )
+               __field( sector_t,      sector          )
+               __field( unsigned int,  nr_sectors      )
+       ),
+
+       TP_fast_assign(
+               __entry->dev            = disk_devt(q->disk);
+               __entry->zno            = zno;
+               __entry->sector         = sector;
+               __entry->nr_sectors     = nr_sectors;
+       ),
+
+       TP_printk("%d,%d zone %u, BIO %llu + %u",
+                 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->zno,
+                 (unsigned long long)__entry->sector,
+                 __entry->nr_sectors)
+);
+
+DEFINE_EVENT(block_zwplug, disk_zone_wplug_add_bio,
+
+       TP_PROTO(struct request_queue *q, unsigned int zno, sector_t sector,
+                unsigned int nr_sectors),
+
+       TP_ARGS(q, zno, sector, nr_sectors)
+);
+
+DEFINE_EVENT(block_zwplug, blk_zone_wplug_bio,
+
+       TP_PROTO(struct request_queue *q, unsigned int zno, sector_t sector,
+                unsigned int nr_sectors),
+
+       TP_ARGS(q, zno, sector, nr_sectors)
+);
+
 #endif /* _TRACE_BLOCK_H */
 
 /* This part must be outside protection */