Skip to content

Commit d15bc38

Browse files
Tom Haynestrondmypd
authored andcommitted
nfs: Provide and use helper functions for marking a page as unstable
Signed-off-by: Tom Haynes <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 6bec003 commit d15bc38

File tree

4 files changed

+19
-21
lines changed

4 files changed

+19
-21
lines changed

fs/nfs/filelayout/filelayout.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,13 +1000,8 @@ filelayout_mark_request_commit(struct nfs_page *req,
10001000
nfs_list_add_request(req, list);
10011001
cinfo->mds->ncommit++;
10021002
spin_unlock(cinfo->lock);
1003-
if (!cinfo->dreq) {
1004-
inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
1005-
inc_bdi_stat(inode_to_bdi(page_file_mapping(req->wb_page)->host),
1006-
BDI_RECLAIMABLE);
1007-
__mark_inode_dirty(req->wb_context->dentry->d_inode,
1008-
I_DIRTY_DATASYNC);
1009-
}
1003+
if (!cinfo->dreq)
1004+
nfs_mark_page_unstable(req->wb_page);
10101005
}
10111006

10121007
static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i)

fs/nfs/flexfilelayout/flexfilelayout.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,13 +1364,8 @@ ff_layout_mark_request_commit(struct nfs_page *req,
13641364
nfs_list_add_request(req, list);
13651365
cinfo->mds->ncommit++;
13661366
spin_unlock(cinfo->lock);
1367-
if (!cinfo->dreq) {
1368-
inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
1369-
inc_bdi_stat(inode_to_bdi(page_file_mapping(req->wb_page)->host),
1370-
BDI_RECLAIMABLE);
1371-
__mark_inode_dirty(req->wb_context->dentry->d_inode,
1372-
I_DIRTY_DATASYNC);
1373-
}
1367+
if (!cinfo->dreq)
1368+
nfs_mark_page_unstable(req->wb_page);
13741369
}
13751370

13761371
static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i)

fs/nfs/internal.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,19 @@ void nfs_super_set_maxbytes(struct super_block *sb, __u64 maxfilesize)
597597
sb->s_maxbytes = MAX_LFS_FILESIZE;
598598
}
599599

600+
/*
601+
* Record the page as unstable and mark its inode as dirty.
602+
*/
603+
static inline
604+
void nfs_mark_page_unstable(struct page *page)
605+
{
606+
struct inode *inode = page_file_mapping(page)->host;
607+
608+
inc_zone_page_state(page, NR_UNSTABLE_NFS);
609+
inc_bdi_stat(inode_to_bdi(inode), BDI_RECLAIMABLE);
610+
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
611+
}
612+
600613
/*
601614
* Determine the number of bytes of data the page contains
602615
*/

fs/nfs/write.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,13 +789,8 @@ nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst,
789789
nfs_list_add_request(req, dst);
790790
cinfo->mds->ncommit++;
791791
spin_unlock(cinfo->lock);
792-
if (!cinfo->dreq) {
793-
inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
794-
inc_bdi_stat(inode_to_bdi(page_file_mapping(req->wb_page)->host),
795-
BDI_RECLAIMABLE);
796-
__mark_inode_dirty(req->wb_context->dentry->d_inode,
797-
I_DIRTY_DATASYNC);
798-
}
792+
if (!cinfo->dreq)
793+
nfs_mark_page_unstable(req->wb_page);
799794
}
800795
EXPORT_SYMBOL_GPL(nfs_request_add_commit_list);
801796

0 commit comments

Comments
 (0)