diff options
author | Dave Wysochanski <dwysocha@redhat.com> | 2018-07-31 10:10:51 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2018-07-31 12:53:35 -0400 |
commit | 016583d7030cec9b69e0d55269a5967f4ee871d2 (patch) | |
tree | f85c91d451a92ff7c5fcc9de2888a0a1c39bf871 /net/sunrpc | |
parent | 189e1955677d6a704fed3dfbc33893836a48a700 (diff) |
sunrpc: Change rpc_print_iostats to rpc_clnt_show_stats and handle rpc_clnt clones
The existing rpc_print_iostats has a few shortcomings. First, the naming
is not consistent with other functions in the kernel that display stats.
Second, it is really displaying stats for an rpc_clnt structure as it
displays both xprt stats and per-op stats. Third, it does not handle
rpc_clnt clones, which is important for the one in-kernel tree caller
of this function, the NFS client's nfs_show_stats function.
Fix all of the above by renaming the rpc_print_iostats to
rpc_clnt_show_stats and looping through any rpc_clnt clones via
cl_parent.
Once this interface is fixed, this addresses a problem with NFSv4.
Before this patch, the /proc/self/mountstats always showed incorrect
counts for NFSv4 lease and session related opcodes such as SEQUENCE,
RENEW, SETCLIENTID, CREATE_SESSION, etc. These counts were always 0
even though many ops would go over the wire. The reason for this is
there are multiple rpc_clnt structures allocated for any given NFSv4
mount, and inside nfs_show_stats() we callled into rpc_print_iostats()
which only handled one of them, nfs_server->client. Fix these counts
by calling sunrpc's new rpc_clnt_show_stats() function, which handles
cloned rpc_clnt structs and prints the stats together.
Note that one side-effect of the above is that multiple mounts from
the same NFS server will show identical counts in the above ops due
to the fact the one rpc_clnt (representing the NFSv4 client state)
is shared across mounts.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/stats.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 32adddd7fb78..ffae7c2245b1 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
@@ -235,13 +235,12 @@ static void _print_rpc_iostats(struct seq_file *seq, struct rpc_iostats *stats, | |||
235 | ktime_to_ms(stats->om_execute)); | 235 | ktime_to_ms(stats->om_execute)); |
236 | } | 236 | } |
237 | 237 | ||
238 | void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) | 238 | void rpc_clnt_show_stats(struct seq_file *seq, struct rpc_clnt *clnt) |
239 | { | 239 | { |
240 | struct rpc_iostats *stats = clnt->cl_metrics; | ||
241 | struct rpc_xprt *xprt; | 240 | struct rpc_xprt *xprt; |
242 | unsigned int op, maxproc = clnt->cl_maxproc; | 241 | unsigned int op, maxproc = clnt->cl_maxproc; |
243 | 242 | ||
244 | if (!stats) | 243 | if (!clnt->cl_metrics) |
245 | return; | 244 | return; |
246 | 245 | ||
247 | seq_printf(seq, "\tRPC iostats version: %s ", RPC_IOSTATS_VERS); | 246 | seq_printf(seq, "\tRPC iostats version: %s ", RPC_IOSTATS_VERS); |
@@ -256,10 +255,18 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) | |||
256 | 255 | ||
257 | seq_printf(seq, "\tper-op statistics\n"); | 256 | seq_printf(seq, "\tper-op statistics\n"); |
258 | for (op = 0; op < maxproc; op++) { | 257 | for (op = 0; op < maxproc; op++) { |
259 | _print_rpc_iostats(seq, &stats[op], op, clnt->cl_procinfo); | 258 | struct rpc_iostats stats = {}; |
259 | struct rpc_clnt *next = clnt; | ||
260 | do { | ||
261 | _add_rpc_iostats(&stats, &next->cl_metrics[op]); | ||
262 | if (next == next->cl_parent) | ||
263 | break; | ||
264 | next = next->cl_parent; | ||
265 | } while (next); | ||
266 | _print_rpc_iostats(seq, &stats, op, clnt->cl_procinfo); | ||
260 | } | 267 | } |
261 | } | 268 | } |
262 | EXPORT_SYMBOL_GPL(rpc_print_iostats); | 269 | EXPORT_SYMBOL_GPL(rpc_clnt_show_stats); |
263 | 270 | ||
264 | /* | 271 | /* |
265 | * Register/unregister RPC proc files | 272 | * Register/unregister RPC proc files |