All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH v1 2/2] NFSD: Re-arrange file_close_inode tracepoints
Date: Thu, 03 Nov 2022 16:22:54 -0400	[thread overview]
Message-ID: <166750697425.1646.11770177003223505657.stgit@klimt.1015granger.net> (raw)
In-Reply-To: <166750689663.1646.10478083854261038468.stgit@klimt.1015granger.net>

Now that we have trace_nfsd_file_closing, all we really need to
capture is when an external caller has requested a close/sync.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/filecache.c |   17 ++++++-----------
 fs/nfsd/trace.h     |   45 ++++++++++++++++-----------------------------
 2 files changed, 22 insertions(+), 40 deletions(-)

diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index cf1a8f1d1349..7be62af4bfb7 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -706,14 +706,13 @@ static struct shrinker	nfsd_file_shrinker = {
  * The nfsd_file objects on the list will be unhashed, and each will have a
  * reference taken.
  */
-static unsigned int
+static void
 __nfsd_file_close_inode(struct inode *inode, struct list_head *dispose)
 {
 	struct nfsd_file_lookup_key key = {
 		.type	= NFSD_FILE_KEY_INODE,
 		.inode	= inode,
 	};
-	unsigned int count = 0;
 	struct nfsd_file *nf;
 
 	rcu_read_lock();
@@ -723,11 +722,9 @@ __nfsd_file_close_inode(struct inode *inode, struct list_head *dispose)
 		if (!nf)
 			break;
 
-		if (nfsd_file_unhash_and_queue(nf, dispose))
-			count++;
+		nfsd_file_unhash_and_queue(nf, dispose);
 	} while (1);
 	rcu_read_unlock();
-	return count;
 }
 
 /**
@@ -742,11 +739,9 @@ static void
 nfsd_file_close_inode(struct inode *inode)
 {
 	struct nfsd_file *nf, *tmp;
-	unsigned int count;
 	LIST_HEAD(dispose);
 
-	count = __nfsd_file_close_inode(inode, &dispose);
-	trace_nfsd_file_close_inode(inode, count);
+	__nfsd_file_close_inode(inode, &dispose);
 	list_for_each_entry_safe(nf, tmp, &dispose, nf_lru) {
 		trace_nfsd_file_closing(nf);
 		if (!refcount_dec_and_test(&nf->nf_ref))
@@ -765,11 +760,11 @@ void
 nfsd_file_close_inode_sync(struct inode *inode)
 {
 	struct nfsd_file *nf;
-	unsigned int count;
 	LIST_HEAD(dispose);
 
-	count = __nfsd_file_close_inode(inode, &dispose);
-	trace_nfsd_file_close_inode(inode, count);
+	trace_nfsd_file_close(inode);
+
+	__nfsd_file_close_inode(inode, &dispose);
 	while (!list_empty(&dispose)) {
 		nf = list_first_entry(&dispose, struct nfsd_file, nf_lru);
 		list_del_init(&nf->nf_lru);
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index e41007807b7e..ef01ecd3eec6 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -1099,35 +1099,6 @@ TRACE_EVENT(nfsd_file_open,
 		__entry->nf_file)
 )
 
-DECLARE_EVENT_CLASS(nfsd_file_search_class,
-	TP_PROTO(
-		const struct inode *inode,
-		unsigned int count
-	),
-	TP_ARGS(inode, count),
-	TP_STRUCT__entry(
-		__field(const struct inode *, inode)
-		__field(unsigned int, count)
-	),
-	TP_fast_assign(
-		__entry->inode = inode;
-		__entry->count = count;
-	),
-	TP_printk("inode=%p count=%u",
-		__entry->inode, __entry->count)
-);
-
-#define DEFINE_NFSD_FILE_SEARCH_EVENT(name)				\
-DEFINE_EVENT(nfsd_file_search_class, name,				\
-	TP_PROTO(							\
-		const struct inode *inode,				\
-		unsigned int count					\
-	),								\
-	TP_ARGS(inode, count))
-
-DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode_sync);
-DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode);
-
 TRACE_EVENT(nfsd_file_is_cached,
 	TP_PROTO(
 		const struct inode *inode,
@@ -1238,6 +1209,22 @@ DEFINE_EVENT(nfsd_file_lruwalk_class, name,				\
 DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_gc_removed);
 DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_shrinker_removed);
 
+TRACE_EVENT(nfsd_file_close,
+	TP_PROTO(
+		const struct inode *inode
+	),
+	TP_ARGS(inode),
+	TP_STRUCT__entry(
+		__field(const void *, inode)
+	),
+	TP_fast_assign(
+		__entry->inode = inode;
+	),
+	TP_printk("inode=%p",
+		__entry->inode
+	)
+);
+
 TRACE_EVENT(nfsd_file_fsync,
 	TP_PROTO(
 		const struct nfsd_file *nf,



  parent reply	other threads:[~2022-11-03 20:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 20:22 [PATCH v1 0/2] A couple of tracepoint updates Chuck Lever
2022-11-03 20:22 ` [PATCH v1 1/2] NFSD: Add an nfsd_file_fsync tracepoint Chuck Lever
2022-11-03 20:22 ` Chuck Lever [this message]
2022-11-04 12:44   ` [PATCH v1 2/2] NFSD: Re-arrange file_close_inode tracepoints Jeff Layton
2022-11-04 13:35     ` Chuck Lever III
2022-11-04 12:45 ` [PATCH v1 0/2] A couple of tracepoint updates Jeff Layton

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=166750697425.1646.11770177003223505657.stgit@klimt.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.