* [PATCH] NFSD: trace export root filehandle event
@ 2024-03-27 15:27 Chen Hanxiao
2024-03-27 16:05 ` Chuck Lever
0 siblings, 1 reply; 3+ messages in thread
From: Chen Hanxiao @ 2024-03-27 15:27 UTC (permalink / raw)
To: Chuck Lever, Jeff Layton, Neil Brown, Olga Kornievskaia, Dai Ngo,
Tom Talpey
Cc: linux-nfs
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] NFSD: trace export root filehandle event
2024-03-27 15:27 [PATCH] NFSD: trace export root filehandle event Chen Hanxiao
@ 2024-03-27 16:05 ` Chuck Lever
2024-03-28 10:55 ` Hanxiao Chen (Fujitsu)
0 siblings, 1 reply; 3+ messages in thread
From: Chuck Lever @ 2024-03-27 16:05 UTC (permalink / raw)
To: Chen Hanxiao
Cc: Jeff Layton, Neil Brown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
linux-nfs
On Wed, Mar 27, 2024 at 11:27:37PM +0800, Chen Hanxiao wrote:
> 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);
Converting the above dprintk to a tracepoint seems sensible.
I'd like to hear comments from others about whether the new
tracepoint records a useful set of information. We don't need to
record the memory address of the dentry, for example. Recording the
net namespace might be useful, though.
> /*
> * 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
>
--
Chuck Lever
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] NFSD: trace export root filehandle event
2024-03-27 16:05 ` Chuck Lever
@ 2024-03-28 10:55 ` Hanxiao Chen (Fujitsu)
0 siblings, 0 replies; 3+ messages in thread
From: Hanxiao Chen (Fujitsu) @ 2024-03-28 10:55 UTC (permalink / raw)
To: Chuck Lever
Cc: Jeff Layton, Neil Brown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
linux-nfs
> -----邮件原件-----
> 发件人: Chuck Lever <chuck.lever@oracle.com>
> 发送时间: 2024年3月28日 0:06
> 收件人: Chen, Hanxia <chenhx.fnst@fujitsu.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>; linux-nfs@vger.kernel.org
> 主题: Re: [PATCH] NFSD: trace export root filehandle event
>
> On Wed, Mar 27, 2024 at 11:27:37PM +0800, Chen Hanxiao wrote:
> > 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);
>
> Converting the above dprintk to a tracepoint seems sensible.
>
> I'd like to hear comments from others about whether the new
> tracepoint records a useful set of information. We don't need to
> record the memory address of the dentry, for example. Recording the
> net namespace might be useful, though.
>
Maybe we cloud record ex_flags too.
Regards,
- Chen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-28 10:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 15:27 [PATCH] NFSD: trace export root filehandle event Chen Hanxiao
2024-03-27 16:05 ` Chuck Lever
2024-03-28 10:55 ` Hanxiao Chen (Fujitsu)
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.