]> err.no Git - linux-2.6/blobdiff - net/sunrpc/stats.c
[ARM] 3983/2: remove unused argument to __bug()
[linux-2.6] / net / sunrpc / stats.c
index 24ac7163b9c7d87fb0911a31a4c498a7a4ebf977..bd98124c3a649b97508685cd2f87b4813aeb83b7 100644 (file)
@@ -114,13 +114,8 @@ void svc_seq_show(struct seq_file *seq, const struct svc_stat *statp) {
  */
 struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt)
 {
-       unsigned int ops = clnt->cl_maxproc;
-       size_t size = ops * sizeof(struct rpc_iostats);
        struct rpc_iostats *new;
-
-       new = kmalloc(size, GFP_KERNEL);
-       if (new)
-               memset(new, 0 , size);
+       new = kcalloc(clnt->cl_maxproc, sizeof(struct rpc_iostats), GFP_KERNEL);
        return new;
 }
 EXPORT_SYMBOL(rpc_alloc_iostats);
@@ -151,7 +146,7 @@ void rpc_count_iostats(struct rpc_task *task)
 
        if (!stats || !req)
                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_ntrans += req->rq_ntrans;
@@ -176,7 +171,18 @@ void rpc_count_iostats(struct rpc_task *task)
        op_metrics->om_execute += execute;
 }
 
-#define MILLISECS_PER_JIFFY    (1000UL / HZ)
+static 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    (1000 / HZ)
 
 void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
 {
@@ -197,7 +203,7 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
        seq_printf(seq, "\tper-op statistics\n");
        for (op = 0; op < maxproc; 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",
                                metrics->om_ops,
                                metrics->om_ntrans,
@@ -215,7 +221,7 @@ EXPORT_SYMBOL(rpc_print_iostats);
  * Register/unregister RPC proc files
  */
 static inline struct proc_dir_entry *
-do_register(const char *name, void *data, struct file_operations *fops)
+do_register(const char *name, void *data, const struct file_operations *fops)
 {
        struct proc_dir_entry *ent;
 
@@ -243,7 +249,7 @@ rpc_proc_unregister(const char *name)
 }
 
 struct proc_dir_entry *
-svc_proc_register(struct svc_stat *statp, struct file_operations *fops)
+svc_proc_register(struct svc_stat *statp, const struct file_operations *fops)
 {
        return do_register(statp->program->pg_name, statp, fops);
 }