aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2010-03-07 19:24:07 -0500
committerAlex Elder <aelder@sgi.com>2010-05-19 10:58:08 -0400
commit4aaf15d1aa9673dd2cc45c48957c946cb4aa2694 (patch)
treeaec24df27ca9cde2d359b77f9ac97f8ad44a1baa /fs/xfs
parent43f5efc5b59db1b66e39fe9fdfc4ba6a27152afa (diff)
xfs: Add inode pin counts to traces
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>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_trace.h9
-rw-r--r--fs/xfs/xfs_inode.c2
-rw-r--r--fs/xfs/xfs_inode_item.c2
3 files changed, 12 insertions, 1 deletions
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h
index fcaa62f0799e..65371859c753 100644
--- a/fs/xfs/linux-2.6/xfs_trace.h
+++ b/fs/xfs/linux-2.6/xfs_trace.h
@@ -562,18 +562,21 @@ DECLARE_EVENT_CLASS(xfs_inode_class,
562 __field(dev_t, dev) 562 __field(dev_t, dev)
563 __field(xfs_ino_t, ino) 563 __field(xfs_ino_t, ino)
564 __field(int, count) 564 __field(int, count)
565 __field(int, pincount)
565 __field(unsigned long, caller_ip) 566 __field(unsigned long, caller_ip)
566 ), 567 ),
567 TP_fast_assign( 568 TP_fast_assign(
568 __entry->dev = VFS_I(ip)->i_sb->s_dev; 569 __entry->dev = VFS_I(ip)->i_sb->s_dev;
569 __entry->ino = ip->i_ino; 570 __entry->ino = ip->i_ino;
570 __entry->count = atomic_read(&VFS_I(ip)->i_count); 571 __entry->count = atomic_read(&VFS_I(ip)->i_count);
572 __entry->pincount = atomic_read(&ip->i_pincount);
571 __entry->caller_ip = caller_ip; 573 __entry->caller_ip = caller_ip;
572 ), 574 ),
573 TP_printk("dev %d:%d ino 0x%llx count %d caller %pf", 575 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf",
574 MAJOR(__entry->dev), MINOR(__entry->dev), 576 MAJOR(__entry->dev), MINOR(__entry->dev),
575 __entry->ino, 577 __entry->ino,
576 __entry->count, 578 __entry->count,
579 __entry->pincount,
577 (char *)__entry->caller_ip) 580 (char *)__entry->caller_ip)
578) 581)
579 582
@@ -583,6 +586,10 @@ DEFINE_EVENT(xfs_inode_class, name, \
583 TP_ARGS(ip, caller_ip)) 586 TP_ARGS(ip, caller_ip))
584DEFINE_INODE_EVENT(xfs_ihold); 587DEFINE_INODE_EVENT(xfs_ihold);
585DEFINE_INODE_EVENT(xfs_irele); 588DEFINE_INODE_EVENT(xfs_irele);
589DEFINE_INODE_EVENT(xfs_inode_pin);
590DEFINE_INODE_EVENT(xfs_inode_unpin);
591DEFINE_INODE_EVENT(xfs_inode_unpin_nowait);
592
586/* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */ 593/* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */
587DEFINE_INODE_EVENT(xfs_inode); 594DEFINE_INODE_EVENT(xfs_inode);
588#define xfs_itrace_entry(ip) \ 595#define xfs_itrace_entry(ip) \
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 0ffd56447045..8cd6e8d8fe9c 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2449,6 +2449,8 @@ xfs_iunpin_nowait(
2449{ 2449{
2450 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); 2450 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
2451 2451
2452 trace_xfs_inode_unpin_nowait(ip, _RET_IP_);
2453
2452 /* Give the log a push to start the unpinning I/O */ 2454 /* Give the log a push to start the unpinning I/O */
2453 xfs_log_force_lsn(ip->i_mount, ip->i_itemp->ili_last_lsn, 0); 2455 xfs_log_force_lsn(ip->i_mount, ip->i_itemp->ili_last_lsn, 0);
2454 2456
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 32e4188411c2..03471757bc88 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -543,6 +543,7 @@ xfs_inode_item_pin(
543{ 543{
544 ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL)); 544 ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL));
545 545
546 trace_xfs_inode_pin(iip->ili_inode, _RET_IP_);
546 atomic_inc(&iip->ili_inode->i_pincount); 547 atomic_inc(&iip->ili_inode->i_pincount);
547} 548}
548 549
@@ -561,6 +562,7 @@ xfs_inode_item_unpin(
561{ 562{
562 struct xfs_inode *ip = iip->ili_inode; 563 struct xfs_inode *ip = iip->ili_inode;
563 564
565 trace_xfs_inode_unpin(ip, _RET_IP_);
564 ASSERT(atomic_read(&ip->i_pincount) > 0); 566 ASSERT(atomic_read(&ip->i_pincount) > 0);
565 if (atomic_dec_and_test(&ip->i_pincount)) 567 if (atomic_dec_and_test(&ip->i_pincount))
566 wake_up(&ip->i_ipin_wait); 568 wake_up(&ip->i_ipin_wait);