aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/write.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index dc08a6fbde67..fc05e35da6a9 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1415,12 +1415,30 @@ static int nfs_commit_inode(struct inode *inode, int how)
1415 1415
1416static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_control *wbc) 1416static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_control *wbc)
1417{ 1417{
1418 int ret; 1418 struct nfs_inode *nfsi = NFS_I(inode);
1419 int flags = FLUSH_SYNC;
1420 int ret = 0;
1419 1421
1420 ret = nfs_commit_inode(inode, 1422 /* Don't commit yet if this is a non-blocking flush and there are
1421 wbc->sync_mode == WB_SYNC_ALL ? FLUSH_SYNC : 0); 1423 * lots of outstanding writes for this mapping.
1422 if (ret >= 0) 1424 */
1425 if (wbc->sync_mode == WB_SYNC_NONE &&
1426 nfsi->ncommit <= (nfsi->npages >> 1))
1427 goto out_mark_dirty;
1428
1429 if (wbc->nonblocking)
1430 flags = 0;
1431 ret = nfs_commit_inode(inode, flags);
1432 if (ret >= 0) {
1433 if (wbc->sync_mode == WB_SYNC_NONE) {
1434 if (ret < wbc->nr_to_write)
1435 wbc->nr_to_write -= ret;
1436 else
1437 wbc->nr_to_write = 0;
1438 }
1423 return 0; 1439 return 0;
1440 }
1441out_mark_dirty:
1424 __mark_inode_dirty(inode, I_DIRTY_DATASYNC); 1442 __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
1425 return ret; 1443 return ret;
1426} 1444}