Re: [PATCH RFC 09/21] NFSD: Add an nfsd_cb_offload tracepoint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On May 14, 2021, at 2:22 PM, Olga Kornievskaia <aglo@xxxxxxxxx> wrote:
> 
> Hi Chuck,
> 
> On Mon, May 10, 2021 at 12:05 PM Chuck Lever <chuck.lever@xxxxxxxxxx> wrote:
>> 
>> Record the arguments of CB_OFFLOAD callbacks so we can better
>> observe asynchronous copy-offload behavior. For example:
>> 
>>            nfsd-995   [008]  7721.934222: nfsd_cb_offload:      addr=192.168.2.51:0 client 6092a47c:35a43fc1 fh_hash=0x8739113a
> 
> I like the idea but can we include copy->nfserr if there is one and/or
> if not then size copied?

Yes. How about recording both copy->nfserr _and_ copy->cp_count ?

Unfortunately struct nfsd4_copy is defined in a header that
cannot be included everywhere, so I have to pass all of these
in as separate arguments. Should be OK, this isn't a
performance-critical path.


>> Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
>> Cc: Olga Kornievskaia <kolga@xxxxxxxxxx>
>> Cc: Dai Ngo <Dai.Ngo@xxxxxxxxxx>
>> ---
>> fs/nfsd/nfs4proc.c |    1 +
>> fs/nfsd/trace.h    |   30 ++++++++++++++++++++++++++++++
>> 2 files changed, 31 insertions(+)
>> 
>> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
>> index daf43b980d4b..7a13f6c848c6 100644
>> --- a/fs/nfsd/nfs4proc.c
>> +++ b/fs/nfsd/nfs4proc.c
>> @@ -1497,6 +1497,7 @@ static int nfsd4_do_async_copy(void *data)
>>        memcpy(&cb_copy->fh, &copy->fh, sizeof(copy->fh));
>>        nfsd4_init_cb(&cb_copy->cp_cb, cb_copy->cp_clp,
>>                        &nfsd4_cb_offload_ops, NFSPROC4_CLNT_CB_OFFLOAD);
>> +       trace_nfsd_cb_offload(copy->cp_clp, &copy->cp_res.cb_stateid, &copy->fh);
>>        nfsd4_run_cb(&cb_copy->cp_cb);
>> out:
>>        if (!copy->cp_intra)
>> diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
>> index 1dce41b3bd4d..15cacbdac411 100644
>> --- a/fs/nfsd/trace.h
>> +++ b/fs/nfsd/trace.h
>> @@ -1004,6 +1004,36 @@ TRACE_EVENT(nfsd_cb_notify_lock,
>>                __entry->fh_hash)
>> );
>> 
>> +TRACE_EVENT(nfsd_cb_offload,
>> +       TP_PROTO(
>> +               const struct nfs4_client *clp,
>> +               const stateid_t *stp,
>> +               const struct knfsd_fh *fh
>> +       ),
>> +       TP_ARGS(clp, stp, fh),
>> +       TP_STRUCT__entry(
>> +               __field(u32, cl_boot)
>> +               __field(u32, cl_id)
>> +               __field(u32, si_id)
>> +               __field(u32, si_generation)
>> +               __field(u32, fh_hash)
>> +               __array(unsigned char, addr, sizeof(struct sockaddr_in6))
>> +       ),
>> +       TP_fast_assign(
>> +               __entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
>> +               __entry->cl_id = stp->si_opaque.so_clid.cl_id;
>> +               __entry->si_id = stp->si_opaque.so_id;
>> +               __entry->si_generation = stp->si_generation;
>> +               __entry->fh_hash = knfsd_fh_hash(fh);
>> +               memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
>> +                       sizeof(struct sockaddr_in6));
>> +       ),
>> +       TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x fh_hash=0x%08x",
>> +               __entry->addr, __entry->cl_boot, __entry->cl_id,
>> +               __entry->si_id, __entry->si_generation,
>> +               __entry->fh_hash)
>> +);
>> +
>> #endif /* _NFSD_TRACE_H */
>> 
>> #undef TRACE_INCLUDE_PATH
>> 
>> 

--
Chuck Lever







[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux