aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2010-01-13 20:33:55 -0500
committerAlex Elder <aelder@sgi.com>2010-01-15 16:20:06 -0500
commit3a85cd96d3ab3c6dcf88b81fc6eaddb84e565a43 (patch)
tree9b1cfa8db498d7e76b1aa745254261010814f676
parente09f98606dcc156de1146c209d45a0d6d5f51c3f (diff)
xfs: add tracing to xfs_swap_extents
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>
-rw-r--r--fs/xfs/linux-2.6/xfs_trace.h53
-rw-r--r--fs/xfs/xfs_dfrag.c5
2 files changed, 58 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h
index c22a608321a3..3353aef50530 100644
--- a/fs/xfs/linux-2.6/xfs_trace.h
+++ b/fs/xfs/linux-2.6/xfs_trace.h
@@ -1414,6 +1414,59 @@ TRACE_EVENT(xfs_dir2_leafn_moveents,
1414 __entry->count) 1414 __entry->count)
1415); 1415);
1416 1416
1417#define XFS_SWAPEXT_INODES \
1418 { 0, "target" }, \
1419 { 1, "temp" }
1420
1421#define XFS_INODE_FORMAT_STR \
1422 { 0, "invalid" }, \
1423 { 1, "local" }, \
1424 { 2, "extent" }, \
1425 { 3, "btree" }
1426
1427DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1428 TP_PROTO(struct xfs_inode *ip, int which),
1429 TP_ARGS(ip, which),
1430 TP_STRUCT__entry(
1431 __field(dev_t, dev)
1432 __field(int, which)
1433 __field(xfs_ino_t, ino)
1434 __field(int, format)
1435 __field(int, nex)
1436 __field(int, max_nex)
1437 __field(int, broot_size)
1438 __field(int, fork_off)
1439 ),
1440 TP_fast_assign(
1441 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1442 __entry->which = which;
1443 __entry->ino = ip->i_ino;
1444 __entry->format = ip->i_d.di_format;
1445 __entry->nex = ip->i_d.di_nextents;
1446 __entry->max_nex = ip->i_df.if_ext_max;
1447 __entry->broot_size = ip->i_df.if_broot_bytes;
1448 __entry->fork_off = XFS_IFORK_BOFF(ip);
1449 ),
1450 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1451 "Max in-fork extents %d, broot size %d, fork offset %d",
1452 MAJOR(__entry->dev), MINOR(__entry->dev),
1453 __entry->ino,
1454 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1455 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1456 __entry->nex,
1457 __entry->max_nex,
1458 __entry->broot_size,
1459 __entry->fork_off)
1460)
1461
1462#define DEFINE_SWAPEXT_EVENT(name) \
1463DEFINE_EVENT(xfs_swap_extent_class, name, \
1464 TP_PROTO(struct xfs_inode *ip, int which), \
1465 TP_ARGS(ip, which))
1466
1467DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1468DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1469
1417#endif /* _TRACE_XFS_H */ 1470#endif /* _TRACE_XFS_H */
1418 1471
1419#undef TRACE_INCLUDE_PATH 1472#undef TRACE_INCLUDE_PATH
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 84ca1cf16a1e..f25e54027d10 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -254,6 +254,9 @@ xfs_swap_extents(
254 goto out_unlock; 254 goto out_unlock;
255 } 255 }
256 256
257 trace_xfs_swap_extent_before(ip, 0);
258 trace_xfs_swap_extent_before(tip, 1);
259
257 /* check inode formats now that data is flushed */ 260 /* check inode formats now that data is flushed */
258 error = xfs_swap_extents_check_format(ip, tip); 261 error = xfs_swap_extents_check_format(ip, tip);
259 if (error) { 262 if (error) {
@@ -421,6 +424,8 @@ xfs_swap_extents(
421 424
422 error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT); 425 error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT);
423 426
427 trace_xfs_swap_extent_after(ip, 0);
428 trace_xfs_swap_extent_after(tip, 1);
424out: 429out:
425 kmem_free(tempifp); 430 kmem_free(tempifp);
426 return error; 431 return error;