diff options
-rw-r--r-- | include/linux/sunrpc/metrics.h | 7 | ||||
-rw-r--r-- | net/sunrpc/sched.c | 5 | ||||
-rw-r--r-- | net/sunrpc/stats.c | 8 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 4 |
4 files changed, 17 insertions, 7 deletions
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h index 1b3751327575..0ee3f7052846 100644 --- a/include/linux/sunrpc/metrics.h +++ b/include/linux/sunrpc/metrics.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/ktime.h> | 30 | #include <linux/ktime.h> |
31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
32 | 32 | ||
33 | #define RPC_IOSTATS_VERS "1.0" | 33 | #define RPC_IOSTATS_VERS "1.1" |
34 | 34 | ||
35 | struct rpc_iostats { | 35 | struct rpc_iostats { |
36 | spinlock_t om_lock; | 36 | spinlock_t om_lock; |
@@ -66,6 +66,11 @@ struct rpc_iostats { | |||
66 | ktime_t om_queue, /* queued for xmit */ | 66 | ktime_t om_queue, /* queued for xmit */ |
67 | om_rtt, /* RPC RTT */ | 67 | om_rtt, /* RPC RTT */ |
68 | om_execute; /* RPC execution */ | 68 | om_execute; /* RPC execution */ |
69 | /* | ||
70 | * The count of operations that complete with tk_status < 0. | ||
71 | * These statuses usually indicate error conditions. | ||
72 | */ | ||
73 | unsigned long om_error_status; | ||
69 | } ____cacheline_aligned; | 74 | } ____cacheline_aligned; |
70 | 75 | ||
71 | struct rpc_task; | 76 | struct rpc_task; |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 191916168e67..f820780280b5 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/sched/mm.h> | 23 | #include <linux/sched/mm.h> |
24 | 24 | ||
25 | #include <linux/sunrpc/clnt.h> | 25 | #include <linux/sunrpc/clnt.h> |
26 | #include <linux/sunrpc/metrics.h> | ||
26 | 27 | ||
27 | #include "sunrpc.h" | 28 | #include "sunrpc.h" |
28 | 29 | ||
@@ -842,6 +843,10 @@ rpc_reset_task_statistics(struct rpc_task *task) | |||
842 | void rpc_exit_task(struct rpc_task *task) | 843 | void rpc_exit_task(struct rpc_task *task) |
843 | { | 844 | { |
844 | task->tk_action = NULL; | 845 | task->tk_action = NULL; |
846 | if (task->tk_ops->rpc_count_stats) | ||
847 | task->tk_ops->rpc_count_stats(task, task->tk_calldata); | ||
848 | else if (task->tk_client) | ||
849 | rpc_count_iostats(task, task->tk_client->cl_metrics); | ||
845 | if (task->tk_ops->rpc_call_done != NULL) { | 850 | if (task->tk_ops->rpc_call_done != NULL) { |
846 | task->tk_ops->rpc_call_done(task, task->tk_calldata); | 851 | task->tk_ops->rpc_call_done(task, task->tk_calldata); |
847 | if (task->tk_action != NULL) { | 852 | if (task->tk_action != NULL) { |
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 2b6dc7e5f74f..48ea776364f8 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
@@ -177,6 +177,8 @@ void rpc_count_iostats_metrics(const struct rpc_task *task, | |||
177 | 177 | ||
178 | execute = ktime_sub(now, task->tk_start); | 178 | execute = ktime_sub(now, task->tk_start); |
179 | op_metrics->om_execute = ktime_add(op_metrics->om_execute, execute); | 179 | op_metrics->om_execute = ktime_add(op_metrics->om_execute, execute); |
180 | if (task->tk_status < 0) | ||
181 | op_metrics->om_error_status++; | ||
180 | 182 | ||
181 | spin_unlock(&op_metrics->om_lock); | 183 | spin_unlock(&op_metrics->om_lock); |
182 | 184 | ||
@@ -219,13 +221,14 @@ static void _add_rpc_iostats(struct rpc_iostats *a, struct rpc_iostats *b) | |||
219 | a->om_queue = ktime_add(a->om_queue, b->om_queue); | 221 | a->om_queue = ktime_add(a->om_queue, b->om_queue); |
220 | a->om_rtt = ktime_add(a->om_rtt, b->om_rtt); | 222 | a->om_rtt = ktime_add(a->om_rtt, b->om_rtt); |
221 | a->om_execute = ktime_add(a->om_execute, b->om_execute); | 223 | a->om_execute = ktime_add(a->om_execute, b->om_execute); |
224 | a->om_error_status += b->om_error_status; | ||
222 | } | 225 | } |
223 | 226 | ||
224 | static void _print_rpc_iostats(struct seq_file *seq, struct rpc_iostats *stats, | 227 | static void _print_rpc_iostats(struct seq_file *seq, struct rpc_iostats *stats, |
225 | int op, const struct rpc_procinfo *procs) | 228 | int op, const struct rpc_procinfo *procs) |
226 | { | 229 | { |
227 | _print_name(seq, op, procs); | 230 | _print_name(seq, op, procs); |
228 | seq_printf(seq, "%lu %lu %lu %Lu %Lu %Lu %Lu %Lu\n", | 231 | seq_printf(seq, "%lu %lu %lu %llu %llu %llu %llu %llu %lu\n", |
229 | stats->om_ops, | 232 | stats->om_ops, |
230 | stats->om_ntrans, | 233 | stats->om_ntrans, |
231 | stats->om_timeouts, | 234 | stats->om_timeouts, |
@@ -233,7 +236,8 @@ static void _print_rpc_iostats(struct seq_file *seq, struct rpc_iostats *stats, | |||
233 | stats->om_bytes_recv, | 236 | stats->om_bytes_recv, |
234 | ktime_to_ms(stats->om_queue), | 237 | ktime_to_ms(stats->om_queue), |
235 | ktime_to_ms(stats->om_rtt), | 238 | ktime_to_ms(stats->om_rtt), |
236 | ktime_to_ms(stats->om_execute)); | 239 | ktime_to_ms(stats->om_execute), |
240 | stats->om_error_status); | ||
237 | } | 241 | } |
238 | 242 | ||
239 | void rpc_clnt_show_stats(struct seq_file *seq, struct rpc_clnt *clnt) | 243 | void rpc_clnt_show_stats(struct seq_file *seq, struct rpc_clnt *clnt) |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 8d41fcf25650..c4d138202abb 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -1760,10 +1760,6 @@ void xprt_release(struct rpc_task *task) | |||
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | xprt = req->rq_xprt; | 1762 | xprt = req->rq_xprt; |
1763 | if (task->tk_ops->rpc_count_stats != NULL) | ||
1764 | task->tk_ops->rpc_count_stats(task, task->tk_calldata); | ||
1765 | else if (task->tk_client) | ||
1766 | rpc_count_iostats(task, task->tk_client->cl_metrics); | ||
1767 | xprt_request_dequeue_all(task, req); | 1763 | xprt_request_dequeue_all(task, req); |
1768 | spin_lock(&xprt->transport_lock); | 1764 | spin_lock(&xprt->transport_lock); |
1769 | xprt->ops->release_xprt(xprt, task); | 1765 | xprt->ops->release_xprt(xprt, task); |