Commit a14f191c authored by Peng Tao's avatar Peng Tao Committed by Greg Kroah-Hartman

pnfs: save layoutcommit lwb at layout header

commit acff5880 upstream.

No need to save it for every lseg.

[Needed in v3.0]
Signed-off-by: default avatarPeng Tao <peng_tao@emc.com>
Signed-off-by: default avatarJim Rees <rees@umich.edu>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cb1d0a1e
...@@ -170,7 +170,7 @@ filelayout_set_layoutcommit(struct nfs_write_data *wdata) ...@@ -170,7 +170,7 @@ filelayout_set_layoutcommit(struct nfs_write_data *wdata)
pnfs_set_layoutcommit(wdata); pnfs_set_layoutcommit(wdata);
dprintk("%s ionde %lu pls_end_pos %lu\n", __func__, wdata->inode->i_ino, dprintk("%s ionde %lu pls_end_pos %lu\n", __func__, wdata->inode->i_ino,
(unsigned long) wdata->lseg->pls_end_pos); (unsigned long) NFS_I(wdata->inode)->layout->plh_lwb);
} }
/* /*
......
...@@ -1224,9 +1224,11 @@ pnfs_set_layoutcommit(struct nfs_write_data *wdata) ...@@ -1224,9 +1224,11 @@ pnfs_set_layoutcommit(struct nfs_write_data *wdata)
dprintk("%s: Set layoutcommit for inode %lu ", dprintk("%s: Set layoutcommit for inode %lu ",
__func__, wdata->inode->i_ino); __func__, wdata->inode->i_ino);
} }
if (end_pos > wdata->lseg->pls_end_pos) if (end_pos > nfsi->layout->plh_lwb)
wdata->lseg->pls_end_pos = end_pos; nfsi->layout->plh_lwb = end_pos;
spin_unlock(&nfsi->vfs_inode.i_lock); spin_unlock(&nfsi->vfs_inode.i_lock);
dprintk("%s: lseg %p end_pos %llu\n",
__func__, wdata->lseg, nfsi->layout->plh_lwb);
/* if pnfs_layoutcommit_inode() runs between inode locks, the next one /* if pnfs_layoutcommit_inode() runs between inode locks, the next one
* will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */ * will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */
...@@ -1278,9 +1280,9 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync) ...@@ -1278,9 +1280,9 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
*/ */
lseg = pnfs_list_write_lseg(inode); lseg = pnfs_list_write_lseg(inode);
end_pos = lseg->pls_end_pos; end_pos = nfsi->layout->plh_lwb;
cred = lseg->pls_lc_cred; cred = lseg->pls_lc_cred;
lseg->pls_end_pos = 0; nfsi->layout->plh_lwb = 0;
lseg->pls_lc_cred = NULL; lseg->pls_lc_cred = NULL;
memcpy(&data->args.stateid.data, nfsi->layout->plh_stateid.data, memcpy(&data->args.stateid.data, nfsi->layout->plh_stateid.data,
......
...@@ -45,7 +45,6 @@ struct pnfs_layout_segment { ...@@ -45,7 +45,6 @@ struct pnfs_layout_segment {
unsigned long pls_flags; unsigned long pls_flags;
struct pnfs_layout_hdr *pls_layout; struct pnfs_layout_hdr *pls_layout;
struct rpc_cred *pls_lc_cred; /* LAYOUTCOMMIT credential */ struct rpc_cred *pls_lc_cred; /* LAYOUTCOMMIT credential */
loff_t pls_end_pos; /* LAYOUTCOMMIT write end */
}; };
enum pnfs_try_status { enum pnfs_try_status {
...@@ -124,6 +123,7 @@ struct pnfs_layout_hdr { ...@@ -124,6 +123,7 @@ struct pnfs_layout_hdr {
unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */ unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */
u32 plh_barrier; /* ignore lower seqids */ u32 plh_barrier; /* ignore lower seqids */
unsigned long plh_flags; unsigned long plh_flags;
loff_t plh_lwb; /* last write byte for layoutcommit */
struct inode *plh_inode; struct inode *plh_inode;
}; };
......
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