aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/file.c2
-rw-r--r--fs/nfs/write.c44
2 files changed, 45 insertions, 1 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index c87dc713b5d7..579cf8a7d4a7 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -316,7 +316,7 @@ static void nfs_invalidate_page(struct page *page, unsigned long offset)
316 if (offset != 0) 316 if (offset != 0)
317 return; 317 return;
318 /* Cancel any unstarted writes on this page */ 318 /* Cancel any unstarted writes on this page */
319 nfs_wb_page_priority(page->mapping->host, page, FLUSH_INVALIDATE); 319 nfs_wb_page_cancel(page->mapping->host, page);
320} 320}
321 321
322static int nfs_release_page(struct page *page, gfp_t gfp) 322static int nfs_release_page(struct page *page, gfp_t gfp)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index ef97e0c0f5b1..0d7a77cc394b 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1396,6 +1396,50 @@ out:
1396 return ret; 1396 return ret;
1397} 1397}
1398 1398
1399int nfs_wb_page_cancel(struct inode *inode, struct page *page)
1400{
1401 struct nfs_page *req;
1402 loff_t range_start = page_offset(page);
1403 loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1);
1404 struct writeback_control wbc = {
1405 .bdi = page->mapping->backing_dev_info,
1406 .sync_mode = WB_SYNC_ALL,
1407 .nr_to_write = LONG_MAX,
1408 .range_start = range_start,
1409 .range_end = range_end,
1410 };
1411 int ret = 0;
1412
1413 BUG_ON(!PageLocked(page));
1414 for (;;) {
1415 req = nfs_page_find_request(page);
1416 if (req == NULL)
1417 goto out;
1418 if (test_bit(PG_NEED_COMMIT, &req->wb_flags)) {
1419 nfs_release_request(req);
1420 break;
1421 }
1422 if (nfs_lock_request_dontget(req)) {
1423 nfs_inode_remove_request(req);
1424 /*
1425 * In case nfs_inode_remove_request has marked the
1426 * page as being dirty
1427 */
1428 cancel_dirty_page(page, PAGE_CACHE_SIZE);
1429 nfs_unlock_request(req);
1430 break;
1431 }
1432 ret = nfs_wait_on_request(req);
1433 if (ret < 0)
1434 goto out;
1435 }
1436 if (!PagePrivate(page))
1437 return 0;
1438 ret = nfs_sync_mapping_wait(page->mapping, &wbc, FLUSH_INVALIDATE);
1439out:
1440 return ret;
1441}
1442
1399int nfs_wb_page_priority(struct inode *inode, struct page *page, int how) 1443int nfs_wb_page_priority(struct inode *inode, struct page *page, int how)
1400{ 1444{
1401 loff_t range_start = page_offset(page); 1445 loff_t range_start = page_offset(page);