Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>, Neil Brown <neilb@suse.de>,
	 Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <Dai.Ngo@oracle.com>,  Tom Talpey <tom@talpey.com>,
	Trond Myklebust <trondmy@kernel.org>,
	 Anna Schumaker <anna@kernel.org>
Cc: Sargun Dillon <sargun@sargun.me>,
	linux-nfs@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Jeff Layton <jlayton@kernel.org>
Subject: [PATCH v2 08/12] nfsd: add tracepoints for hardlink events
Date: Wed, 09 Apr 2025 10:32:30 -0400	[thread overview]
Message-ID: <20250409-nfsd-tracepoints-v2-8-cf4e084fdd9c@kernel.org> (raw)
In-Reply-To: <20250409-nfsd-tracepoints-v2-0-cf4e084fdd9c@kernel.org>

...and remove the legacy dprintks.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfsd/nfs3proc.c |  7 +------
 fs/nfsd/nfs4proc.c |  3 +++
 fs/nfsd/nfsproc.c  |  7 +------
 fs/nfsd/trace.h    | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 587fc92597e7c77d078e871b8d12684c6b5efa2d..97aaf98d0af7dc565b21937ecca4852dd9253221 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -564,12 +564,7 @@ nfsd3_proc_link(struct svc_rqst *rqstp)
 	struct nfsd3_linkargs *argp = rqstp->rq_argp;
 	struct nfsd3_linkres  *resp = rqstp->rq_resp;
 
-	dprintk("nfsd: LINK(3)     %s ->\n",
-				SVCFH_fmt(&argp->ffh));
-	dprintk("nfsd:   -> %s %.*s\n",
-				SVCFH_fmt(&argp->tfh),
-				argp->tlen,
-				argp->tname);
+	trace_nfsd_proc_link(rqstp, &argp->ffh, &argp->tfh, argp->tname, argp->tlen);
 
 	fh_copy(&resp->fh,  &argp->ffh);
 	fh_copy(&resp->tfh, &argp->tfh);
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index e22596a2e311861be1e4f595d77547be04634ce7..7dffae2f16d9fa8dea043b7bf300eaca52c0aa7c 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -977,6 +977,9 @@ nfsd4_link(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	struct nfsd4_link *link = &u->link;
 	__be32 status;
 
+	trace_nfsd4_link(rqstp, &cstate->save_fh, &cstate->current_fh,
+			 link->li_name, link->li_namelen);
+
 	status = nfsd_link(rqstp, &cstate->current_fh,
 			   link->li_name, link->li_namelen, &cstate->save_fh);
 	if (!status)
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 0674ed6b978f6caa1325a9271f2fde9b3ef60945..b40b5ab1d3b17dd8974fcaeda3ac7c26baee67cf 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -481,12 +481,7 @@ nfsd_proc_link(struct svc_rqst *rqstp)
 	struct nfsd_linkargs *argp = rqstp->rq_argp;
 	struct nfsd_stat *resp = rqstp->rq_resp;
 
-	dprintk("nfsd: LINK     %s ->\n",
-		SVCFH_fmt(&argp->ffh));
-	dprintk("nfsd:    %s %.*s\n",
-		SVCFH_fmt(&argp->tfh),
-		argp->tlen,
-		argp->tname);
+	trace_nfsd_proc_link(rqstp, &argp->ffh, &argp->tfh, argp->tname, argp->tlen);
 
 	resp->status = nfsd_link(rqstp, &argp->tfh, argp->tname, argp->tlen,
 				 &argp->ffh);
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 850dbf1240b234b67dd7d75d6903c0f49dc01261..9ff919a08f424bfe023cf91244fe08effbdf993e 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -2465,6 +2465,41 @@ DECLARE_EVENT_CLASS(nfsd_vfs_symlink_class,
 DEFINE_NFSD_VFS_SYMLINK_EVENT(nfsd_proc_symlink);
 DEFINE_NFSD_VFS_SYMLINK_EVENT(nfsd3_proc_symlink);
 DEFINE_NFSD_VFS_SYMLINK_EVENT(nfsd4_symlink);
+
+DECLARE_EVENT_CLASS(nfsd_vfs_link_class,
+	TP_PROTO(struct svc_rqst *rqstp,
+		 struct svc_fh *sfhp,
+		 struct svc_fh *tfhp,
+		 const char *name,
+		 unsigned int namelen),
+	TP_ARGS(rqstp, sfhp, tfhp, name, namelen),
+	TP_STRUCT__entry(
+		SVC_RQST_ENDPOINT_FIELDS(rqstp)
+		__field(u32, sfh_hash)
+		__field(u32, tfh_hash)
+		__string_len(name, name, namelen)
+	),
+	TP_fast_assign(
+		SVC_RQST_ENDPOINT_ASSIGNMENTS(rqstp);
+		__entry->sfh_hash = knfsd_fh_hash(&sfhp->fh_handle);
+		__entry->tfh_hash = knfsd_fh_hash(&tfhp->fh_handle);
+		__assign_str(name);
+	),
+	TP_printk("xid=0x%08x src_fh=0x%08x tgt_fh=0x%08x name=%s",
+		  __entry->xid, __entry->sfh_hash, __entry->tfh_hash,
+		  __get_str(name))
+);
+
+#define DEFINE_NFSD_VFS_LINK_EVENT(__name)					\
+	DEFINE_EVENT(nfsd_vfs_link_class, __name,				\
+		     TP_PROTO(struct svc_rqst *rqstp, struct svc_fh *sfhp,	\
+			      struct svc_fh *tfhp, const char *name,		\
+			      unsigned int namelen),				\
+		     TP_ARGS(rqstp, sfhp, tfhp, name, namelen))
+
+DEFINE_NFSD_VFS_LINK_EVENT(nfsd_proc_link);
+DEFINE_NFSD_VFS_LINK_EVENT(nfsd3_proc_link);
+DEFINE_NFSD_VFS_LINK_EVENT(nfsd4_link);
 #endif /* _NFSD_TRACE_H */
 
 #undef TRACE_INCLUDE_PATH

-- 
2.49.0


  parent reply	other threads:[~2025-04-09 14:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 14:32 [PATCH v2 00/12] nfsd: observability improvements Jeff Layton
2025-04-09 14:32 ` [PATCH v2 01/12] nfsd: add commit start/done tracepoints around nfsd_commit() Jeff Layton
2025-04-09 14:32 ` [PATCH v2 02/12] sunrpc: add info about xprt queue times to svc_xprt_dequeue tracepoint Jeff Layton
2025-04-09 15:00   ` Chuck Lever
2025-04-09 15:26     ` Jeff Layton
2025-04-11 13:10       ` Jeff Layton
2025-04-11 13:24         ` Chuck Lever
2025-04-11 13:40           ` Jeff Layton
2025-04-09 14:32 ` [PATCH v2 03/12] sunrpc: move the SVC_RQST_EVENT_*() macros to common header Jeff Layton
2025-04-09 14:32 ` [PATCH v2 04/12] nfsd: add a tracepoint for nfsd_setattr Jeff Layton
2025-04-09 15:03   ` Chuck Lever
2025-04-09 14:32 ` [PATCH v2 05/12] nfsd: add a tracepoint to nfsd_lookup_dentry Jeff Layton
2025-04-09 14:32 ` [PATCH v2 06/12] nfsd: add tracepoints around nfsd_create events Jeff Layton
2025-04-09 15:09   ` Chuck Lever
2025-04-09 15:36     ` Jeff Layton
2025-04-09 15:38       ` Chuck Lever
2025-04-09 15:40         ` Chuck Lever
2025-04-09 16:50     ` Jeff Layton
2025-04-09 16:59       ` Chuck Lever
2025-04-09 14:32 ` [PATCH v2 07/12] nfsd: add tracepoints for symlink events Jeff Layton
2025-04-09 15:15   ` Chuck Lever
2025-04-09 14:32 ` Jeff Layton [this message]
2025-04-09 14:32 ` [PATCH v2 09/12] nfsd: add tracepoints for unlink events Jeff Layton
2025-04-09 14:32 ` [PATCH v2 10/12] nfsd: add tracepoints to rename events Jeff Layton
2025-04-09 14:32 ` [PATCH v2 11/12] nfsd: add tracepoints for readdir events Jeff Layton
2025-04-09 14:32 ` [PATCH v2 12/12] nfsd: add tracepoint for getattr events Jeff Layton
2025-04-11 14:52 ` (subset) [PATCH v2 00/12] nfsd: observability improvements cel

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=20250409-nfsd-tracepoints-v2-8-cf4e084fdd9c@kernel.org \
    --to=jlayton@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=anna@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=okorniev@redhat.com \
    --cc=sargun@sargun.me \
    --cc=tom@talpey.com \
    --cc=trondmy@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox