Hi Olga, On Mon, Oct 18, 2021 at 6:05 PM Olga Kornievskaia <olga.kornievskaia@xxxxxxxxx> wrote: > > From: Olga Kornievskaia <kolga@xxxxxxxxxx> > > Add a tracepoint to the SEEK operation. Compiling with CONFIG_NFS_V4_1=y but CONFIG_NFS_V4_2=n gives me the following: In file included from fs/nfs/nfs4trace.h:11, from fs/nfs/nfs4state.c:63: fs/nfs/nfs4trace.h:2432:38: error: ‘struct nfs42_seek_res’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror] 2432 | const struct nfs42_seek_res *res, You probably need to check for CONFIG_NFS_V4_2 inside nfs4trace.h Anna > > Signed-off-by: Olga Kornievskaia <kolga@xxxxxxxxxx> > --- > fs/nfs/nfs42proc.c | 1 + > fs/nfs/nfs4trace.h | 65 ++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 66 insertions(+) > > diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c > index a24349512ffe..87c0dcb8823b 100644 > --- a/fs/nfs/nfs42proc.c > +++ b/fs/nfs/nfs42proc.c > @@ -678,6 +678,7 @@ static loff_t _nfs42_proc_llseek(struct file *filep, > > status = nfs4_call_sync(server->client, server, &msg, > &args.seq_args, &res.seq_res, 0); > + trace_nfs4_llseek(inode, &args, &res, status); > if (status == -ENOTSUPP) > server->caps &= ~NFS_CAP_SEEK; > if (status) > diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h > index 7a2567aa2b86..81dcbfca7f74 100644 > --- a/fs/nfs/nfs4trace.h > +++ b/fs/nfs/nfs4trace.h > @@ -2417,6 +2417,71 @@ TRACE_EVENT(ff_layout_commit_error, > ) > ); > > +TRACE_DEFINE_ENUM(NFS4_CONTENT_DATA); > +TRACE_DEFINE_ENUM(NFS4_CONTENT_HOLE); > + > +#define show_llseek_mode(what) \ > + __print_symbolic(what, \ > + { NFS4_CONTENT_DATA, "DATA" }, \ > + { NFS4_CONTENT_HOLE, "HOLE" }) > + > +TRACE_EVENT(nfs4_llseek, > + TP_PROTO( > + const struct inode *inode, > + const struct nfs42_seek_args *args, > + const struct nfs42_seek_res *res, > + int error > + ), > + > + TP_ARGS(inode, args, res, error), > + > + TP_STRUCT__entry( > + __field(unsigned long, error) > + __field(u32, fhandle) > + __field(u32, fileid) > + __field(dev_t, dev) > + __field(int, stateid_seq) > + __field(u32, stateid_hash) > + __field(loff_t, offset_s) > + __field(u32, what) > + __field(loff_t, offset_r) > + __field(u32, eof) > + ), > + > + TP_fast_assign( > + const struct nfs_inode *nfsi = NFS_I(inode); > + const struct nfs_fh *fh = args->sa_fh; > + > + __entry->fileid = nfsi->fileid; > + __entry->dev = inode->i_sb->s_dev; > + __entry->fhandle = nfs_fhandle_hash(fh); > + __entry->offset_s = args->sa_offset; > + __entry->error = error < 0 ? -error : 0; > + __entry->stateid_seq = > + be32_to_cpu(args->sa_stateid.seqid); > + __entry->stateid_hash = > + nfs_stateid_hash(&args->sa_stateid); > + __entry->what = args->sa_what; > + __entry->offset_r = error < 0 ? 0 : res->sr_offset; > + __entry->eof = error < 0 ? 0 : res->sr_eof; > + ), > + > + TP_printk( > + "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " > + "stateid=%d:0x%08x offset_s=%llu what=%s " > + "offset_r=%llu eof=%u", > + -__entry->error, > + show_nfsv4_errors(__entry->error), > + MAJOR(__entry->dev), MINOR(__entry->dev), > + (unsigned long long)__entry->fileid, > + __entry->fhandle, > + __entry->stateid_seq, __entry->stateid_hash, > + __entry->offset_s, > + show_llseek_mode(__entry->what), > + __entry->offset_r, > + __entry->eof > + ) > +); > > #endif /* CONFIG_NFS_V4_1 */ > > -- > 2.27.0 >