Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 840210fc authored by Weston Andros Adamson's avatar Weston Andros Adamson Committed by Tom Haynes
Browse files

sunrpc: add rpc_count_iostats_idx



Add a call to tally stats for a task under a different statsidx than
what's contained in the task structure.

This is needed to properly account for pnfs reads/writes when the
DS nfs version != the MDS version.

Signed-off-by: default avatarWeston Andros Adamson <dros@primarydata.com>
Signed-off-by: default avatarTom Haynes <Thomas.Haynes@primarydata.com>
parent 16cecdf6
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -79,6 +79,8 @@ struct rpc_clnt;
struct rpc_iostats *	rpc_alloc_iostats(struct rpc_clnt *);
struct rpc_iostats *	rpc_alloc_iostats(struct rpc_clnt *);
void			rpc_count_iostats(const struct rpc_task *,
void			rpc_count_iostats(const struct rpc_task *,
					  struct rpc_iostats *);
					  struct rpc_iostats *);
void			rpc_count_iostats_metrics(const struct rpc_task *,
					  struct rpc_iostats *);
void			rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
void			rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
void			rpc_free_iostats(struct rpc_iostats *);
void			rpc_free_iostats(struct rpc_iostats *);


+19 −7
Original line number Original line Diff line number Diff line
@@ -140,22 +140,20 @@ void rpc_free_iostats(struct rpc_iostats *stats)
EXPORT_SYMBOL_GPL(rpc_free_iostats);
EXPORT_SYMBOL_GPL(rpc_free_iostats);


/**
/**
 * rpc_count_iostats - tally up per-task stats
 * rpc_count_iostats_metrics - tally up per-task stats
 * @task: completed rpc_task
 * @task: completed rpc_task
 * @stats: array of stat structures
 * @op_metrics: stat structure for OP that will accumulate stats from @task
 */
 */
void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
void rpc_count_iostats_metrics(const struct rpc_task *task,
			       struct rpc_iostats *op_metrics)
{
{
	struct rpc_rqst *req = task->tk_rqstp;
	struct rpc_rqst *req = task->tk_rqstp;
	struct rpc_iostats *op_metrics;
	ktime_t delta, now;
	ktime_t delta, now;


	if (!stats || !req)
	if (!op_metrics || !req)
		return;
		return;


	now = ktime_get();
	now = ktime_get();
	op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx];

	spin_lock(&op_metrics->om_lock);
	spin_lock(&op_metrics->om_lock);


	op_metrics->om_ops++;
	op_metrics->om_ops++;
@@ -175,6 +173,20 @@ void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)


	spin_unlock(&op_metrics->om_lock);
	spin_unlock(&op_metrics->om_lock);
}
}
EXPORT_SYMBOL_GPL(rpc_count_iostats_metrics);

/**
 * rpc_count_iostats - tally up per-task stats
 * @task: completed rpc_task
 * @stats: array of stat structures
 *
 * Uses the statidx from @task
 */
void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
{
	rpc_count_iostats_metrics(task,
				  &stats[task->tk_msg.rpc_proc->p_statidx]);
}
EXPORT_SYMBOL_GPL(rpc_count_iostats);
EXPORT_SYMBOL_GPL(rpc_count_iostats);


static void _print_name(struct seq_file *seq, unsigned int op,
static void _print_name(struct seq_file *seq, unsigned int op,