aboutsummaryrefslogtreecommitdiffstats
path: root/net
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 /net
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>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/pmap_clnt.c6
-rw-r--r--net/sunrpc/stats.c14
2 files changed, 18 insertions, 2 deletions
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,