Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294489
b: refs/heads/master
c: 0a70219
h: refs/heads/master
i:
  294487: e5f10d8
v: v3
  • Loading branch information
Weston Andros Adamson authored and Trond Myklebust committed Feb 17, 2012
1 parent 87feab7 commit e468aa1
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b6bf6e7d6f6fae1ddcae9e02dfe676bdc8fe892c
refs/heads/master: 0a702195234eb77c4097148285cccf7f095de9cf
19 changes: 19 additions & 0 deletions trunk/fs/nfs/nfs4filelayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <linux/nfs_page.h>
#include <linux/module.h>

#include <linux/sunrpc/metrics.h>

#include "internal.h"
#include "nfs4filelayout.h"

Expand Down Expand Up @@ -189,6 +191,13 @@ static void filelayout_read_call_done(struct rpc_task *task, void *data)
rdata->mds_ops->rpc_call_done(task, data);
}

static void filelayout_read_count_stats(struct rpc_task *task, void *data)
{
struct nfs_read_data *rdata = (struct nfs_read_data *)data;

rpc_count_iostats(task, NFS_SERVER(rdata->inode)->client->cl_metrics);
}

static void filelayout_read_release(void *data)
{
struct nfs_read_data *rdata = (struct nfs_read_data *)data;
Expand Down Expand Up @@ -268,6 +277,13 @@ static void filelayout_write_call_done(struct rpc_task *task, void *data)
wdata->mds_ops->rpc_call_done(task, data);
}

static void filelayout_write_count_stats(struct rpc_task *task, void *data)
{
struct nfs_write_data *wdata = (struct nfs_write_data *)data;

rpc_count_iostats(task, NFS_SERVER(wdata->inode)->client->cl_metrics);
}

static void filelayout_write_release(void *data)
{
struct nfs_write_data *wdata = (struct nfs_write_data *)data;
Expand All @@ -288,18 +304,21 @@ static void filelayout_commit_release(void *data)
struct rpc_call_ops filelayout_read_call_ops = {
.rpc_call_prepare = filelayout_read_prepare,
.rpc_call_done = filelayout_read_call_done,
.rpc_count_stats = filelayout_read_count_stats,
.rpc_release = filelayout_read_release,
};

struct rpc_call_ops filelayout_write_call_ops = {
.rpc_call_prepare = filelayout_write_prepare,
.rpc_call_done = filelayout_write_call_done,
.rpc_count_stats = filelayout_write_count_stats,
.rpc_release = filelayout_write_release,
};

struct rpc_call_ops filelayout_commit_call_ops = {
.rpc_call_prepare = filelayout_write_prepare,
.rpc_call_done = filelayout_write_call_done,
.rpc_count_stats = filelayout_write_count_stats,
.rpc_release = filelayout_commit_release,
};

Expand Down
6 changes: 4 additions & 2 deletions trunk/include/linux/sunrpc/metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ struct rpc_clnt;
#ifdef CONFIG_PROC_FS

struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *);
void rpc_count_iostats(struct rpc_task *);
void rpc_count_iostats(const struct rpc_task *,
struct rpc_iostats *);
void rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
void rpc_free_iostats(struct rpc_iostats *);

#else /* CONFIG_PROC_FS */

static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
static inline void rpc_count_iostats(struct rpc_task *task) {}
static inline void rpc_count_iostats(const struct rpc_task *task,
struct rpc_iostats *stats) {}
static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
static inline void rpc_free_iostats(struct rpc_iostats *stats) {}

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/sunrpc/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ typedef void (*rpc_action)(struct rpc_task *);
struct rpc_call_ops {
void (*rpc_call_prepare)(struct rpc_task *, void *);
void (*rpc_call_done)(struct rpc_task *, void *);
void (*rpc_count_stats)(struct rpc_task *, void *);
void (*rpc_release)(void *);
};

Expand Down
8 changes: 4 additions & 4 deletions trunk/net/sunrpc/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,19 @@ EXPORT_SYMBOL_GPL(rpc_free_iostats);
/**
* rpc_count_iostats - tally up per-task stats
* @task: completed rpc_task
* @stats: array of stat structures
*
* Relies on the caller for serialization.
*/
void rpc_count_iostats(struct rpc_task *task)
void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
{
struct rpc_rqst *req = task->tk_rqstp;
struct rpc_iostats *stats;
struct rpc_iostats *op_metrics;
ktime_t delta;

if (!task->tk_client || !task->tk_client->cl_metrics || !req)
if (!stats || !req)
return;

stats = task->tk_client->cl_metrics;
op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx];

op_metrics->om_ops++;
Expand All @@ -164,6 +163,7 @@ void rpc_count_iostats(struct rpc_task *task)
delta = ktime_sub(ktime_get(), task->tk_start);
op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta);
}
EXPORT_SYMBOL_GPL(rpc_count_iostats);

static void _print_name(struct seq_file *seq, unsigned int op,
struct rpc_procinfo *procs)
Expand Down
5 changes: 4 additions & 1 deletion trunk/net/sunrpc/xprt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,10 @@ void xprt_release(struct rpc_task *task)
return;

xprt = req->rq_xprt;
rpc_count_iostats(task);
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);
spin_lock_bh(&xprt->transport_lock);
xprt->ops->release_xprt(xprt, task);
if (xprt->ops->release_request)
Expand Down

0 comments on commit e468aa1

Please sign in to comment.