Commit 06946c6a authored by Trond Myklebust's avatar Trond Myklebust

pNFS/flexfiles: Only send layoutstats updates for mirrors that were updated

If there have been no reads or writes to a given mirror since the last
layoutstats update, then don't resend the same data.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 46c98c6d
...@@ -705,6 +705,7 @@ nfs4_ff_layout_stat_io_start_read(struct inode *inode, ...@@ -705,6 +705,7 @@ nfs4_ff_layout_stat_io_start_read(struct inode *inode,
spin_lock(&mirror->lock); spin_lock(&mirror->lock);
report = nfs4_ff_layoutstat_start_io(mirror, &mirror->read_stat, now); report = nfs4_ff_layoutstat_start_io(mirror, &mirror->read_stat, now);
nfs4_ff_layout_stat_io_update_requested(&mirror->read_stat, requested); nfs4_ff_layout_stat_io_update_requested(&mirror->read_stat, requested);
set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags);
spin_unlock(&mirror->lock); spin_unlock(&mirror->lock);
if (report) if (report)
...@@ -721,6 +722,7 @@ nfs4_ff_layout_stat_io_end_read(struct rpc_task *task, ...@@ -721,6 +722,7 @@ nfs4_ff_layout_stat_io_end_read(struct rpc_task *task,
nfs4_ff_layout_stat_io_update_completed(&mirror->read_stat, nfs4_ff_layout_stat_io_update_completed(&mirror->read_stat,
requested, completed, requested, completed,
ktime_get(), task->tk_start); ktime_get(), task->tk_start);
set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags);
spin_unlock(&mirror->lock); spin_unlock(&mirror->lock);
} }
...@@ -734,6 +736,7 @@ nfs4_ff_layout_stat_io_start_write(struct inode *inode, ...@@ -734,6 +736,7 @@ nfs4_ff_layout_stat_io_start_write(struct inode *inode,
spin_lock(&mirror->lock); spin_lock(&mirror->lock);
report = nfs4_ff_layoutstat_start_io(mirror , &mirror->write_stat, now); report = nfs4_ff_layoutstat_start_io(mirror , &mirror->write_stat, now);
nfs4_ff_layout_stat_io_update_requested(&mirror->write_stat, requested); nfs4_ff_layout_stat_io_update_requested(&mirror->write_stat, requested);
set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags);
spin_unlock(&mirror->lock); spin_unlock(&mirror->lock);
if (report) if (report)
...@@ -753,6 +756,7 @@ nfs4_ff_layout_stat_io_end_write(struct rpc_task *task, ...@@ -753,6 +756,7 @@ nfs4_ff_layout_stat_io_end_write(struct rpc_task *task,
spin_lock(&mirror->lock); spin_lock(&mirror->lock);
nfs4_ff_layout_stat_io_update_completed(&mirror->write_stat, nfs4_ff_layout_stat_io_update_completed(&mirror->write_stat,
requested, completed, ktime_get(), task->tk_start); requested, completed, ktime_get(), task->tk_start);
set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags);
spin_unlock(&mirror->lock); spin_unlock(&mirror->lock);
} }
...@@ -2201,6 +2205,8 @@ ff_layout_mirror_prepare_stats(struct nfs42_layoutstat_args *args, ...@@ -2201,6 +2205,8 @@ ff_layout_mirror_prepare_stats(struct nfs42_layoutstat_args *args,
break; break;
if (!mirror->mirror_ds) if (!mirror->mirror_ds)
continue; continue;
if (!test_and_clear_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags))
continue;
/* mirror refcount put in cleanup_layoutstats */ /* mirror refcount put in cleanup_layoutstats */
if (!atomic_inc_not_zero(&mirror->ref)) if (!atomic_inc_not_zero(&mirror->ref))
continue; continue;
......
...@@ -81,12 +81,15 @@ struct nfs4_ff_layout_mirror { ...@@ -81,12 +81,15 @@ struct nfs4_ff_layout_mirror {
struct rpc_cred __rcu *rw_cred; struct rpc_cred __rcu *rw_cred;
atomic_t ref; atomic_t ref;
spinlock_t lock; spinlock_t lock;
unsigned long flags;
struct nfs4_ff_layoutstat read_stat; struct nfs4_ff_layoutstat read_stat;
struct nfs4_ff_layoutstat write_stat; struct nfs4_ff_layoutstat write_stat;
ktime_t start_time; ktime_t start_time;
u32 report_interval; u32 report_interval;
}; };
#define NFS4_FF_MIRROR_STAT_AVAIL (0)
struct nfs4_ff_layout_segment { struct nfs4_ff_layout_segment {
struct pnfs_layout_segment generic_hdr; struct pnfs_layout_segment generic_hdr;
u64 stripe_unit; u64 stripe_unit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment