Skip to content

Commit

Permalink
nfs: Provide and use helper functions for marking a page as unstable
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Haynes <loghyr@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
Tom Haynes authored and Trond Myklebust committed Feb 13, 2015
1 parent 6bec003 commit d15bc38
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
9 changes: 2 additions & 7 deletions fs/nfs/filelayout/filelayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,13 +1000,8 @@ filelayout_mark_request_commit(struct nfs_page *req,
nfs_list_add_request(req, list);
cinfo->mds->ncommit++;
spin_unlock(cinfo->lock);
if (!cinfo->dreq) {
inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
inc_bdi_stat(inode_to_bdi(page_file_mapping(req->wb_page)->host),
BDI_RECLAIMABLE);
__mark_inode_dirty(req->wb_context->dentry->d_inode,
I_DIRTY_DATASYNC);
}
if (!cinfo->dreq)
nfs_mark_page_unstable(req->wb_page);
}

static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i)
Expand Down
9 changes: 2 additions & 7 deletions fs/nfs/flexfilelayout/flexfilelayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,13 +1364,8 @@ ff_layout_mark_request_commit(struct nfs_page *req,
nfs_list_add_request(req, list);
cinfo->mds->ncommit++;
spin_unlock(cinfo->lock);
if (!cinfo->dreq) {
inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
inc_bdi_stat(inode_to_bdi(page_file_mapping(req->wb_page)->host),
BDI_RECLAIMABLE);
__mark_inode_dirty(req->wb_context->dentry->d_inode,
I_DIRTY_DATASYNC);
}
if (!cinfo->dreq)
nfs_mark_page_unstable(req->wb_page);
}

static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i)
Expand Down
13 changes: 13 additions & 0 deletions fs/nfs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,19 @@ void nfs_super_set_maxbytes(struct super_block *sb, __u64 maxfilesize)
sb->s_maxbytes = MAX_LFS_FILESIZE;
}

/*
* Record the page as unstable and mark its inode as dirty.
*/
static inline
void nfs_mark_page_unstable(struct page *page)
{
struct inode *inode = page_file_mapping(page)->host;

inc_zone_page_state(page, NR_UNSTABLE_NFS);
inc_bdi_stat(inode_to_bdi(inode), BDI_RECLAIMABLE);
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
}

/*
* Determine the number of bytes of data the page contains
*/
Expand Down
9 changes: 2 additions & 7 deletions fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,13 +789,8 @@ nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst,
nfs_list_add_request(req, dst);
cinfo->mds->ncommit++;
spin_unlock(cinfo->lock);
if (!cinfo->dreq) {
inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
inc_bdi_stat(inode_to_bdi(page_file_mapping(req->wb_page)->host),
BDI_RECLAIMABLE);
__mark_inode_dirty(req->wb_context->dentry->d_inode,
I_DIRTY_DATASYNC);
}
if (!cinfo->dreq)
nfs_mark_page_unstable(req->wb_page);
}
EXPORT_SYMBOL_GPL(nfs_request_add_commit_list);

Expand Down

0 comments on commit d15bc38

Please sign in to comment.