* [PATCH] NFSv4: add tracepoint to referral events
@ 2024-04-08 9:50 Chen Hanxiao
2024-04-09 13:26 ` Anna Schumaker
0 siblings, 1 reply; 3+ messages in thread
From: Chen Hanxiao @ 2024-04-08 9:50 UTC (permalink / raw
To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs
Trace new locations when hitting a referral.
Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
---
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..165c4dc7b5c7 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)e
+ __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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] NFSv4: add tracepoint to referral events
2024-04-08 9:50 [PATCH] NFSv4: add tracepoint to referral events Chen Hanxiao
@ 2024-04-09 13:26 ` Anna Schumaker
2024-04-09 14:58 ` Hanxiao Chen (Fujitsu)
0 siblings, 1 reply; 3+ messages in thread
From: Anna Schumaker @ 2024-04-09 13:26 UTC (permalink / raw
To: Chen Hanxiao; +Cc: Trond Myklebust, linux-nfs
Hi Chen,
On Mon, Apr 8, 2024 at 5:52 AM Chen Hanxiao <chenhx.fnst@fujitsu.com> wrote:
>
> Trace new locations when hitting a referral.
>
> Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
> ---
> 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..165c4dc7b5c7 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)e
^^^^^^^
I wanted to double check if you've compiled and tested this? I ask
because the 'e' at the end of the line here should be a semicolon,
which my compiler complains about.
Thanks,
Anna
> + __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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] NFSv4: add tracepoint to referral events
2024-04-09 13:26 ` Anna Schumaker
@ 2024-04-09 14:58 ` Hanxiao Chen (Fujitsu)
0 siblings, 0 replies; 3+ messages in thread
From: Hanxiao Chen (Fujitsu) @ 2024-04-09 14:58 UTC (permalink / raw
To: Anna Schumaker; +Cc: Trond Myklebust, linux-nfs@vger.kernel.org
> -----邮件原件-----
> 发件人: Anna Schumaker <anna@kernel.org>
> 发送时间: 2024年4月9日 21:26
> 收件人: Chen, Hanxiao <chenhx.fnst@fujitsu.com>
> 抄送: Trond Myklebust <trond.myklebust@hammerspace.com>;
> linux-nfs@vger.kernel.org
> 主题: Re: [PATCH] NFSv4: add tracepoint to referral events
>
> Hi Chen,
>
> On Mon, Apr 8, 2024 at 5:52 AM Chen Hanxiao <chenhx.fnst@fujitsu.com>
> wrote:
> >
> > Trace new locations when hitting a referral.
> >
> > Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
> > ---
> > 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..165c4dc7b5c7 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)e
>
> ^^^^^^^
> I wanted to double check if you've compiled and tested this? I ask
> because the 'e' at the end of the line here should be a semicolon,
> which my compiler complains about.
>
My fault.
./scripts/checkpatch.pl give a "Whitespace errors detected",
then I edit the patch file in place……
The test log is:
mount.nfs-4783 [005] ..... 62738.666580: nfs4_referral_location: referral_host=192.168.122.210 referral_path=/share12
mount.nfs-4783 [005] ..... 62738.728047: nfs4_referral_location: referral_host=192.168.122.208 referral_path=/share13
Sorry for the noise, I'll NEVER edit patch file without compiling.
I'll send a v2 soon.
Regards,
- Chen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-09 14:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-08 9:50 [PATCH] NFSv4: add tracepoint to referral events Chen Hanxiao
2024-04-09 13:26 ` Anna Schumaker
2024-04-09 14:58 ` Hanxiao Chen (Fujitsu)
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).