aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-02-19 20:03:21 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-03-05 15:44:55 -0500
commitc988950eb6dd6f8e6d98503ca094622729e9aa13 (patch)
tree5a5b34050d4f20909e7378108aa131e615ef52cd /fs/nfs
parent2928db1ffeacc9717c2d5c230d450bcc377b3ae9 (diff)
NFS: Simplify nfs_wb_page_cancel()
In all cases we should be able to just remove the request and call cancel_dirty_page(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/write.c39
1 files changed, 1 insertions, 38 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index e40e949598fd..dc7f5e9a23b4 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -540,19 +540,6 @@ static int nfs_wait_on_requests_locked(struct inode *inode, pgoff_t idx_start, u
540 return res; 540 return res;
541} 541}
542 542
543static void nfs_cancel_commit_list(struct list_head *head)
544{
545 struct nfs_page *req;
546
547 while(!list_empty(head)) {
548 req = nfs_list_entry(head->next);
549 nfs_list_remove_request(req);
550 nfs_clear_request_commit(req);
551 nfs_inode_remove_request(req);
552 nfs_unlock_request(req);
553 }
554}
555
556#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 543#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
557static int 544static int
558nfs_need_commit(struct nfs_inode *nfsi) 545nfs_need_commit(struct nfs_inode *nfsi)
@@ -1495,13 +1482,6 @@ long nfs_sync_mapping_wait(struct address_space *mapping, struct writeback_contr
1495 pages = nfs_scan_commit(inode, &head, idx_start, npages); 1482 pages = nfs_scan_commit(inode, &head, idx_start, npages);
1496 if (pages == 0) 1483 if (pages == 0)
1497 break; 1484 break;
1498 if (how & FLUSH_INVALIDATE) {
1499 spin_unlock(&inode->i_lock);
1500 nfs_cancel_commit_list(&head);
1501 ret = pages;
1502 spin_lock(&inode->i_lock);
1503 continue;
1504 }
1505 pages += nfs_scan_commit(inode, &head, 0, 0); 1485 pages += nfs_scan_commit(inode, &head, 0, 0);
1506 spin_unlock(&inode->i_lock); 1486 spin_unlock(&inode->i_lock);
1507 ret = nfs_commit_list(inode, &head, how); 1487 ret = nfs_commit_list(inode, &head, how);
@@ -1558,26 +1538,13 @@ int nfs_wb_nocommit(struct inode *inode)
1558int nfs_wb_page_cancel(struct inode *inode, struct page *page) 1538int nfs_wb_page_cancel(struct inode *inode, struct page *page)
1559{ 1539{
1560 struct nfs_page *req; 1540 struct nfs_page *req;
1561 loff_t range_start = page_offset(page);
1562 loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1);
1563 struct writeback_control wbc = {
1564 .bdi = page->mapping->backing_dev_info,
1565 .sync_mode = WB_SYNC_ALL,
1566 .nr_to_write = LONG_MAX,
1567 .range_start = range_start,
1568 .range_end = range_end,
1569 };
1570 int ret = 0; 1541 int ret = 0;
1571 1542
1572 BUG_ON(!PageLocked(page)); 1543 BUG_ON(!PageLocked(page));
1573 for (;;) { 1544 for (;;) {
1574 req = nfs_page_find_request(page); 1545 req = nfs_page_find_request(page);
1575 if (req == NULL) 1546 if (req == NULL)
1576 goto out;
1577 if (test_bit(PG_CLEAN, &req->wb_flags)) {
1578 nfs_release_request(req);
1579 break; 1547 break;
1580 }
1581 if (nfs_lock_request_dontget(req)) { 1548 if (nfs_lock_request_dontget(req)) {
1582 nfs_inode_remove_request(req); 1549 nfs_inode_remove_request(req);
1583 /* 1550 /*
@@ -1591,12 +1558,8 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page)
1591 ret = nfs_wait_on_request(req); 1558 ret = nfs_wait_on_request(req);
1592 nfs_release_request(req); 1559 nfs_release_request(req);
1593 if (ret < 0) 1560 if (ret < 0)
1594 goto out; 1561 break;
1595 } 1562 }
1596 if (!PagePrivate(page))
1597 return 0;
1598 ret = nfs_sync_mapping_wait(page->mapping, &wbc, FLUSH_INVALIDATE);
1599out:
1600 return ret; 1563 return ret;
1601} 1564}
1602 1565