summaryrefslogtreecommitdiff
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-20 13:13:28 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-10-09 17:15:18 -0400
commited90ef51a33f572fa7d00c8b05f7457be727e74f (patch)
tree4c41336dd045cd9a857454a5d8a595288d64d6e1 /fs/nfs/write.c
parent90e9a3f9b0a14198a8ae5a0a5c13ad30f0b8b40d (diff)
NFS: Clean up NFS writeback flush code
The only user of nfs_sync_mapping_range() is nfs_getattr(), which uses it to flush out the entire inode without sending a commit. We therefore replace nfs_sync_mapping_range with a more appropriate helper. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c41
1 files changed, 14 insertions, 27 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 667ff27ef23..75adb8e78db 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1325,12 +1325,8 @@ long nfs_sync_mapping_wait(struct address_space *mapping, struct writeback_contr
return ret;
}
-/*
- * flush the inode to disk.
- */
-int nfs_wb_all(struct inode *inode)
+static int nfs_write_mapping(struct address_space *mapping, int how)
{
- struct address_space *mapping = inode->i_mapping;
struct writeback_control wbc = {
.bdi = mapping->backing_dev_info,
.sync_mode = WB_SYNC_ALL,
@@ -1343,35 +1339,26 @@ int nfs_wb_all(struct inode *inode)
ret = nfs_writepages(mapping, &wbc);
if (ret < 0)
goto out;
- ret = nfs_sync_mapping_wait(mapping, &wbc, 0);
- if (ret >= 0)
- return 0;
+ ret = nfs_sync_mapping_wait(mapping, &wbc, how);
+ if (ret < 0)
+ goto out;
+ return 0;
out:
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
return ret;
}
-int nfs_sync_mapping_range(struct address_space *mapping, loff_t range_start, loff_t range_end, int how)
+/*
+ * flush the inode to disk.
+ */
+int nfs_wb_all(struct inode *inode)
{
- struct writeback_control wbc = {
- .bdi = mapping->backing_dev_info,
- .sync_mode = WB_SYNC_ALL,
- .nr_to_write = LONG_MAX,
- .range_start = range_start,
- .range_end = range_end,
- .for_writepages = 1,
- };
- int ret;
+ return nfs_write_mapping(inode->i_mapping, 0);
+}
- ret = nfs_writepages(mapping, &wbc);
- if (ret < 0)
- goto out;
- ret = nfs_sync_mapping_wait(mapping, &wbc, how);
- if (ret >= 0)
- return 0;
-out:
- __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
- return ret;
+int nfs_wb_nocommit(struct inode *inode)
+{
+ return nfs_write_mapping(inode->i_mapping, FLUSH_NOCOMMIT);
}
int nfs_wb_page_cancel(struct inode *inode, struct page *page)