Skip to content

Commit

Permalink
xfs: add tracing to xfs_swap_extents
Browse files Browse the repository at this point in the history
To be able to diagnose whether the swap extents function is
detecting compatible inode data fork configurations for swapping
extents, add tracing points to the code to allow us to see the
format of the inode forks before and after the swap.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
  • Loading branch information
Dave Chinner authored and Alex Elder committed Jan 15, 2010
1 parent e09f986 commit 3a85cd9
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
53 changes: 53 additions & 0 deletions fs/xfs/linux-2.6/xfs_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,59 @@ TRACE_EVENT(xfs_dir2_leafn_moveents,
__entry->count)
);

#define XFS_SWAPEXT_INODES \
{ 0, "target" }, \
{ 1, "temp" }

#define XFS_INODE_FORMAT_STR \
{ 0, "invalid" }, \
{ 1, "local" }, \
{ 2, "extent" }, \
{ 3, "btree" }

DECLARE_EVENT_CLASS(xfs_swap_extent_class,
TP_PROTO(struct xfs_inode *ip, int which),
TP_ARGS(ip, which),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(int, which)
__field(xfs_ino_t, ino)
__field(int, format)
__field(int, nex)
__field(int, max_nex)
__field(int, broot_size)
__field(int, fork_off)
),
TP_fast_assign(
__entry->dev = VFS_I(ip)->i_sb->s_dev;
__entry->which = which;
__entry->ino = ip->i_ino;
__entry->format = ip->i_d.di_format;
__entry->nex = ip->i_d.di_nextents;
__entry->max_nex = ip->i_df.if_ext_max;
__entry->broot_size = ip->i_df.if_broot_bytes;
__entry->fork_off = XFS_IFORK_BOFF(ip);
),
TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
"Max in-fork extents %d, broot size %d, fork offset %d",
MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->ino,
__print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
__print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
__entry->nex,
__entry->max_nex,
__entry->broot_size,
__entry->fork_off)
)

#define DEFINE_SWAPEXT_EVENT(name) \
DEFINE_EVENT(xfs_swap_extent_class, name, \
TP_PROTO(struct xfs_inode *ip, int which), \
TP_ARGS(ip, which))

DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);

#endif /* _TRACE_XFS_H */

#undef TRACE_INCLUDE_PATH
Expand Down
5 changes: 5 additions & 0 deletions fs/xfs/xfs_dfrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ xfs_swap_extents(
goto out_unlock;
}

trace_xfs_swap_extent_before(ip, 0);
trace_xfs_swap_extent_before(tip, 1);

/* check inode formats now that data is flushed */
error = xfs_swap_extents_check_format(ip, tip);
if (error) {
Expand Down Expand Up @@ -421,6 +424,8 @@ xfs_swap_extents(

error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT);

trace_xfs_swap_extent_after(ip, 0);
trace_xfs_swap_extent_after(tip, 1);
out:
kmem_free(tempifp);
return error;
Expand Down

0 comments on commit 3a85cd9

Please sign in to comment.