[PATCH 08/15] xfs: Add tracing support for inode swap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add tracing support for swapping inodes.

Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx>
---
 fs/xfs/xfs_dfrag.c |    6 ++++++
 fs/xfs/xfs_trace.h |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index f91b79c..0e3e53c 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -510,6 +510,9 @@ xfs_swap_inodes(
 		goto out_unlock;
 	}
 
+	trace_xfs_swap_inode_before(ip, 0);
+	trace_xfs_swap_inode_before(tip, 1);
+
 	/*
 	 * We need to fail if the file is memory mapped.  Once we have tossed
 	 * all existing pages, the page fault will have no option but to go to
@@ -614,6 +617,9 @@ xfs_swap_inodes(
 
 	error = xfs_trans_commit(tp, 0);
 
+	trace_xfs_swap_inode_after(ip, 0);
+	trace_xfs_swap_inode_after(tip, 1);
+
 out:
 	if (dic)
 		kmem_free(dic);
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 7d36ccf..b4dcb70 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -1664,6 +1664,43 @@ DEFINE_EVENT(xfs_swap_extent_class, name, \
 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
 
+#define XFS_SWAPINO_INODES \
+	{ 0,	"target" }, \
+	{ 1,	"temp" }
+
+DECLARE_EVENT_CLASS(xfs_swap_inode_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, 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->fork_off = XFS_IFORK_BOFF(ip);
+	),
+	TP_printk("dev %d:%d ino 0x%llx (%s), %s format, fork offset %d",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->ino,
+		  __print_symbolic(__entry->which, XFS_SWAPINO_INODES),
+		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
+		  __entry->fork_off)
+)
+
+#define DEFINE_SWAPINO_EVENT(name) \
+DEFINE_EVENT(xfs_swap_inode_class, name, \
+	TP_PROTO(struct xfs_inode *ip, int which), \
+	TP_ARGS(ip, which))
+
+DEFINE_SWAPINO_EVENT(xfs_swap_inode_before);
+DEFINE_SWAPINO_EVENT(xfs_swap_inode_after);
+
 DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
 	TP_PROTO(struct xlog *log, struct xlog_recover *trans,
 		struct xlog_recover_item *item, int pass),
-- 
1.7.4.1

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux