Skip to content

Commit

Permalink
pnfs: save layoutcommit lwb at layout header
Browse files Browse the repository at this point in the history
No need to save it for every lseg.

[Needed in v3.0]
CC: Stable Tree <stable@kernel.org>
Signed-off-by: Peng Tao <peng_tao@emc.com>
Signed-off-by: Jim Rees <rees@umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Peng Tao authored and Trond Myklebust committed Jul 31, 2011
1 parent 374e4e3 commit acff588
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fs/nfs/nfs4filelayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ filelayout_set_layoutcommit(struct nfs_write_data *wdata)

pnfs_set_layoutcommit(wdata);
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);
}

/*
Expand Down
10 changes: 6 additions & 4 deletions fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1379,9 +1379,11 @@ pnfs_set_layoutcommit(struct nfs_write_data *wdata)
dprintk("%s: Set layoutcommit for inode %lu ",
__func__, wdata->inode->i_ino);
}
if (end_pos > wdata->lseg->pls_end_pos)
wdata->lseg->pls_end_pos = end_pos;
if (end_pos > nfsi->layout->plh_lwb)
nfsi->layout->plh_lwb = end_pos;
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
* will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */
Expand Down Expand Up @@ -1433,9 +1435,9 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
*/
lseg = pnfs_list_write_lseg(inode);

end_pos = lseg->pls_end_pos;
end_pos = nfsi->layout->plh_lwb;
cred = lseg->pls_lc_cred;
lseg->pls_end_pos = 0;
nfsi->layout->plh_lwb = 0;
lseg->pls_lc_cred = NULL;

memcpy(&data->args.stateid.data, nfsi->layout->plh_stateid.data,
Expand Down
2 changes: 1 addition & 1 deletion fs/nfs/pnfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ struct pnfs_layout_segment {
unsigned long pls_flags;
struct pnfs_layout_hdr *pls_layout;
struct rpc_cred *pls_lc_cred; /* LAYOUTCOMMIT credential */
loff_t pls_end_pos; /* LAYOUTCOMMIT write end */
};

enum pnfs_try_status {
Expand Down Expand Up @@ -125,6 +124,7 @@ struct pnfs_layout_hdr {
unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */
u32 plh_barrier; /* ignore lower seqids */
unsigned long plh_flags;
loff_t plh_lwb; /* last write byte for layoutcommit */
struct inode *plh_inode;
};

Expand Down

0 comments on commit acff588

Please sign in to comment.