Skip to content

Commit 638593b

Browse files
daimngoChuck Lever
authored andcommitted
NFSD: add CB_RECALL_ANY tracepoints
Add tracepoints to trace start and end of CB_RECALL_ANY operation. Signed-off-by: Dai Ngo <[email protected]> [ cel: added show_rca_mask() macro ] Signed-off-by: Chuck Lever <[email protected]>
1 parent 44df6f4 commit 638593b

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

fs/nfsd/nfs4state.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2876,6 +2876,7 @@ static int
28762876
nfsd4_cb_recall_any_done(struct nfsd4_callback *cb,
28772877
struct rpc_task *task)
28782878
{
2879+
trace_nfsd_cb_recall_any_done(cb, task);
28792880
switch (task->tk_status) {
28802881
case -NFS4ERR_DELAY:
28812882
rpc_delay(task, 2 * HZ);
@@ -6234,6 +6235,7 @@ deleg_reaper(struct nfsd_net *nn)
62346235
list_del_init(&clp->cl_ra_cblist);
62356236
clp->cl_ra->ra_keep = 0;
62366237
clp->cl_ra->ra_bmval[0] = BIT(RCA4_TYPE_MASK_RDATA_DLG);
6238+
trace_nfsd_cb_recall_any(clp->cl_ra);
62376239
nfsd4_run_cb(&clp->cl_ra->ra_cb);
62386240
}
62396241
}

fs/nfsd/trace.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
#define _NFSD_TRACE_H
1010

1111
#include <linux/tracepoint.h>
12+
#include <linux/sunrpc/xprt.h>
13+
#include <trace/misc/nfs.h>
1214

1315
#include "export.h"
1416
#include "nfsfh.h"
17+
#include "xdr4.h"
1518

1619
#define NFSD_TRACE_PROC_RES_FIELDS \
1720
__field(unsigned int, netns_ino) \
@@ -1562,6 +1565,32 @@ TRACE_EVENT(nfsd_cb_offload,
15621565
__entry->fh_hash, __entry->count, __entry->status)
15631566
);
15641567

1568+
TRACE_EVENT(nfsd_cb_recall_any,
1569+
TP_PROTO(
1570+
const struct nfsd4_cb_recall_any *ra
1571+
),
1572+
TP_ARGS(ra),
1573+
TP_STRUCT__entry(
1574+
__field(u32, cl_boot)
1575+
__field(u32, cl_id)
1576+
__field(u32, keep)
1577+
__field(unsigned long, bmval0)
1578+
__sockaddr(addr, ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen)
1579+
),
1580+
TP_fast_assign(
1581+
__entry->cl_boot = ra->ra_cb.cb_clp->cl_clientid.cl_boot;
1582+
__entry->cl_id = ra->ra_cb.cb_clp->cl_clientid.cl_id;
1583+
__entry->keep = ra->ra_keep;
1584+
__entry->bmval0 = ra->ra_bmval[0];
1585+
__assign_sockaddr(addr, &ra->ra_cb.cb_clp->cl_addr,
1586+
ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen);
1587+
),
1588+
TP_printk("addr=%pISpc client %08x:%08x keep=%u bmval0=%s",
1589+
__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1590+
__entry->keep, show_rca_mask(__entry->bmval0)
1591+
)
1592+
);
1593+
15651594
DECLARE_EVENT_CLASS(nfsd_cb_done_class,
15661595
TP_PROTO(
15671596
const stateid_t *stp,
@@ -1601,6 +1630,27 @@ DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_notify_lock_done);
16011630
DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_layout_done);
16021631
DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_offload_done);
16031632

1633+
TRACE_EVENT(nfsd_cb_recall_any_done,
1634+
TP_PROTO(
1635+
const struct nfsd4_callback *cb,
1636+
const struct rpc_task *task
1637+
),
1638+
TP_ARGS(cb, task),
1639+
TP_STRUCT__entry(
1640+
__field(u32, cl_boot)
1641+
__field(u32, cl_id)
1642+
__field(int, status)
1643+
),
1644+
TP_fast_assign(
1645+
__entry->status = task->tk_status;
1646+
__entry->cl_boot = cb->cb_clp->cl_clientid.cl_boot;
1647+
__entry->cl_id = cb->cb_clp->cl_clientid.cl_id;
1648+
),
1649+
TP_printk("client %08x:%08x status=%d",
1650+
__entry->cl_boot, __entry->cl_id, __entry->status
1651+
)
1652+
);
1653+
16041654
#endif /* _NFSD_TRACE_H */
16051655

16061656
#undef TRACE_INCLUDE_PATH

include/trace/misc/nfs.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,18 @@ TRACE_DEFINE_ENUM(IOMODE_ANY);
360360
{ IOMODE_RW, "RW" }, \
361361
{ IOMODE_ANY, "ANY" })
362362

363+
#define show_rca_mask(x) \
364+
__print_flags(x, "|", \
365+
{ BIT(RCA4_TYPE_MASK_RDATA_DLG), "RDATA_DLG" }, \
366+
{ BIT(RCA4_TYPE_MASK_WDATA_DLG), "WDATA_DLG" }, \
367+
{ BIT(RCA4_TYPE_MASK_DIR_DLG), "DIR_DLG" }, \
368+
{ BIT(RCA4_TYPE_MASK_FILE_LAYOUT), "FILE_LAYOUT" }, \
369+
{ BIT(RCA4_TYPE_MASK_BLK_LAYOUT), "BLK_LAYOUT" }, \
370+
{ BIT(RCA4_TYPE_MASK_OBJ_LAYOUT_MIN), "OBJ_LAYOUT_MIN" }, \
371+
{ BIT(RCA4_TYPE_MASK_OBJ_LAYOUT_MAX), "OBJ_LAYOUT_MAX" }, \
372+
{ BIT(RCA4_TYPE_MASK_OTHER_LAYOUT_MIN), "OTHER_LAYOUT_MIN" }, \
373+
{ BIT(RCA4_TYPE_MASK_OTHER_LAYOUT_MAX), "OTHER_LAYOUT_MAX" })
374+
363375
#define show_nfs4_seq4_status(x) \
364376
__print_flags(x, "|", \
365377
{ SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \

0 commit comments

Comments
 (0)