Skip to content

Commit

Permalink
btrfs: add tracepoints for outstanding extents mods
Browse files Browse the repository at this point in the history
This is handy for tracing problems with modifying the outstanding
extents counters.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Josef Bacik authored and David Sterba committed Nov 1, 2017
1 parent 8b62f87 commit dd48d40
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/btrfs/btrfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ static inline void btrfs_mod_outstanding_extents(struct btrfs_inode *inode,
inode->outstanding_extents += mod;
if (btrfs_is_free_space_inode(inode))
return;
trace_btrfs_inode_mod_outstanding_extents(inode->root, btrfs_ino(inode),
mod);
}

static inline void btrfs_mod_reserved_extents(struct btrfs_inode *inode, int mod)
Expand Down
21 changes: 21 additions & 0 deletions include/trace/events/btrfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,27 @@ DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert,
TP_ARGS(fs_info, oldref, newref, tree_size)
);

TRACE_EVENT(btrfs_inode_mod_outstanding_extents,
TP_PROTO(struct btrfs_root *root, u64 ino, int mod),

TP_ARGS(root, ino, mod),

TP_STRUCT__entry_btrfs(
__field( u64, root_objectid )
__field( u64, ino )
__field( int, mod )
),

TP_fast_assign_btrfs(root->fs_info,
__entry->root_objectid = root->objectid;
__entry->ino = ino;
__entry->mod = mod;
),

TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d",
show_root_type(__entry->root_objectid),
(unsigned long long)__entry->ino, __entry->mod)
);
#endif /* _TRACE_BTRFS_H */

/* This part must be outside protection */
Expand Down

0 comments on commit dd48d40

Please sign in to comment.