diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-20 13:13:28 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-10-09 17:15:18 -0400 |
commit | ed90ef51a33f572fa7d00c8b05f7457be727e74f (patch) | |
tree | 4c41336dd045cd9a857454a5d8a595288d64d6e1 /fs | |
parent | 90e9a3f9b0a14198a8ae5a0a5c13ad30f0b8b40d (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')
-rw-r--r-- | fs/nfs/inode.c | 2 | ||||
-rw-r--r-- | fs/nfs/write.c | 41 |
2 files changed, 15 insertions, 28 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 71a49c3acabd..119fefef13f3 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -431,7 +431,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
431 | 431 | ||
432 | /* Flush out writes to the server in order to update c/mtime */ | 432 | /* Flush out writes to the server in order to update c/mtime */ |
433 | if (S_ISREG(inode->i_mode)) | 433 | if (S_ISREG(inode->i_mode)) |
434 | nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT); | 434 | nfs_wb_nocommit(inode); |
435 | 435 | ||
436 | /* | 436 | /* |
437 | * We may force a getattr if the user cares about atime. | 437 | * We may force a getattr if the user cares about atime. |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 667ff27ef235..75adb8e78db9 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 | |||
1325 | return ret; | 1325 | return ret; |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | /* | 1328 | static int nfs_write_mapping(struct address_space *mapping, int how) |
1329 | * flush the inode to disk. | ||
1330 | */ | ||
1331 | int nfs_wb_all(struct inode *inode) | ||
1332 | { | 1329 | { |
1333 | struct address_space *mapping = inode->i_mapping; | ||
1334 | struct writeback_control wbc = { | 1330 | struct writeback_control wbc = { |
1335 | .bdi = mapping->backing_dev_info, | 1331 | .bdi = mapping->backing_dev_info, |
1336 | .sync_mode = WB_SYNC_ALL, | 1332 | .sync_mode = WB_SYNC_ALL, |
@@ -1343,35 +1339,26 @@ int nfs_wb_all(struct inode *inode) | |||
1343 | ret = nfs_writepages(mapping, &wbc); | 1339 | ret = nfs_writepages(mapping, &wbc); |
1344 | if (ret < 0) | 1340 | if (ret < 0) |
1345 | goto out; | 1341 | goto out; |
1346 | ret = nfs_sync_mapping_wait(mapping, &wbc, 0); | 1342 | ret = nfs_sync_mapping_wait(mapping, &wbc, how); |
1347 | if (ret >= 0) | 1343 | if (ret < 0) |
1348 | return 0; | 1344 | goto out; |
1345 | return 0; | ||
1349 | out: | 1346 | out: |
1350 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | 1347 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); |
1351 | return ret; | 1348 | return ret; |
1352 | } | 1349 | } |
1353 | 1350 | ||
1354 | int nfs_sync_mapping_range(struct address_space *mapping, loff_t range_start, loff_t range_end, int how) | 1351 | /* |
1352 | * flush the inode to disk. | ||
1353 | */ | ||
1354 | int nfs_wb_all(struct inode *inode) | ||
1355 | { | 1355 | { |
1356 | struct writeback_control wbc = { | 1356 | return nfs_write_mapping(inode->i_mapping, 0); |
1357 | .bdi = mapping->backing_dev_info, | 1357 | } |
1358 | .sync_mode = WB_SYNC_ALL, | ||
1359 | .nr_to_write = LONG_MAX, | ||
1360 | .range_start = range_start, | ||
1361 | .range_end = range_end, | ||
1362 | .for_writepages = 1, | ||
1363 | }; | ||
1364 | int ret; | ||
1365 | 1358 | ||
1366 | ret = nfs_writepages(mapping, &wbc); | 1359 | int nfs_wb_nocommit(struct inode *inode) |
1367 | if (ret < 0) | 1360 | { |
1368 | goto out; | 1361 | return nfs_write_mapping(inode->i_mapping, FLUSH_NOCOMMIT); |
1369 | ret = nfs_sync_mapping_wait(mapping, &wbc, how); | ||
1370 | if (ret >= 0) | ||
1371 | return 0; | ||
1372 | out: | ||
1373 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | ||
1374 | return ret; | ||
1375 | } | 1362 | } |
1376 | 1363 | ||
1377 | int nfs_wb_page_cancel(struct inode *inode, struct page *page) | 1364 | int nfs_wb_page_cancel(struct inode *inode, struct page *page) |