Commit cc0175c1 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

SUNRPC: display human-readable procedure name in rpc_iostats output

Add fields to the rpc_procinfo struct that allow the display of a
human-readable name for each procedure in the rpc_iostats output.

Also fix it so that the NFSv4 stats are broken up correctly by
sub-procedure number.  NFSv4 uses only two real RPC procedures:
NULL, and COMPOUND.

Test plan:
Mount with NFSv2, NFSv3, and NFSv4, and do "cat /proc/self/mountstats".
Signed-off-by: default avatarChuck Lever <cel@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 4ece3a2d
...@@ -214,12 +214,16 @@ static struct rpc_procinfo nsm_procedures[] = { ...@@ -214,12 +214,16 @@ static struct rpc_procinfo nsm_procedures[] = {
.p_encode = (kxdrproc_t) xdr_encode_mon, .p_encode = (kxdrproc_t) xdr_encode_mon,
.p_decode = (kxdrproc_t) xdr_decode_stat_res, .p_decode = (kxdrproc_t) xdr_decode_stat_res,
.p_bufsiz = MAX(SM_mon_sz, SM_monres_sz) << 2, .p_bufsiz = MAX(SM_mon_sz, SM_monres_sz) << 2,
.p_statidx = SM_MON,
.p_name = "MONITOR",
}, },
[SM_UNMON] = { [SM_UNMON] = {
.p_proc = SM_UNMON, .p_proc = SM_UNMON,
.p_encode = (kxdrproc_t) xdr_encode_unmon, .p_encode = (kxdrproc_t) xdr_encode_unmon,
.p_decode = (kxdrproc_t) xdr_decode_stat, .p_decode = (kxdrproc_t) xdr_decode_stat,
.p_bufsiz = MAX(SM_mon_id_sz, SM_unmonres_sz) << 2, .p_bufsiz = MAX(SM_mon_id_sz, SM_unmonres_sz) << 2,
.p_statidx = SM_UNMON,
.p_name = "UNMONITOR",
}, },
}; };
......
...@@ -546,7 +546,9 @@ nlmclt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) ...@@ -546,7 +546,9 @@ nlmclt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
.p_proc = NLMPROC_##proc, \ .p_proc = NLMPROC_##proc, \
.p_encode = (kxdrproc_t) nlmclt_encode_##argtype, \ .p_encode = (kxdrproc_t) nlmclt_encode_##argtype, \
.p_decode = (kxdrproc_t) nlmclt_decode_##restype, \ .p_decode = (kxdrproc_t) nlmclt_decode_##restype, \
.p_bufsiz = MAX(NLM_##argtype##_sz, NLM_##restype##_sz) << 2 \ .p_bufsiz = MAX(NLM_##argtype##_sz, NLM_##restype##_sz) << 2, \
.p_statidx = NLMPROC_##proc, \
.p_name = #proc, \
} }
static struct rpc_procinfo nlm_procedures[] = { static struct rpc_procinfo nlm_procedures[] = {
......
...@@ -551,7 +551,9 @@ nlm4clt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) ...@@ -551,7 +551,9 @@ nlm4clt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
.p_proc = NLMPROC_##proc, \ .p_proc = NLMPROC_##proc, \
.p_encode = (kxdrproc_t) nlm4clt_encode_##argtype, \ .p_encode = (kxdrproc_t) nlm4clt_encode_##argtype, \
.p_decode = (kxdrproc_t) nlm4clt_decode_##restype, \ .p_decode = (kxdrproc_t) nlm4clt_decode_##restype, \
.p_bufsiz = MAX(NLM4_##argtype##_sz, NLM4_##restype##_sz) << 2 \ .p_bufsiz = MAX(NLM4_##argtype##_sz, NLM4_##restype##_sz) << 2, \
.p_statidx = NLMPROC_##proc, \
.p_name = #proc, \
} }
static struct rpc_procinfo nlm4_procedures[] = { static struct rpc_procinfo nlm4_procedures[] = {
......
...@@ -137,6 +137,8 @@ static struct rpc_procinfo mnt_procedures[] = { ...@@ -137,6 +137,8 @@ static struct rpc_procinfo mnt_procedures[] = {
.p_encode = (kxdrproc_t) xdr_encode_dirpath, .p_encode = (kxdrproc_t) xdr_encode_dirpath,
.p_decode = (kxdrproc_t) xdr_decode_fhstatus, .p_decode = (kxdrproc_t) xdr_decode_fhstatus,
.p_bufsiz = MNT_dirpath_sz << 2, .p_bufsiz = MNT_dirpath_sz << 2,
.p_statidx = MNTPROC_MNT,
.p_name = "MOUNT",
}, },
}; };
...@@ -146,6 +148,8 @@ static struct rpc_procinfo mnt3_procedures[] = { ...@@ -146,6 +148,8 @@ static struct rpc_procinfo mnt3_procedures[] = {
.p_encode = (kxdrproc_t) xdr_encode_dirpath, .p_encode = (kxdrproc_t) xdr_encode_dirpath,
.p_decode = (kxdrproc_t) xdr_decode_fhstatus3, .p_decode = (kxdrproc_t) xdr_decode_fhstatus3,
.p_bufsiz = MNT_dirpath_sz << 2, .p_bufsiz = MNT_dirpath_sz << 2,
.p_statidx = MOUNTPROC3_MNT,
.p_name = "MOUNT",
}, },
}; };
......
...@@ -682,7 +682,9 @@ nfs_stat_to_errno(int stat) ...@@ -682,7 +682,9 @@ nfs_stat_to_errno(int stat)
.p_encode = (kxdrproc_t) nfs_xdr_##argtype, \ .p_encode = (kxdrproc_t) nfs_xdr_##argtype, \
.p_decode = (kxdrproc_t) nfs_xdr_##restype, \ .p_decode = (kxdrproc_t) nfs_xdr_##restype, \
.p_bufsiz = MAX(NFS_##argtype##_sz,NFS_##restype##_sz) << 2, \ .p_bufsiz = MAX(NFS_##argtype##_sz,NFS_##restype##_sz) << 2, \
.p_timer = timer \ .p_timer = timer, \
.p_statidx = NFSPROC_##proc, \
.p_name = #proc, \
} }
struct rpc_procinfo nfs_procedures[] = { struct rpc_procinfo nfs_procedures[] = {
PROC(GETATTR, fhandle, attrstat, 1), PROC(GETATTR, fhandle, attrstat, 1),
......
...@@ -1109,7 +1109,9 @@ nfs3_xdr_setaclres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) ...@@ -1109,7 +1109,9 @@ nfs3_xdr_setaclres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
.p_encode = (kxdrproc_t) nfs3_xdr_##argtype, \ .p_encode = (kxdrproc_t) nfs3_xdr_##argtype, \
.p_decode = (kxdrproc_t) nfs3_xdr_##restype, \ .p_decode = (kxdrproc_t) nfs3_xdr_##restype, \
.p_bufsiz = MAX(NFS3_##argtype##_sz,NFS3_##restype##_sz) << 2, \ .p_bufsiz = MAX(NFS3_##argtype##_sz,NFS3_##restype##_sz) << 2, \
.p_timer = timer \ .p_timer = timer, \
.p_statidx = NFS3PROC_##proc, \
.p_name = #proc, \
} }
struct rpc_procinfo nfs3_procedures[] = { struct rpc_procinfo nfs3_procedures[] = {
...@@ -1150,6 +1152,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = { ...@@ -1150,6 +1152,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = {
.p_decode = (kxdrproc_t) nfs3_xdr_getaclres, .p_decode = (kxdrproc_t) nfs3_xdr_getaclres,
.p_bufsiz = MAX(ACL3_getaclargs_sz, ACL3_getaclres_sz) << 2, .p_bufsiz = MAX(ACL3_getaclargs_sz, ACL3_getaclres_sz) << 2,
.p_timer = 1, .p_timer = 1,
.p_name = "GETACL",
}, },
[ACLPROC3_SETACL] = { [ACLPROC3_SETACL] = {
.p_proc = ACLPROC3_SETACL, .p_proc = ACLPROC3_SETACL,
...@@ -1157,6 +1160,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = { ...@@ -1157,6 +1160,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = {
.p_decode = (kxdrproc_t) nfs3_xdr_setaclres, .p_decode = (kxdrproc_t) nfs3_xdr_setaclres,
.p_bufsiz = MAX(ACL3_setaclargs_sz, ACL3_setaclres_sz) << 2, .p_bufsiz = MAX(ACL3_setaclargs_sz, ACL3_setaclres_sz) << 2,
.p_timer = 0, .p_timer = 0,
.p_name = "SETACL",
}, },
}; };
......
...@@ -4344,6 +4344,8 @@ nfs_stat_to_errno(int stat) ...@@ -4344,6 +4344,8 @@ nfs_stat_to_errno(int stat)
.p_encode = (kxdrproc_t) nfs4_xdr_##argtype, \ .p_encode = (kxdrproc_t) nfs4_xdr_##argtype, \
.p_decode = (kxdrproc_t) nfs4_xdr_##restype, \ .p_decode = (kxdrproc_t) nfs4_xdr_##restype, \
.p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \ .p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \
.p_statidx = NFSPROC4_CLNT_##proc, \
.p_name = #proc, \
} }
struct rpc_procinfo nfs4_procedures[] = { struct rpc_procinfo nfs4_procedures[] = {
......
...@@ -326,6 +326,8 @@ nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, u32 *p) ...@@ -326,6 +326,8 @@ nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, u32 *p)
.p_encode = (kxdrproc_t) nfs4_xdr_##argtype, \ .p_encode = (kxdrproc_t) nfs4_xdr_##argtype, \
.p_decode = (kxdrproc_t) nfs4_xdr_##restype, \ .p_decode = (kxdrproc_t) nfs4_xdr_##restype, \
.p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \ .p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \
.p_statidx = NFSPROC4_CB_##call, \
.p_name = #proc, \
} }
static struct rpc_procinfo nfs4_cb_procedures[] = { static struct rpc_procinfo nfs4_cb_procedures[] = {
......
...@@ -101,6 +101,8 @@ struct rpc_procinfo { ...@@ -101,6 +101,8 @@ struct rpc_procinfo {
unsigned int p_bufsiz; /* req. buffer size */ unsigned int p_bufsiz; /* req. buffer size */
unsigned int p_count; /* call count */ unsigned int p_count; /* call count */
unsigned int p_timer; /* Which RTT timer to use */ unsigned int p_timer; /* Which RTT timer to use */
u32 p_statidx; /* Which procedure to account */
char * p_name; /* name of procedure */
}; };
#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt)) #define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt))
......
...@@ -261,6 +261,8 @@ static struct rpc_procinfo pmap_procedures[] = { ...@@ -261,6 +261,8 @@ static struct rpc_procinfo pmap_procedures[] = {
.p_decode = (kxdrproc_t) xdr_decode_bool, .p_decode = (kxdrproc_t) xdr_decode_bool,
.p_bufsiz = 4, .p_bufsiz = 4,
.p_count = 1, .p_count = 1,
.p_statidx = PMAP_SET,
.p_name = "SET",
}, },
[PMAP_UNSET] = { [PMAP_UNSET] = {
.p_proc = PMAP_UNSET, .p_proc = PMAP_UNSET,
...@@ -268,6 +270,8 @@ static struct rpc_procinfo pmap_procedures[] = { ...@@ -268,6 +270,8 @@ static struct rpc_procinfo pmap_procedures[] = {
.p_decode = (kxdrproc_t) xdr_decode_bool, .p_decode = (kxdrproc_t) xdr_decode_bool,
.p_bufsiz = 4, .p_bufsiz = 4,
.p_count = 1, .p_count = 1,
.p_statidx = PMAP_UNSET,
.p_name = "UNSET",
}, },
[PMAP_GETPORT] = { [PMAP_GETPORT] = {
.p_proc = PMAP_GETPORT, .p_proc = PMAP_GETPORT,
...@@ -275,6 +279,8 @@ static struct rpc_procinfo pmap_procedures[] = { ...@@ -275,6 +279,8 @@ static struct rpc_procinfo pmap_procedures[] = {
.p_decode = (kxdrproc_t) xdr_decode_port, .p_decode = (kxdrproc_t) xdr_decode_port,
.p_bufsiz = 4, .p_bufsiz = 4,
.p_count = 1, .p_count = 1,
.p_statidx = PMAP_GETPORT,
.p_name = "GETPORT",
}, },
}; };
......
...@@ -151,7 +151,7 @@ void rpc_count_iostats(struct rpc_task *task) ...@@ -151,7 +151,7 @@ void rpc_count_iostats(struct rpc_task *task)
if (!stats || !req) if (!stats || !req)
return; return;
op_metrics = &stats[task->tk_msg.rpc_proc->p_proc]; op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx];
op_metrics->om_ops++; op_metrics->om_ops++;
op_metrics->om_ntrans += req->rq_ntrans; op_metrics->om_ntrans += req->rq_ntrans;
...@@ -176,6 +176,16 @@ void rpc_count_iostats(struct rpc_task *task) ...@@ -176,6 +176,16 @@ void rpc_count_iostats(struct rpc_task *task)
op_metrics->om_execute += execute; op_metrics->om_execute += execute;
} }
void _print_name(struct seq_file *seq, unsigned int op, struct rpc_procinfo *procs)
{
if (procs[op].p_name)
seq_printf(seq, "\t%12s: ", procs[op].p_name);
else if (op == 0)
seq_printf(seq, "\t NULL: ");
else
seq_printf(seq, "\t%12u: ", op);
}
#define MILLISECS_PER_JIFFY (1000UL / HZ) #define MILLISECS_PER_JIFFY (1000UL / HZ)
void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
...@@ -197,7 +207,7 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) ...@@ -197,7 +207,7 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
seq_printf(seq, "\tper-op statistics\n"); seq_printf(seq, "\tper-op statistics\n");
for (op = 0; op < maxproc; op++) { for (op = 0; op < maxproc; op++) {
struct rpc_iostats *metrics = &stats[op]; struct rpc_iostats *metrics = &stats[op];
seq_printf(seq, "%12u: ", op); _print_name(seq, op, clnt->cl_procinfo);
seq_printf(seq, "%lu %lu %lu %Lu %Lu %Lu %Lu %Lu\n", seq_printf(seq, "%lu %lu %lu %Lu %Lu %Lu %Lu %Lu\n",
metrics->om_ops, metrics->om_ops,
metrics->om_ntrans, metrics->om_ntrans,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment