From: Chen Hanxiao <chenhx.fnst@fujitsu.com>
To: Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v2] NFSv4: add tracepoint to referral events
Date: Tue, 9 Apr 2024 23:04:27 +0800 [thread overview]
Message-ID: <20240409150427.463-1-chenhx.fnst@fujitsu.com> (raw)
Trace new locations when hitting a referral.
Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
---
v2:
fix a fat-finger typo
fs/nfs/nfs4namespace.c | 3 +++
fs/nfs/nfs4trace.h | 25 +++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 9a98595bb160..fca9fb801bc2 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -24,6 +24,7 @@
#include "nfs4_fs.h"
#include "nfs.h"
#include "dns_resolve.h"
+#include "nfs4trace.h"
#define NFSDBG_FACILITY NFSDBG_VFS
@@ -351,6 +352,8 @@ static int try_location(struct fs_context *fc,
p += ctx->nfs_server.export_path_len;
*p = 0;
+ trace_nfs4_referral_location(ctx->nfs_server.hostname,
+ ctx->nfs_server.export_path);
ret = nfs4_get_referral_tree(fc);
if (ret == 0)
return 0;
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 10985a4b8259..d9e3e6560cb9 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -2604,6 +2604,31 @@ DEFINE_NFS4_XATTR_EVENT(nfs4_setxattr);
DEFINE_NFS4_XATTR_EVENT(nfs4_removexattr);
DEFINE_NFS4_INODE_EVENT(nfs4_listxattr);
+
+TRACE_EVENT(nfs4_referral_location,
+ TP_PROTO(
+ const char *hostname,
+ const char *path
+ ),
+
+ TP_ARGS(hostname, path),
+
+ TP_STRUCT__entry(
+ __string(referral_hostname, hostname)
+ __string(referral_path, path)
+ ),
+
+ TP_fast_assign(
+ __assign_str(referral_hostname, hostname);
+ __assign_str(referral_path, path);
+ ),
+
+ TP_printk(
+ "referral_host=%s referral_path=%s",
+ __get_str(referral_hostname),
+ __get_str(referral_path)
+ )
+);
#endif /* CONFIG_NFS_V4_2 */
#endif /* CONFIG_NFS_V4_1 */
--
2.39.1
reply other threads:[~2024-04-09 15:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240409150427.463-1-chenhx.fnst@fujitsu.com \
--to=chenhx.fnst@fujitsu.com \
--cc=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@hammerspace.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 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.