SUNRPC: Move call to rpc_count_iostats before rpc_call_done

For diagnostic purposes, it would be useful to have an rpc_iostats
metric of RPCs completing with tk_status < 0.  Unfortunately,
tk_status is reset inside the rpc_call_done functions for each
operation, and the call to tally the per-op metrics comes after
rpc_call_done.  Refactor the call to rpc_count_iostat earlier in
rpc_exit_task so we can count these RPCs completing in error.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
Dave Wysochanski 2019-05-23 16:13:48 -04:00 committed by Trond Myklebust
parent 44942b4e45
commit 9dfe52a95a
2 changed files with 5 additions and 4 deletions

View File

@ -23,6 +23,7 @@
#include <linux/sched/mm.h> #include <linux/sched/mm.h>
#include <linux/sunrpc/clnt.h> #include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/metrics.h>
#include "sunrpc.h" #include "sunrpc.h"
@ -832,6 +833,10 @@ rpc_reset_task_statistics(struct rpc_task *task)
void rpc_exit_task(struct rpc_task *task) void rpc_exit_task(struct rpc_task *task)
{ {
task->tk_action = NULL; task->tk_action = NULL;
if (task->tk_ops->rpc_count_stats)
task->tk_ops->rpc_count_stats(task, task->tk_calldata);
else if (task->tk_client)
rpc_count_iostats(task, task->tk_client->cl_metrics);
if (task->tk_ops->rpc_call_done != NULL) { if (task->tk_ops->rpc_call_done != NULL) {
task->tk_ops->rpc_call_done(task, task->tk_calldata); task->tk_ops->rpc_call_done(task, task->tk_calldata);
if (task->tk_action != NULL) { if (task->tk_action != NULL) {

View File

@ -1765,10 +1765,6 @@ void xprt_release(struct rpc_task *task)
} }
xprt = req->rq_xprt; xprt = req->rq_xprt;
if (task->tk_ops->rpc_count_stats != NULL)
task->tk_ops->rpc_count_stats(task, task->tk_calldata);
else if (task->tk_client)
rpc_count_iostats(task, task->tk_client->cl_metrics);
xprt_request_dequeue_all(task, req); xprt_request_dequeue_all(task, req);
spin_lock_bh(&xprt->transport_lock); spin_lock_bh(&xprt->transport_lock);
xprt->ops->release_xprt(xprt, task); xprt->ops->release_xprt(xprt, task);