aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 4948dc1fbd74..1d72096c4d22 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -79,8 +79,7 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context*,
79 unsigned int, unsigned int); 79 unsigned int, unsigned int);
80static int nfs_wait_on_write_congestion(struct address_space *, int); 80static int nfs_wait_on_write_congestion(struct address_space *, int);
81static int nfs_wait_on_requests(struct inode *, unsigned long, unsigned int); 81static int nfs_wait_on_requests(struct inode *, unsigned long, unsigned int);
82static int nfs_flush_inode(struct inode *inode, unsigned long idx_start, 82static int nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how);
83 unsigned int npages, int how);
84static const struct rpc_call_ops nfs_write_partial_ops; 83static const struct rpc_call_ops nfs_write_partial_ops;
85static const struct rpc_call_ops nfs_write_full_ops; 84static const struct rpc_call_ops nfs_write_full_ops;
86static const struct rpc_call_ops nfs_commit_ops; 85static const struct rpc_call_ops nfs_commit_ops;
@@ -352,7 +351,7 @@ do_it:
352 if (!IS_SYNC(inode) && inode_referenced) { 351 if (!IS_SYNC(inode) && inode_referenced) {
353 err = nfs_writepage_async(ctx, inode, page, 0, offset); 352 err = nfs_writepage_async(ctx, inode, page, 0, offset);
354 if (!wbc->for_writepages) 353 if (!wbc->for_writepages)
355 nfs_flush_inode(inode, 0, 0, wb_priority(wbc)); 354 nfs_flush_mapping(page->mapping, wbc, wb_priority(wbc));
356 } else { 355 } else {
357 err = nfs_writepage_sync(ctx, inode, page, 0, 356 err = nfs_writepage_sync(ctx, inode, page, 0,
358 offset, priority); 357 offset, priority);
@@ -391,11 +390,10 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
391 return 0; 390 return 0;
392 nfs_wait_on_write_congestion(mapping, 0); 391 nfs_wait_on_write_congestion(mapping, 0);
393 } 392 }
394 err = nfs_flush_inode(inode, 0, 0, wb_priority(wbc)); 393 err = nfs_flush_mapping(mapping, wbc, wb_priority(wbc));
395 if (err < 0) 394 if (err < 0)
396 goto out; 395 goto out;
397 nfs_add_stats(inode, NFSIOS_WRITEPAGES, err); 396 nfs_add_stats(inode, NFSIOS_WRITEPAGES, err);
398 wbc->nr_to_write -= err;
399 if (!wbc->nonblocking && wbc->sync_mode == WB_SYNC_ALL) { 397 if (!wbc->nonblocking && wbc->sync_mode == WB_SYNC_ALL) {
400 err = nfs_wait_on_requests(inode, 0, 0); 398 err = nfs_wait_on_requests(inode, 0, 0);
401 if (err < 0) 399 if (err < 0)
@@ -1469,20 +1467,22 @@ static inline int nfs_commit_list(struct inode *inode, struct list_head *head, i
1469} 1467}
1470#endif 1468#endif
1471 1469
1472static int nfs_flush_inode(struct inode *inode, unsigned long idx_start, 1470static int nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how)
1473 unsigned int npages, int how)
1474{ 1471{
1475 struct nfs_inode *nfsi = NFS_I(inode); 1472 struct nfs_inode *nfsi = NFS_I(mapping->host);
1476 LIST_HEAD(head); 1473 LIST_HEAD(head);
1474 pgoff_t index = wbc->range_start >> PAGE_CACHE_SHIFT;
1475 unsigned long npages = 1 + (wbc->range_end >> PAGE_CACHE_SHIFT) - index;
1477 int res; 1476 int res;
1478 1477
1479 spin_lock(&nfsi->req_lock); 1478 spin_lock(&nfsi->req_lock);
1480 res = nfs_scan_dirty(inode, &head, idx_start, npages); 1479 res = nfs_scan_dirty(mapping->host, &head, index, npages);
1481 spin_unlock(&nfsi->req_lock); 1480 spin_unlock(&nfsi->req_lock);
1482 if (res) { 1481 if (res) {
1483 int error = nfs_flush_list(inode, &head, res, how); 1482 int error = nfs_flush_list(mapping->host, &head, res, how);
1484 if (error < 0) 1483 if (error < 0)
1485 return error; 1484 return error;
1485 wbc->nr_to_write -= res;
1486 } 1486 }
1487 return res; 1487 return res;
1488} 1488}