Skip to content

Commit 0d885f7

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: add tracepoint for getattr and statfs events
There isn't a common helper for getattrs, so add these into the protocol-specific helpers. Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent a91bfc4 commit 0d885f7

5 files changed

Lines changed: 38 additions & 0 deletions

File tree

fs/nfsd/nfs3proc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp)
7070
struct nfsd_fhandle *argp = rqstp->rq_argp;
7171
struct nfsd3_attrstat *resp = rqstp->rq_resp;
7272

73+
trace_nfsd_vfs_getattr(rqstp, &argp->fh);
74+
7375
dprintk("nfsd: GETATTR(3) %s\n",
7476
SVCFH_fmt(&argp->fh));
7577

fs/nfsd/nfs4proc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,8 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
876876
struct nfsd4_getattr *getattr = &u->getattr;
877877
__be32 status;
878878

879+
trace_nfsd_vfs_getattr(rqstp, &cstate->current_fh);
880+
879881
status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
880882
if (status)
881883
return status;

fs/nfsd/nfsproc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ nfsd_proc_getattr(struct svc_rqst *rqstp)
5555
struct nfsd_fhandle *argp = rqstp->rq_argp;
5656
struct nfsd_attrstat *resp = rqstp->rq_resp;
5757

58+
trace_nfsd_vfs_getattr(rqstp, &argp->fh);
59+
5860
dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
5961

6062
fh_copy(&resp->fh, &argp->fh);

fs/nfsd/trace.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,6 +2579,36 @@ TRACE_EVENT(nfsd_vfs_readdir,
25792579
)
25802580
);
25812581

2582+
DECLARE_EVENT_CLASS(nfsd_vfs_getattr_class,
2583+
TP_PROTO(
2584+
const struct svc_rqst *rqstp,
2585+
const struct svc_fh *fhp
2586+
),
2587+
TP_ARGS(rqstp, fhp),
2588+
TP_STRUCT__entry(
2589+
NFSD_TRACE_PROC_CALL_FIELDS(rqstp)
2590+
__field(u32, fh_hash)
2591+
),
2592+
TP_fast_assign(
2593+
NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp);
2594+
__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
2595+
),
2596+
TP_printk("xid=0x%08x fh_hash=0x%08x",
2597+
__entry->xid, __entry->fh_hash
2598+
)
2599+
);
2600+
2601+
#define DEFINE_NFSD_VFS_GETATTR_EVENT(__name) \
2602+
DEFINE_EVENT(nfsd_vfs_getattr_class, __name, \
2603+
TP_PROTO( \
2604+
const struct svc_rqst *rqstp, \
2605+
const struct svc_fh *fhp \
2606+
), \
2607+
TP_ARGS(rqstp, fhp))
2608+
2609+
DEFINE_NFSD_VFS_GETATTR_EVENT(nfsd_vfs_getattr);
2610+
DEFINE_NFSD_VFS_GETATTR_EVENT(nfsd_vfs_statfs);
2611+
25822612
#endif /* _NFSD_TRACE_H */
25832613

25842614
#undef TRACE_INCLUDE_PATH

fs/nfsd/vfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,8 @@ nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat, in
22902290
{
22912291
__be32 err;
22922292

2293+
trace_nfsd_vfs_statfs(rqstp, fhp);
2294+
22932295
err = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP | access);
22942296
if (!err) {
22952297
struct path path = {

0 commit comments

Comments
 (0)