Skip to content

Commit 52f17dc

Browse files
morbidrsakawasaki
authored andcommitted
block: add tracepoint for blkdev_zone_mgmt
Add a tracepoint for blkdev_zone_mgmt to trace zone management commands submitted by higher layers like file systems or user space. An example output for this tracepoint is as follows: mkfs.btrfs-210 [000] ..... 116.727190: blkdev_zone_mgmt: 259,6 ZRS 524288 + 0 This example output shows a REQ_OP_ZONE_RESET_ALL operation submitted by mkfs.btrfs. Signed-off-by: Johannes Thumshirn <[email protected]> Reviewed-by: Damien Le Moal <[email protected]>
1 parent c788308 commit 52f17dc

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

block/blk-zoned.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ static int blkdev_zone_reset_all(struct block_device *bdev)
179179
struct bio bio;
180180

181181
bio_init(&bio, bdev, NULL, 0, REQ_OP_ZONE_RESET_ALL | REQ_SYNC);
182+
trace_blkdev_zone_mgmt(&bio, 0);
182183
return submit_bio_wait(&bio);
183184
}
184185

@@ -242,6 +243,7 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op,
242243
cond_resched();
243244
}
244245

246+
trace_blkdev_zone_mgmt(bio, nr_sectors);
245247
ret = submit_bio_wait(bio);
246248
bio_put(bio);
247249

include/trace/events/block.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,40 @@ TRACE_EVENT(block_rq_remap,
599599
(unsigned long long)__entry->old_sector, __entry->nr_bios)
600600
);
601601

602+
/**
603+
* blkdev_zone_mgmt - Execute a zone management operation on a range of zones
604+
* @bio: The block IO operation sent down to the device
605+
* @nr_sectors: The number of sectors affected by this operation
606+
*
607+
* Execute a zone management operation on a specified range of zones. This
608+
* range is encoded in %nr_sectors, which has to be a multiple of the zone
609+
* size.
610+
*/
611+
TRACE_EVENT(blkdev_zone_mgmt,
612+
613+
TP_PROTO(struct bio *bio, sector_t nr_sectors),
614+
615+
TP_ARGS(bio, nr_sectors),
616+
617+
TP_STRUCT__entry(
618+
__field( dev_t, dev )
619+
__field( sector_t, sector )
620+
__field( sector_t, nr_sectors )
621+
__array( char, rwbs, RWBS_LEN)
622+
),
623+
624+
TP_fast_assign(
625+
__entry->dev = bio_dev(bio);
626+
__entry->sector = bio->bi_iter.bi_sector;
627+
__entry->nr_sectors = bio_sectors(bio);
628+
blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
629+
),
630+
631+
TP_printk("%d,%d %s %llu + %llu",
632+
MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
633+
(unsigned long long)__entry->sector,
634+
__entry->nr_sectors)
635+
);
602636
#endif /* _TRACE_BLOCK_H */
603637

604638
/* This part must be outside protection */

0 commit comments

Comments
 (0)