@@ -669,9 +669,12 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
if (use_append)
map_length = min(map_length, fs_info->max_zone_append_size);
+ trace_before_split_bbio(bbio, mirror_num, map_length);
+
if (map_length < length) {
bbio = btrfs_split_bio(fs_info, bbio, map_length, use_append);
bio = &bbio->bio;
+ trace_after_split_bbio(bbio, mirror_num, map_length);
}
/*
@@ -731,6 +734,7 @@ void btrfs_submit_bio(struct btrfs_bio *bbio, int mirror_num)
/* If bbio->inode is not populated, its file_offset must be 0. */
ASSERT(bbio->inode || bbio->file_offset == 0);
+ trace_initial_bbio(bbio, mirror_num, -1);
while (!btrfs_submit_chunk(bbio, mirror_num))
;
}
@@ -31,6 +31,7 @@ struct extent_io_tree;
struct prelim_ref;
struct btrfs_space_info;
struct btrfs_raid_bio;
+struct btrfs_bio;
struct raid56_bio_trace_info;
struct find_free_extent_ctl;
@@ -2521,6 +2522,56 @@ DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_read_recover,
TP_ARGS(rbio, bio, trace_info)
);
+DECLARE_EVENT_CLASS(btrfs_bio,
+
+ TP_PROTO(const struct btrfs_bio *bbio, int mirror_num, u64 map_length),
+
+ TP_ARGS(bbio, mirror_num, map_length),
+
+ TP_STRUCT__entry_btrfs(
+ __field( u64, logical )
+ __field( u64, root )
+ __field( u64, ino )
+ __field( s64, map_length )
+ __field( u32, length )
+ __field( int, mirror_num )
+ __field( u8, opf )
+ ),
+
+ TP_fast_assign_btrfs(bbio->fs_info,
+ __entry->logical = bbio->bio.bi_iter.bi_sector << SECTOR_SHIFT;
+ __entry->length = bbio->bio.bi_iter.bi_size;
+ __entry->map_length = map_length;
+ __entry->mirror_num = mirror_num;
+ __entry->opf = bio_op(&bbio->bio);
+ __entry->root = bbio->inode ?
+ bbio->inode->root->root_key.objectid : 0;
+ __entry->ino = bbio->inode ? btrfs_ino(bbio->inode) : 0;
+ ),
+ TP_printk_btrfs(
+"root=%lld(%s) ino=%llu logical=%llu length=%u opf=0x%x mirror_num=%d map_length=%lld",
+ show_root_type(__entry->root), __entry->ino,
+ __entry->logical, __entry->length, __entry->opf,
+ __entry->mirror_num, __entry->map_length)
+);
+
+DEFINE_EVENT(btrfs_bio, initial_bbio,
+ TP_PROTO(const struct btrfs_bio *bbio, int mirror_num, u64 map_length),
+
+ TP_ARGS(bbio, mirror_num, map_length)
+);
+
+DEFINE_EVENT(btrfs_bio, before_split_bbio,
+ TP_PROTO(const struct btrfs_bio *bbio, int mirror_num, u64 map_length),
+
+ TP_ARGS(bbio, mirror_num, map_length)
+);
+
+DEFINE_EVENT(btrfs_bio, after_split_bbio,
+ TP_PROTO(const struct btrfs_bio *bbio, int mirror_num, u64 map_length),
+
+ TP_ARGS(bbio, mirror_num, map_length)
+);
#endif /* _TRACE_BTRFS_H */
/* This part must be outside protection */