summaryrefslogtreecommitdiff
path: root/fs/nfs/flexfilelayout/flexfilelayout.c
diff options
context:
space:
mode:
authorPeng Tao <tao.peng@primarydata.com>2015-06-23 19:52:00 +0800
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-06-24 10:53:10 -0400
commitd983803d3818a7aef3200147c72a45f573d84537 (patch)
treec16ffa854654b17a7b6a19f618536e6c1a9f087c /fs/nfs/flexfilelayout/flexfilelayout.c
parentabcb7bfc9fdecd1550b98a5e13d40bfba6c0649b (diff)
pNFS/flexfiles: track when layout is first used
So that we can report cumulative time since the beginning of statistics collection of the layout. Reviewed-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Peng Tao <tao.peng@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/flexfilelayout/flexfilelayout.c')
-rw-r--r--fs/nfs/flexfilelayout/flexfilelayout.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 8ac31fbf040a..4215278c9c76 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -451,9 +451,13 @@ nfs4_ff_layout_calc_completion_time(struct rpc_task *task)
}
static void
-nfs4_ff_layoutstat_start_io(struct nfs4_ff_layoutstat *layoutstat)
+nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror,
+ struct nfs4_ff_layoutstat *layoutstat)
{
+ static const ktime_t notime = {0};
+
nfs4_ff_start_busy_timer(&layoutstat->busy_timer);
+ cmpxchg(&mirror->start_time, notime, ktime_get());
}
static void
@@ -491,7 +495,7 @@ nfs4_ff_layout_stat_io_start_read(struct nfs4_ff_layout_mirror *mirror,
__u64 requested)
{
spin_lock(&mirror->lock);
- nfs4_ff_layoutstat_start_io(&mirror->read_stat);
+ nfs4_ff_layoutstat_start_io(mirror, &mirror->read_stat);
nfs4_ff_layout_stat_io_update_requested(&mirror->read_stat, requested);
spin_unlock(&mirror->lock);
}
@@ -514,7 +518,7 @@ nfs4_ff_layout_stat_io_start_write(struct nfs4_ff_layout_mirror *mirror,
__u64 requested)
{
spin_lock(&mirror->lock);
- nfs4_ff_layoutstat_start_io(&mirror->write_stat);
+ nfs4_ff_layoutstat_start_io(mirror, &mirror->write_stat);
nfs4_ff_layout_stat_io_update_requested(&mirror->write_stat, requested);
spin_unlock(&mirror->lock);
}