aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTom Haynes <thomas.haynes@primarydata.com>2015-02-13 16:19:53 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-02-13 17:47:26 -0500
commitd15bc38df607c893c36f4962dca0f57174c6a5c9 (patch)
treed263dcfbfaed2de1fde01a028d14184dace7781b /fs
parent6bec0035286119eefc32a5b1102127e6a4032cb2 (diff)
nfs: Provide and use helper functions for marking a page as unstable
Signed-off-by: Tom Haynes <loghyr@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/filelayout/filelayout.c9
-rw-r--r--fs/nfs/flexfilelayout/flexfilelayout.c9
-rw-r--r--fs/nfs/internal.h13
-rw-r--r--fs/nfs/write.c9
4 files changed, 19 insertions, 21 deletions
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index 7ae1c263c5cf..e1e5ea262a13 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -1000,13 +1000,8 @@ mds_commit:
1000 nfs_list_add_request(req, list); 1000 nfs_list_add_request(req, list);
1001 cinfo->mds->ncommit++; 1001 cinfo->mds->ncommit++;
1002 spin_unlock(cinfo->lock); 1002 spin_unlock(cinfo->lock);
1003 if (!cinfo->dreq) { 1003 if (!cinfo->dreq)
1004 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 1004 nfs_mark_page_unstable(req->wb_page);
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 }
1010} 1005}
1011 1006
1012static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i) 1007static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index c22ecaa86c1c..423c2bc371fa 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1364,13 +1364,8 @@ ff_layout_mark_request_commit(struct nfs_page *req,
1364 nfs_list_add_request(req, list); 1364 nfs_list_add_request(req, list);
1365 cinfo->mds->ncommit++; 1365 cinfo->mds->ncommit++;
1366 spin_unlock(cinfo->lock); 1366 spin_unlock(cinfo->lock);
1367 if (!cinfo->dreq) { 1367 if (!cinfo->dreq)
1368 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 1368 nfs_mark_page_unstable(req->wb_page);
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 }
1374} 1369}
1375 1370
1376static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i) 1371static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i)
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 212b8c883d22..b802fb3a2d99 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -598,6 +598,19 @@ void nfs_super_set_maxbytes(struct super_block *sb, __u64 maxfilesize)
598} 598}
599 599
600/* 600/*
601 * Record the page as unstable and mark its inode as dirty.
602 */
603static inline
604void 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
613/*
601 * Determine the number of bytes of data the page contains 614 * Determine the number of bytes of data the page contains
602 */ 615 */
603static inline 616static inline
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 88a6d2196ece..76c278acaefc 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -789,13 +789,8 @@ nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst,
789 nfs_list_add_request(req, dst); 789 nfs_list_add_request(req, dst);
790 cinfo->mds->ncommit++; 790 cinfo->mds->ncommit++;
791 spin_unlock(cinfo->lock); 791 spin_unlock(cinfo->lock);
792 if (!cinfo->dreq) { 792 if (!cinfo->dreq)
793 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 793 nfs_mark_page_unstable(req->wb_page);
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 }
799} 794}
800EXPORT_SYMBOL_GPL(nfs_request_add_commit_list); 795EXPORT_SYMBOL_GPL(nfs_request_add_commit_list);
801 796