xfs: Add inode pin counts to traces
authorDave Chinner <dchinner@redhat.com>
Mon, 8 Mar 2010 00:24:07 +0000 (11:24 +1100)
committerAlex Elder <aelder@sgi.com>
Wed, 19 May 2010 14:58:08 +0000 (09:58 -0500)
We don't record pin counts in inode events right now, and this makes
it difficult to track down problems related to pinning inodes. Add
the pin count to the inode trace class and add trace events for
pinning and unpinning inodes.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/linux-2.6/xfs_trace.h
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode_item.c

index fcaa62f0799e7e80135da20bb877d4ed98bc1892..65371859c7536896adb31b1a3c023b4c27ff7af7 100644 (file)
@@ -562,18 +562,21 @@ DECLARE_EVENT_CLASS(xfs_inode_class,
                __field(dev_t, dev)
                __field(xfs_ino_t, ino)
                __field(int, count)
+               __field(int, pincount)
                __field(unsigned long, caller_ip)
        ),
        TP_fast_assign(
                __entry->dev = VFS_I(ip)->i_sb->s_dev;
                __entry->ino = ip->i_ino;
                __entry->count = atomic_read(&VFS_I(ip)->i_count);
+               __entry->pincount = atomic_read(&ip->i_pincount);
                __entry->caller_ip = caller_ip;
        ),
-       TP_printk("dev %d:%d ino 0x%llx count %d caller %pf",
+       TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->ino,
                  __entry->count,
+                 __entry->pincount,
                  (char *)__entry->caller_ip)
 )
 
@@ -583,6 +586,10 @@ DEFINE_EVENT(xfs_inode_class, name, \
        TP_ARGS(ip, caller_ip))
 DEFINE_INODE_EVENT(xfs_ihold);
 DEFINE_INODE_EVENT(xfs_irele);
+DEFINE_INODE_EVENT(xfs_inode_pin);
+DEFINE_INODE_EVENT(xfs_inode_unpin);
+DEFINE_INODE_EVENT(xfs_inode_unpin_nowait);
+
 /* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */
 DEFINE_INODE_EVENT(xfs_inode);
 #define xfs_itrace_entry(ip)    \
index 0ffd56447045a5bc8c817a03a64135b435e7b9d5..8cd6e8d8fe9c452e1d7c995d216a4f5745c61f53 100644 (file)
@@ -2449,6 +2449,8 @@ xfs_iunpin_nowait(
 {
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
 
+       trace_xfs_inode_unpin_nowait(ip, _RET_IP_);
+
        /* Give the log a push to start the unpinning I/O */
        xfs_log_force_lsn(ip->i_mount, ip->i_itemp->ili_last_lsn, 0);
 
index 32e4188411c219c780c97b8cd6805584bf9174dd..03471757bc8896bb18112ef223074fe9ee5cef17 100644 (file)
@@ -543,6 +543,7 @@ xfs_inode_item_pin(
 {
        ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL));
 
+       trace_xfs_inode_pin(iip->ili_inode, _RET_IP_);
        atomic_inc(&iip->ili_inode->i_pincount);
 }
 
@@ -561,6 +562,7 @@ xfs_inode_item_unpin(
 {
        struct xfs_inode        *ip = iip->ili_inode;
 
+       trace_xfs_inode_unpin(ip, _RET_IP_);
        ASSERT(atomic_read(&ip->i_pincount) > 0);
        if (atomic_dec_and_test(&ip->i_pincount))
                wake_up(&ip->i_ipin_wait);