Linux-NFS Archive mirror
 help / color / mirror / Atom feed
From: Chen Hanxiao <chenhx.fnst@fujitsu.com>
To: Chuck Lever <chuck.lever@oracle.com>,
	Jeff Layton <jlayton@kernel.org>, Neil Brown <neilb@suse.de>,
	Olga Kornievskaia <kolga@netapp.com>,
	Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] NFSD: trace export root filehandle event
Date: Wed, 27 Mar 2024 23:27:37 +0800	[thread overview]
Message-ID: <20240327152737.1411-1-chenhx.fnst@fujitsu.com> (raw)

Add a tracepoint for obtaining root filehandle event

Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
---
 fs/nfsd/export.c |  4 +---
 fs/nfsd/trace.h  | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 7b641095a665..690721ba42f3 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1027,15 +1027,13 @@ exp_rootfh(struct net *net, struct auth_domain *clp, char *name,
 	}
 	inode = d_inode(path.dentry);
 
-	dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
-		 name, path.dentry, clp->name,
-		 inode->i_sb->s_id, inode->i_ino);
 	exp = exp_parent(cd, clp, &path);
 	if (IS_ERR(exp)) {
 		err = PTR_ERR(exp);
 		goto out;
 	}
 
+	trace_nfsd_exp_rootfh(name, path.dentry, clp->name, inode, exp);
 	/*
 	 * fh must be initialized before calling fh_compose
 	 */
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 1cd2076210b1..a11b348f5d6d 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -396,6 +396,45 @@ TRACE_EVENT(nfsd_export_update,
 	)
 );
 
+TRACE_EVENT(nfsd_exp_rootfh,
+	TP_PROTO(
+		const char *name,
+		const struct dentry *dentry,
+		const char *clp_name,
+		const struct inode *inode,
+		struct svc_export *exp
+		),
+	TP_ARGS(name, dentry, clp_name, inode, exp),
+	TP_STRUCT__entry(
+		__string(name, name)
+		__field(const void *, dentry)
+		__string(clp_name, clp_name)
+		__string(s_id, inode->i_sb->s_id)
+		__field(unsigned long, i_ino)
+		__array(unsigned char, uuid, 16)
+		__field(const void *, ex_uuid)
+	),
+	TP_fast_assign(
+		__assign_str(name, name);
+		__entry->dentry = dentry;
+		__assign_str(clp_name, clp_name);
+		__assign_str(s_id, inode->i_sb->s_id);
+		__entry->i_ino = inode->i_ino;
+		__entry->ex_uuid = exp->ex_uuid;
+		if (exp->ex_uuid)
+			memcpy(__entry->uuid, exp->ex_uuid, 16);
+	),
+	TP_printk(
+		"path=%s dentry=%p domain=%s sid=%s/inode=%ld uuid=%s",
+		__get_str(name),
+		__entry->dentry,
+		__get_str(clp_name),
+		__get_str(s_id),
+		__entry->i_ino,
+		__entry->ex_uuid ? __print_hex_str(__entry->uuid, 16) : "NULL"
+	)
+);
+
 DECLARE_EVENT_CLASS(nfsd_io_class,
 	TP_PROTO(struct svc_rqst *rqstp,
 		 struct svc_fh	*fhp,
-- 
2.39.1


             reply	other threads:[~2024-03-27 15:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 15:27 Chen Hanxiao [this message]
2024-03-27 16:05 ` [PATCH] NFSD: trace export root filehandle event Chuck Lever
2024-03-28 10:55   ` Hanxiao Chen (Fujitsu)

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=20240327152737.1411-1-chenhx.fnst@fujitsu.com \
    --to=chenhx.fnst@fujitsu.com \
    --cc=Dai.Ngo@oracle.com \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=kolga@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=tom@talpey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).