Skip to content

Commit dd48d40

Browse files
josefbacikkdave
authored andcommitted
btrfs: add tracepoints for outstanding extents mods
This is handy for tracing problems with modifying the outstanding extents counters. Signed-off-by: Josef Bacik <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 8b62f87 commit dd48d40

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

fs/btrfs/btrfs_inode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ static inline void btrfs_mod_outstanding_extents(struct btrfs_inode *inode,
274274
inode->outstanding_extents += mod;
275275
if (btrfs_is_free_space_inode(inode))
276276
return;
277+
trace_btrfs_inode_mod_outstanding_extents(inode->root, btrfs_ino(inode),
278+
mod);
277279
}
278280

279281
static inline void btrfs_mod_reserved_extents(struct btrfs_inode *inode, int mod)

include/trace/events/btrfs.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,27 @@ DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert,
16951695
TP_ARGS(fs_info, oldref, newref, tree_size)
16961696
);
16971697

1698+
TRACE_EVENT(btrfs_inode_mod_outstanding_extents,
1699+
TP_PROTO(struct btrfs_root *root, u64 ino, int mod),
1700+
1701+
TP_ARGS(root, ino, mod),
1702+
1703+
TP_STRUCT__entry_btrfs(
1704+
__field( u64, root_objectid )
1705+
__field( u64, ino )
1706+
__field( int, mod )
1707+
),
1708+
1709+
TP_fast_assign_btrfs(root->fs_info,
1710+
__entry->root_objectid = root->objectid;
1711+
__entry->ino = ino;
1712+
__entry->mod = mod;
1713+
),
1714+
1715+
TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d",
1716+
show_root_type(__entry->root_objectid),
1717+
(unsigned long long)__entry->ino, __entry->mod)
1718+
);
16981719
#endif /* _TRACE_BTRFS_H */
16991720

17001721
/* This part must be outside protection */

0 commit comments

Comments
 (0)