diff mbox

[09/11] pnfs/flexfiles: reset IO statistics upon LAYOUTSTATS success

Message ID 1434466052-10491-10-git-send-email-tao.peng@primarydata.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peng Tao June 16, 2015, 2:47 p.m. UTC
Per RFC NFSv42 draft, client MUST reset the statistics after getting
a successfully reply from the metadata server.

Signed-off-by: Peng Tao <tao.peng@primarydata.com>
---
 fs/nfs/flexfilelayout/flexfilelayout.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox

Patch

diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 64beedd..4b79c74 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1881,6 +1881,14 @@  ff_layout_cleanup_layoutstats(struct nfs42_layoutstat_data *data)
 	for (i = 0; i < data->args.num_dev; i++) {
 		mirror = data->args.devinfo[i].layout_private;
 		data->args.devinfo[i].layout_private = NULL;
+		if (data->res.rpc_status == NFS4_OK) {
+			spin_lock(&mirror->lock);
+			memset(&mirror->read_stat.io_stat, 0,
+				sizeof(mirror->read_stat.io_stat));
+			memset(&mirror->write_stat.io_stat, 0,
+				sizeof(mirror->write_stat.io_stat));
+			spin_unlock(&mirror->lock);
+		}
 		pnfs_put_lseg(mirror->lseg);
 	}
 }