aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <cel@netapp.com>2006-03-20 13:44:22 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:22 -0500
commitcc0175c1dc1de8f6af0eb0631dcc5b999a6fcc42 (patch)
treeb219a9c16f0ef3ff0982450c32aa0f09d503782a
parent4ece3a2d18fd7fe1d4972284a8c98c569020093f (diff)
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: Chuck Lever <cel@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/lockd/mon.c4
-rw-r--r--fs/lockd/xdr.c4
-rw-r--r--fs/lockd/xdr4.c4
-rw-r--r--fs/nfs/mount_clnt.c4
-rw-r--r--fs/nfs/nfs2xdr.c4
-rw-r--r--fs/nfs/nfs3xdr.c6
-rw-r--r--fs/nfs/nfs4xdr.c2
-rw-r--r--fs/nfsd/nfs4callback.c2
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--net/sunrpc/pmap_clnt.c6
-rw-r--r--net/sunrpc/stats.c14
11 files changed, 46 insertions, 6 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 0edc03e67966..84ee39e6a3a2 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -214,12 +214,16 @@ static struct rpc_procinfo nsm_procedures[] = {
214 .p_encode = (kxdrproc_t) xdr_encode_mon, 214 .p_encode = (kxdrproc_t) xdr_encode_mon,
215 .p_decode = (kxdrproc_t) xdr_decode_stat_res, 215 .p_decode = (kxdrproc_t) xdr_decode_stat_res,
216 .p_bufsiz = MAX(SM_mon_sz, SM_monres_sz) << 2, 216 .p_bufsiz = MAX(SM_mon_sz, SM_monres_sz) << 2,
217 .p_statidx = SM_MON,
218 .p_name = "MONITOR",
217 }, 219 },
218[SM_UNMON] = { 220[SM_UNMON] = {
219 .p_proc = SM_UNMON, 221 .p_proc = SM_UNMON,
220 .p_encode = (kxdrproc_t) xdr_encode_unmon, 222 .p_encode = (kxdrproc_t) xdr_encode_unmon,
221 .p_decode = (kxdrproc_t) xdr_decode_stat, 223 .p_decode = (kxdrproc_t) xdr_decode_stat,
222 .p_bufsiz = MAX(SM_mon_id_sz, SM_unmonres_sz) << 2, 224 .p_bufsiz = MAX(SM_mon_id_sz, SM_unmonres_sz) << 2,
225 .p_statidx = SM_UNMON,
226 .p_name = "UNMONITOR",
223 }, 227 },
224}; 228};
225 229
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 1e984ab14d3f..766ce06146b5 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -546,7 +546,9 @@ nlmclt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
546 .p_proc = NLMPROC_##proc, \ 546 .p_proc = NLMPROC_##proc, \
547 .p_encode = (kxdrproc_t) nlmclt_encode_##argtype, \ 547 .p_encode = (kxdrproc_t) nlmclt_encode_##argtype, \
548 .p_decode = (kxdrproc_t) nlmclt_decode_##restype, \ 548 .p_decode = (kxdrproc_t) nlmclt_decode_##restype, \
549 .p_bufsiz = MAX(NLM_##argtype##_sz, NLM_##restype##_sz) << 2 \ 549 .p_bufsiz = MAX(NLM_##argtype##_sz, NLM_##restype##_sz) << 2, \
550 .p_statidx = NLMPROC_##proc, \
551 .p_name = #proc, \
550 } 552 }
551 553
552static struct rpc_procinfo nlm_procedures[] = { 554static struct rpc_procinfo nlm_procedures[] = {
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index 906ddc203186..36eb175ec335 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -551,7 +551,9 @@ nlm4clt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
551 .p_proc = NLMPROC_##proc, \ 551 .p_proc = NLMPROC_##proc, \
552 .p_encode = (kxdrproc_t) nlm4clt_encode_##argtype, \ 552 .p_encode = (kxdrproc_t) nlm4clt_encode_##argtype, \
553 .p_decode = (kxdrproc_t) nlm4clt_decode_##restype, \ 553 .p_decode = (kxdrproc_t) nlm4clt_decode_##restype, \
554 .p_bufsiz = MAX(NLM4_##argtype##_sz, NLM4_##restype##_sz) << 2 \ 554 .p_bufsiz = MAX(NLM4_##argtype##_sz, NLM4_##restype##_sz) << 2, \
555 .p_statidx = NLMPROC_##proc, \
556 .p_name = #proc, \
555 } 557 }
556 558
557static struct rpc_procinfo nlm4_procedures[] = { 559static struct rpc_procinfo nlm4_procedures[] = {
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index db99b8f678f8..4a1340358223 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -137,6 +137,8 @@ static struct rpc_procinfo mnt_procedures[] = {
137 .p_encode = (kxdrproc_t) xdr_encode_dirpath, 137 .p_encode = (kxdrproc_t) xdr_encode_dirpath,
138 .p_decode = (kxdrproc_t) xdr_decode_fhstatus, 138 .p_decode = (kxdrproc_t) xdr_decode_fhstatus,
139 .p_bufsiz = MNT_dirpath_sz << 2, 139 .p_bufsiz = MNT_dirpath_sz << 2,
140 .p_statidx = MNTPROC_MNT,
141 .p_name = "MOUNT",
140 }, 142 },
141}; 143};
142 144
@@ -146,6 +148,8 @@ static struct rpc_procinfo mnt3_procedures[] = {
146 .p_encode = (kxdrproc_t) xdr_encode_dirpath, 148 .p_encode = (kxdrproc_t) xdr_encode_dirpath,
147 .p_decode = (kxdrproc_t) xdr_decode_fhstatus3, 149 .p_decode = (kxdrproc_t) xdr_decode_fhstatus3,
148 .p_bufsiz = MNT_dirpath_sz << 2, 150 .p_bufsiz = MNT_dirpath_sz << 2,
151 .p_statidx = MOUNTPROC3_MNT,
152 .p_name = "MOUNT",
149 }, 153 },
150}; 154};
151 155
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index 7fc0560c89c9..8cdc792ff3c7 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -682,7 +682,9 @@ nfs_stat_to_errno(int stat)
682 .p_encode = (kxdrproc_t) nfs_xdr_##argtype, \ 682 .p_encode = (kxdrproc_t) nfs_xdr_##argtype, \
683 .p_decode = (kxdrproc_t) nfs_xdr_##restype, \ 683 .p_decode = (kxdrproc_t) nfs_xdr_##restype, \
684 .p_bufsiz = MAX(NFS_##argtype##_sz,NFS_##restype##_sz) << 2, \ 684 .p_bufsiz = MAX(NFS_##argtype##_sz,NFS_##restype##_sz) << 2, \
685 .p_timer = timer \ 685 .p_timer = timer, \
686 .p_statidx = NFSPROC_##proc, \
687 .p_name = #proc, \
686 } 688 }
687struct rpc_procinfo nfs_procedures[] = { 689struct rpc_procinfo nfs_procedures[] = {
688 PROC(GETATTR, fhandle, attrstat, 1), 690 PROC(GETATTR, fhandle, attrstat, 1),
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index b6c0b5012bce..2d8701a230f0 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -1109,7 +1109,9 @@ nfs3_xdr_setaclres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
1109 .p_encode = (kxdrproc_t) nfs3_xdr_##argtype, \ 1109 .p_encode = (kxdrproc_t) nfs3_xdr_##argtype, \
1110 .p_decode = (kxdrproc_t) nfs3_xdr_##restype, \ 1110 .p_decode = (kxdrproc_t) nfs3_xdr_##restype, \
1111 .p_bufsiz = MAX(NFS3_##argtype##_sz,NFS3_##restype##_sz) << 2, \ 1111 .p_bufsiz = MAX(NFS3_##argtype##_sz,NFS3_##restype##_sz) << 2, \
1112 .p_timer = timer \ 1112 .p_timer = timer, \
1113 .p_statidx = NFS3PROC_##proc, \
1114 .p_name = #proc, \
1113 } 1115 }
1114 1116
1115struct rpc_procinfo nfs3_procedures[] = { 1117struct rpc_procinfo nfs3_procedures[] = {
@@ -1150,6 +1152,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = {
1150 .p_decode = (kxdrproc_t) nfs3_xdr_getaclres, 1152 .p_decode = (kxdrproc_t) nfs3_xdr_getaclres,
1151 .p_bufsiz = MAX(ACL3_getaclargs_sz, ACL3_getaclres_sz) << 2, 1153 .p_bufsiz = MAX(ACL3_getaclargs_sz, ACL3_getaclres_sz) << 2,
1152 .p_timer = 1, 1154 .p_timer = 1,
1155 .p_name = "GETACL",
1153 }, 1156 },
1154 [ACLPROC3_SETACL] = { 1157 [ACLPROC3_SETACL] = {
1155 .p_proc = ACLPROC3_SETACL, 1158 .p_proc = ACLPROC3_SETACL,
@@ -1157,6 +1160,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = {
1157 .p_decode = (kxdrproc_t) nfs3_xdr_setaclres, 1160 .p_decode = (kxdrproc_t) nfs3_xdr_setaclres,
1158 .p_bufsiz = MAX(ACL3_setaclargs_sz, ACL3_setaclres_sz) << 2, 1161 .p_bufsiz = MAX(ACL3_setaclargs_sz, ACL3_setaclres_sz) << 2,
1159 .p_timer = 0, 1162 .p_timer = 0,
1163 .p_name = "SETACL",
1160 }, 1164 },
1161}; 1165};
1162 1166
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 4bbf5ef57785..b95675349ba3 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -4344,6 +4344,8 @@ nfs_stat_to_errno(int stat)
4344 .p_encode = (kxdrproc_t) nfs4_xdr_##argtype, \ 4344 .p_encode = (kxdrproc_t) nfs4_xdr_##argtype, \
4345 .p_decode = (kxdrproc_t) nfs4_xdr_##restype, \ 4345 .p_decode = (kxdrproc_t) nfs4_xdr_##restype, \
4346 .p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \ 4346 .p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \
4347 .p_statidx = NFSPROC4_CLNT_##proc, \
4348 .p_name = #proc, \
4347 } 4349 }
4348 4350
4349struct rpc_procinfo nfs4_procedures[] = { 4351struct rpc_procinfo nfs4_procedures[] = {
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index d828662d737d..4f391cbf2fd1 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -326,6 +326,8 @@ out:
326 .p_encode = (kxdrproc_t) nfs4_xdr_##argtype, \ 326 .p_encode = (kxdrproc_t) nfs4_xdr_##argtype, \
327 .p_decode = (kxdrproc_t) nfs4_xdr_##restype, \ 327 .p_decode = (kxdrproc_t) nfs4_xdr_##restype, \
328 .p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \ 328 .p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \
329 .p_statidx = NFSPROC4_CB_##call, \
330 .p_name = #proc, \
329} 331}
330 332
331static struct rpc_procinfo nfs4_cb_procedures[] = { 333static struct rpc_procinfo nfs4_cb_procedures[] = {
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 0f3662002ffc..3bec751ee249 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -101,6 +101,8 @@ struct rpc_procinfo {
101 unsigned int p_bufsiz; /* req. buffer size */ 101 unsigned int p_bufsiz; /* req. buffer size */
102 unsigned int p_count; /* call count */ 102 unsigned int p_count; /* call count */
103 unsigned int p_timer; /* Which RTT timer to use */ 103 unsigned int p_timer; /* Which RTT timer to use */
104 u32 p_statidx; /* Which procedure to account */
105 char * p_name; /* name of procedure */
104}; 106};
105 107
106#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt)) 108#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt))
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c
index 332cc5d362d5..efa00bd9ff9e 100644
--- a/net/sunrpc/pmap_clnt.c
+++ b/net/sunrpc/pmap_clnt.c
@@ -261,6 +261,8 @@ static struct rpc_procinfo pmap_procedures[] = {
261 .p_decode = (kxdrproc_t) xdr_decode_bool, 261 .p_decode = (kxdrproc_t) xdr_decode_bool,
262 .p_bufsiz = 4, 262 .p_bufsiz = 4,
263 .p_count = 1, 263 .p_count = 1,
264 .p_statidx = PMAP_SET,
265 .p_name = "SET",
264 }, 266 },
265[PMAP_UNSET] = { 267[PMAP_UNSET] = {
266 .p_proc = PMAP_UNSET, 268 .p_proc = PMAP_UNSET,
@@ -268,6 +270,8 @@ static struct rpc_procinfo pmap_procedures[] = {
268 .p_decode = (kxdrproc_t) xdr_decode_bool, 270 .p_decode = (kxdrproc_t) xdr_decode_bool,
269 .p_bufsiz = 4, 271 .p_bufsiz = 4,
270 .p_count = 1, 272 .p_count = 1,
273 .p_statidx = PMAP_UNSET,
274 .p_name = "UNSET",
271 }, 275 },
272[PMAP_GETPORT] = { 276[PMAP_GETPORT] = {
273 .p_proc = PMAP_GETPORT, 277 .p_proc = PMAP_GETPORT,
@@ -275,6 +279,8 @@ static struct rpc_procinfo pmap_procedures[] = {
275 .p_decode = (kxdrproc_t) xdr_decode_port, 279 .p_decode = (kxdrproc_t) xdr_decode_port,
276 .p_bufsiz = 4, 280 .p_bufsiz = 4,
277 .p_count = 1, 281 .p_count = 1,
282 .p_statidx = PMAP_GETPORT,
283 .p_name = "GETPORT",
278 }, 284 },
279}; 285};
280 286
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 24ac7163b9c7..53746793eca2 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -151,7 +151,7 @@ void rpc_count_iostats(struct rpc_task *task)
151 151
152 if (!stats || !req) 152 if (!stats || !req)
153 return; 153 return;
154 op_metrics = &stats[task->tk_msg.rpc_proc->p_proc]; 154 op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx];
155 155
156 op_metrics->om_ops++; 156 op_metrics->om_ops++;
157 op_metrics->om_ntrans += req->rq_ntrans; 157 op_metrics->om_ntrans += req->rq_ntrans;
@@ -176,6 +176,16 @@ void rpc_count_iostats(struct rpc_task *task)
176 op_metrics->om_execute += execute; 176 op_metrics->om_execute += execute;
177} 177}
178 178
179void _print_name(struct seq_file *seq, unsigned int op, struct rpc_procinfo *procs)
180{
181 if (procs[op].p_name)
182 seq_printf(seq, "\t%12s: ", procs[op].p_name);
183 else if (op == 0)
184 seq_printf(seq, "\t NULL: ");
185 else
186 seq_printf(seq, "\t%12u: ", op);
187}
188
179#define MILLISECS_PER_JIFFY (1000UL / HZ) 189#define MILLISECS_PER_JIFFY (1000UL / HZ)
180 190
181void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) 191void 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 seq_printf(seq, "\tper-op statistics\n"); 207 seq_printf(seq, "\tper-op statistics\n");
198 for (op = 0; op < maxproc; op++) { 208 for (op = 0; op < maxproc; op++) {
199 struct rpc_iostats *metrics = &stats[op]; 209 struct rpc_iostats *metrics = &stats[op];
200 seq_printf(seq, "%12u: ", op); 210 _print_name(seq, op, clnt->cl_procinfo);
201 seq_printf(seq, "%lu %lu %lu %Lu %Lu %Lu %Lu %Lu\n", 211 seq_printf(seq, "%lu %lu %lu %Lu %Lu %Lu %Lu %Lu\n",
202 metrics->om_ops, 212 metrics->om_ops,
203 metrics->om_ntrans, 213 metrics->om_ntrans,