NFSD: add CB_RECALL_ANY tracepoints

Add tracepoints to trace start and end of CB_RECALL_ANY operation.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
[ cel: added show_rca_mask() macro ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
Dai Ngo 2022-11-16 19:44:48 -08:00 committed by Chuck Lever
parent 44df6f439a
commit 638593be55
3 changed files with 64 additions and 0 deletions

View File

@ -2876,6 +2876,7 @@ static int
nfsd4_cb_recall_any_done(struct nfsd4_callback *cb,
struct rpc_task *task)
{
trace_nfsd_cb_recall_any_done(cb, task);
switch (task->tk_status) {
case -NFS4ERR_DELAY:
rpc_delay(task, 2 * HZ);
@ -6234,6 +6235,7 @@ deleg_reaper(struct nfsd_net *nn)
list_del_init(&clp->cl_ra_cblist);
clp->cl_ra->ra_keep = 0;
clp->cl_ra->ra_bmval[0] = BIT(RCA4_TYPE_MASK_RDATA_DLG);
trace_nfsd_cb_recall_any(clp->cl_ra);
nfsd4_run_cb(&clp->cl_ra->ra_cb);
}
}

View File

@ -9,9 +9,12 @@
#define _NFSD_TRACE_H
#include <linux/tracepoint.h>
#include <linux/sunrpc/xprt.h>
#include <trace/misc/nfs.h>
#include "export.h"
#include "nfsfh.h"
#include "xdr4.h"
#define NFSD_TRACE_PROC_RES_FIELDS \
__field(unsigned int, netns_ino) \
@ -1562,6 +1565,32 @@ TRACE_EVENT(nfsd_cb_offload,
__entry->fh_hash, __entry->count, __entry->status)
);
TRACE_EVENT(nfsd_cb_recall_any,
TP_PROTO(
const struct nfsd4_cb_recall_any *ra
),
TP_ARGS(ra),
TP_STRUCT__entry(
__field(u32, cl_boot)
__field(u32, cl_id)
__field(u32, keep)
__field(unsigned long, bmval0)
__sockaddr(addr, ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen)
),
TP_fast_assign(
__entry->cl_boot = ra->ra_cb.cb_clp->cl_clientid.cl_boot;
__entry->cl_id = ra->ra_cb.cb_clp->cl_clientid.cl_id;
__entry->keep = ra->ra_keep;
__entry->bmval0 = ra->ra_bmval[0];
__assign_sockaddr(addr, &ra->ra_cb.cb_clp->cl_addr,
ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen);
),
TP_printk("addr=%pISpc client %08x:%08x keep=%u bmval0=%s",
__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
__entry->keep, show_rca_mask(__entry->bmval0)
)
);
DECLARE_EVENT_CLASS(nfsd_cb_done_class,
TP_PROTO(
const stateid_t *stp,
@ -1601,6 +1630,27 @@ DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_notify_lock_done);
DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_layout_done);
DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_offload_done);
TRACE_EVENT(nfsd_cb_recall_any_done,
TP_PROTO(
const struct nfsd4_callback *cb,
const struct rpc_task *task
),
TP_ARGS(cb, task),
TP_STRUCT__entry(
__field(u32, cl_boot)
__field(u32, cl_id)
__field(int, status)
),
TP_fast_assign(
__entry->status = task->tk_status;
__entry->cl_boot = cb->cb_clp->cl_clientid.cl_boot;
__entry->cl_id = cb->cb_clp->cl_clientid.cl_id;
),
TP_printk("client %08x:%08x status=%d",
__entry->cl_boot, __entry->cl_id, __entry->status
)
);
#endif /* _NFSD_TRACE_H */
#undef TRACE_INCLUDE_PATH

View File

@ -360,6 +360,18 @@ TRACE_DEFINE_ENUM(IOMODE_ANY);
{ IOMODE_RW, "RW" }, \
{ IOMODE_ANY, "ANY" })
#define show_rca_mask(x) \
__print_flags(x, "|", \
{ BIT(RCA4_TYPE_MASK_RDATA_DLG), "RDATA_DLG" }, \
{ BIT(RCA4_TYPE_MASK_WDATA_DLG), "WDATA_DLG" }, \
{ BIT(RCA4_TYPE_MASK_DIR_DLG), "DIR_DLG" }, \
{ BIT(RCA4_TYPE_MASK_FILE_LAYOUT), "FILE_LAYOUT" }, \
{ BIT(RCA4_TYPE_MASK_BLK_LAYOUT), "BLK_LAYOUT" }, \
{ BIT(RCA4_TYPE_MASK_OBJ_LAYOUT_MIN), "OBJ_LAYOUT_MIN" }, \
{ BIT(RCA4_TYPE_MASK_OBJ_LAYOUT_MAX), "OBJ_LAYOUT_MAX" }, \
{ BIT(RCA4_TYPE_MASK_OTHER_LAYOUT_MIN), "OTHER_LAYOUT_MIN" }, \
{ BIT(RCA4_TYPE_MASK_OTHER_LAYOUT_MAX), "OTHER_LAYOUT_MAX" })
#define show_nfs4_seq4_status(x) \
__print_flags(x, "|", \
{ SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \