Commit 141b9b59 authored by Peng Tao's avatar Peng Tao Committed by Trond Myklebust

pnfs/flexfiles: count io stat in rpc_count_stats callback

If client ever restarts IO due to some errors, we'll endup
mis-counting IO stats if we do the counting in .rpc_done
callback. Move it to .rpc_count_stats callback that is only
called when releasing RPC.
Signed-off-by: default avatarPeng Tao <tao.peng@primarydata.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent c22eeb86
...@@ -1516,11 +1516,6 @@ static void ff_layout_write_call_done(struct rpc_task *task, void *data) ...@@ -1516,11 +1516,6 @@ static void ff_layout_write_call_done(struct rpc_task *task, void *data)
{ {
struct nfs_pgio_header *hdr = data; struct nfs_pgio_header *hdr = data;
nfs4_ff_layout_stat_io_end_write(task,
FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx),
hdr->args.count, hdr->res.count,
hdr->res.verf->committed);
if (test_bit(NFS_IOHDR_REDO, &hdr->flags) && if (test_bit(NFS_IOHDR_REDO, &hdr->flags) &&
task->tk_status == 0) { task->tk_status == 0) {
nfs4_sequence_done(task, &hdr->res.seq_res); nfs4_sequence_done(task, &hdr->res.seq_res);
...@@ -1535,6 +1530,11 @@ static void ff_layout_write_count_stats(struct rpc_task *task, void *data) ...@@ -1535,6 +1530,11 @@ static void ff_layout_write_count_stats(struct rpc_task *task, void *data)
{ {
struct nfs_pgio_header *hdr = data; struct nfs_pgio_header *hdr = data;
nfs4_ff_layout_stat_io_end_write(task,
FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx),
hdr->args.count, hdr->res.count,
hdr->res.verf->committed);
rpc_count_iostats_metrics(task, rpc_count_iostats_metrics(task,
&NFS_CLIENT(hdr->inode)->cl_metrics[NFSPROC4_CLNT_WRITE]); &NFS_CLIENT(hdr->inode)->cl_metrics[NFSPROC4_CLNT_WRITE]);
} }
...@@ -1566,6 +1566,11 @@ static void ff_layout_commit_prepare_v4(struct rpc_task *task, void *data) ...@@ -1566,6 +1566,11 @@ static void ff_layout_commit_prepare_v4(struct rpc_task *task, void *data)
} }
static void ff_layout_commit_done(struct rpc_task *task, void *data) static void ff_layout_commit_done(struct rpc_task *task, void *data)
{
pnfs_generic_write_commit_done(task, data);
}
static void ff_layout_commit_count_stats(struct rpc_task *task, void *data)
{ {
struct nfs_commit_data *cdata = data; struct nfs_commit_data *cdata = data;
struct nfs_page *req; struct nfs_page *req;
...@@ -1580,13 +1585,6 @@ static void ff_layout_commit_done(struct rpc_task *task, void *data) ...@@ -1580,13 +1585,6 @@ static void ff_layout_commit_done(struct rpc_task *task, void *data)
FF_LAYOUT_COMP(cdata->lseg, cdata->ds_commit_index), FF_LAYOUT_COMP(cdata->lseg, cdata->ds_commit_index),
count, count, NFS_FILE_SYNC); count, count, NFS_FILE_SYNC);
pnfs_generic_write_commit_done(task, data);
}
static void ff_layout_commit_count_stats(struct rpc_task *task, void *data)
{
struct nfs_commit_data *cdata = data;
rpc_count_iostats_metrics(task, rpc_count_iostats_metrics(task,
&NFS_CLIENT(cdata->inode)->cl_metrics[NFSPROC4_CLNT_COMMIT]); &NFS_CLIENT(cdata->inode)->cl_metrics[NFSPROC4_CLNT_COMMIT]);
} }
......
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