public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: mfasheh@suse.de
Cc: xfs@oss.sgi.com
Subject: xfs-trace-ilock-more
Date: Tue, 13 Dec 2011 21:40:40 -0500	[thread overview]
Message-ID: <20111214024040.GA17780@infradead.org> (raw)

Can you explain the story behid this patch in SLES11SP1?


---
From: Mark Fasheh <mfasheh@suse.de>
Date: Mon Oct  3 12:39:07 PDT 2011
Subject: xfs: add more ilock tracing
Patch-mainline: Never

Lets get a trace of the amount of time spent in xfs_ilock().

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Index: linux-2.6.32-xfs-tracing/fs/xfs/linux-2.6/xfs_trace.h
===================================================================
--- linux-2.6.32-xfs-tracing.orig/fs/xfs/linux-2.6/xfs_trace.h
+++ linux-2.6.32-xfs-tracing/fs/xfs/linux-2.6/xfs_trace.h
@@ -453,24 +453,27 @@ DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
 #define DEFINE_LOCK_EVENT(name) \
 TRACE_EVENT(name, \
 	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
-		 unsigned long caller_ip), \
-	TP_ARGS(ip,  lock_flags, caller_ip), \
+		 unsigned long start, unsigned long caller_ip), \
+	TP_ARGS(ip,  lock_flags, start, caller_ip),		\
 	TP_STRUCT__entry( \
 		__field(dev_t, dev) \
 		__field(xfs_ino_t, ino) \
 		__field(int, lock_flags) \
+		__field(unsigned long, start) \
 		__field(unsigned long, caller_ip) \
 	), \
 	TP_fast_assign( \
 		__entry->dev = VFS_I(ip)->i_sb->s_dev; \
 		__entry->ino = ip->i_ino; \
 		__entry->lock_flags = lock_flags; \
+		__entry->start = start;		  \
 		__entry->caller_ip = caller_ip; \
 	), \
-	TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf", \
+	TP_printk("dev %d:%d ino 0x%llx flags %s wait %lu caller %pf", \
 		  MAJOR(__entry->dev), MINOR(__entry->dev), \
 		  __entry->ino, \
 		  __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS), \
+		  (jiffies - __entry->start), \
 		  (void *)__entry->caller_ip) \
 )
 
Index: linux-2.6.32-xfs-tracing/fs/xfs/xfs_iget.c
===================================================================
--- linux-2.6.32-xfs-tracing.orig/fs/xfs/xfs_iget.c
+++ linux-2.6.32-xfs-tracing/fs/xfs/xfs_iget.c
@@ -590,6 +590,8 @@ xfs_ilock(
 	xfs_inode_t		*ip,
 	uint			lock_flags)
 {
+	unsigned long start = jiffies;
+
 	/*
 	 * You can't set both SHARED and EXCL for the same lock,
 	 * and only XFS_IOLOCK_SHARED, XFS_IOLOCK_EXCL, XFS_ILOCK_SHARED,
@@ -611,7 +613,7 @@ xfs_ilock(
 	else if (lock_flags & XFS_ILOCK_SHARED)
 		mraccess_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags));
 
-	trace_xfs_ilock(ip, lock_flags, _RET_IP_);
+	trace_xfs_ilock(ip, lock_flags, start, _RET_IP_);
 }
 
 /*
@@ -631,6 +633,8 @@ xfs_ilock_nowait(
 	xfs_inode_t		*ip,
 	uint			lock_flags)
 {
+	unsigned long start = jiffies;
+
 	/*
 	 * You can't set both SHARED and EXCL for the same lock,
 	 * and only XFS_IOLOCK_SHARED, XFS_IOLOCK_EXCL, XFS_ILOCK_SHARED,
@@ -656,7 +660,7 @@ xfs_ilock_nowait(
 		if (!mrtryaccess(&ip->i_lock))
 			goto out_undo_iolock;
 	}
-	trace_xfs_ilock_nowait(ip, lock_flags, _RET_IP_);
+	trace_xfs_ilock_nowait(ip, lock_flags, start, _RET_IP_);
 	return 1;
 
  out_undo_iolock:
@@ -684,7 +688,10 @@ void
 xfs_iunlock(
 	xfs_inode_t		*ip,
 	uint			lock_flags)
+
 {
+	unsigned long start = jiffies;
+
 	/*
 	 * You can't set both SHARED and EXCL for the same lock,
 	 * and only XFS_IOLOCK_SHARED, XFS_IOLOCK_EXCL, XFS_ILOCK_SHARED,
@@ -718,7 +725,7 @@ xfs_iunlock(
 		xfs_trans_unlocked_item(ip->i_itemp->ili_item.li_ailp,
 					(xfs_log_item_t*)(ip->i_itemp));
 	}
-	trace_xfs_iunlock(ip, lock_flags, _RET_IP_);
+	trace_xfs_iunlock(ip, lock_flags, start, _RET_IP_);
 }
 
 /*
@@ -730,6 +737,8 @@ xfs_ilock_demote(
 	xfs_inode_t		*ip,
 	uint			lock_flags)
 {
+	unsigned long start = jiffies;
+
 	ASSERT(lock_flags & (XFS_IOLOCK_EXCL|XFS_ILOCK_EXCL));
 	ASSERT((lock_flags & ~(XFS_IOLOCK_EXCL|XFS_ILOCK_EXCL)) == 0);
 
@@ -738,7 +747,7 @@ xfs_ilock_demote(
 	if (lock_flags & XFS_IOLOCK_EXCL)
 		mrdemote(&ip->i_iolock);
 
-	trace_xfs_ilock_demote(ip, lock_flags, _RET_IP_);
+	trace_xfs_ilock_demote(ip, lock_flags, start, _RET_IP_);
 }
 
 #ifdef DEBUG

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

             reply	other threads:[~2011-12-14  2:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14  2:40 Christoph Hellwig [this message]
2011-12-14 18:27 ` xfs-trace-ilock-more Mark Fasheh
2011-12-14 19:24   ` xfs-trace-ilock-more Jeff Mahoney
2011-12-14 20:32     ` xfs-trace-ilock-more Dave Chinner
2011-12-14 22:42       ` xfs-trace-ilock-more Jeff Mahoney
2011-12-18 20:26     ` xfs-trace-ilock-more Christoph Hellwig
2011-12-18 20:27   ` xfs-trace-ilock-more Christoph Hellwig
2012-01-05 22:38     ` xfs-trace-ilock-more Mark Fasheh
2012-01-05 23:54       ` xfs-trace-ilock-more Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111214024040.GA17780@infradead.org \
    --to=hch@infradead.org \
    --cc=mfasheh@suse.de \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox