aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-02-19 19:46:56 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-03-05 15:44:53 -0500
commit8fc795f703c5138e1a8bfb88c69f52632031aa6a (patch)
treeaed975562fe5557ff552bc0fe45b5d2b6f5e56c9
parent9467c4fdd66f6810cecef0f1173330f3c6e67d45 (diff)
NFS: Cleanup - move nfs_write_inode() into fs/nfs/write.c
The sole purpose of nfs_write_inode is to commit unstable writes, so move it into fs/nfs/write.c, and make nfs_commit_inode static. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/inode.c12
-rw-r--r--fs/nfs/write.c24
-rw-r--r--include/linux/nfs_fs.h7
3 files changed, 23 insertions, 20 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 7f9ecc46f3fb..89e98312599d 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -97,18 +97,6 @@ u64 nfs_compat_user_ino64(u64 fileid)
97 return ino; 97 return ino;
98} 98}
99 99
100int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
101{
102 int ret;
103
104 ret = nfs_commit_inode(inode,
105 wbc->sync_mode == WB_SYNC_ALL ? FLUSH_SYNC : 0);
106 if (ret >= 0)
107 return 0;
108 __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
109 return ret;
110}
111
112void nfs_clear_inode(struct inode *inode) 100void nfs_clear_inode(struct inode *inode)
113{ 101{
114 /* 102 /*
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index d63d964a0392..09e97097baaa 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1391,7 +1391,7 @@ static const struct rpc_call_ops nfs_commit_ops = {
1391 .rpc_release = nfs_commit_release, 1391 .rpc_release = nfs_commit_release,
1392}; 1392};
1393 1393
1394int nfs_commit_inode(struct inode *inode, int how) 1394static int nfs_commit_inode(struct inode *inode, int how)
1395{ 1395{
1396 LIST_HEAD(head); 1396 LIST_HEAD(head);
1397 int res; 1397 int res;
@@ -1406,13 +1406,35 @@ int nfs_commit_inode(struct inode *inode, int how)
1406 } 1406 }
1407 return res; 1407 return res;
1408} 1408}
1409
1410static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_control *wbc)
1411{
1412 int ret;
1413
1414 ret = nfs_commit_inode(inode,
1415 wbc->sync_mode == WB_SYNC_ALL ? FLUSH_SYNC : 0);
1416 if (ret >= 0)
1417 return 0;
1418 __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
1419 return ret;
1420}
1409#else 1421#else
1410static inline int nfs_commit_list(struct inode *inode, struct list_head *head, int how) 1422static inline int nfs_commit_list(struct inode *inode, struct list_head *head, int how)
1411{ 1423{
1412 return 0; 1424 return 0;
1413} 1425}
1426
1427static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_control *wbc)
1428{
1429 return 0;
1430}
1414#endif 1431#endif
1415 1432
1433int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
1434{
1435 return nfs_commit_unstable_pages(inode, wbc);
1436}
1437
1416long nfs_sync_mapping_wait(struct address_space *mapping, struct writeback_control *wbc, int how) 1438long nfs_sync_mapping_wait(struct address_space *mapping, struct writeback_control *wbc, int how)
1417{ 1439{
1418 struct inode *inode = mapping->host; 1440 struct inode *inode = mapping->host;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index d09db1bc9083..384ea3ef2863 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -483,15 +483,8 @@ extern int nfs_wb_nocommit(struct inode *inode);
483extern int nfs_wb_page(struct inode *inode, struct page* page); 483extern int nfs_wb_page(struct inode *inode, struct page* page);
484extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 484extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
485#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 485#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
486extern int nfs_commit_inode(struct inode *, int);
487extern struct nfs_write_data *nfs_commitdata_alloc(void); 486extern struct nfs_write_data *nfs_commitdata_alloc(void);
488extern void nfs_commit_free(struct nfs_write_data *wdata); 487extern void nfs_commit_free(struct nfs_write_data *wdata);
489#else
490static inline int
491nfs_commit_inode(struct inode *inode, int how)
492{
493 return 0;
494}
495#endif 488#endif
496 489
497static inline int 490static inline int