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.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 9347ab7c9574..5209916e1222 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -202,7 +202,6 @@ out:
202/* A writeback failed: mark the page as bad, and invalidate the page cache */ 202/* A writeback failed: mark the page as bad, and invalidate the page cache */
203static void nfs_set_pageerror(struct page *page) 203static void nfs_set_pageerror(struct page *page)
204{ 204{
205 SetPageError(page);
206 nfs_zap_mapping(page_file_mapping(page)->host, page_file_mapping(page)); 205 nfs_zap_mapping(page_file_mapping(page)->host, page_file_mapping(page));
207} 206}
208 207
@@ -239,21 +238,18 @@ int nfs_congestion_kb;
239#define NFS_CONGESTION_OFF_THRESH \ 238#define NFS_CONGESTION_OFF_THRESH \
240 (NFS_CONGESTION_ON_THRESH - (NFS_CONGESTION_ON_THRESH >> 2)) 239 (NFS_CONGESTION_ON_THRESH - (NFS_CONGESTION_ON_THRESH >> 2))
241 240
242static int nfs_set_page_writeback(struct page *page) 241static void nfs_set_page_writeback(struct page *page)
243{ 242{
243 struct nfs_server *nfss = NFS_SERVER(page_file_mapping(page)->host);
244 int ret = test_set_page_writeback(page); 244 int ret = test_set_page_writeback(page);
245 245
246 if (!ret) { 246 WARN_ON_ONCE(ret != 0);
247 struct inode *inode = page_file_mapping(page)->host;
248 struct nfs_server *nfss = NFS_SERVER(inode);
249 247
250 if (atomic_long_inc_return(&nfss->writeback) > 248 if (atomic_long_inc_return(&nfss->writeback) >
251 NFS_CONGESTION_ON_THRESH) { 249 NFS_CONGESTION_ON_THRESH) {
252 set_bdi_congested(&nfss->backing_dev_info, 250 set_bdi_congested(&nfss->backing_dev_info,
253 BLK_RW_ASYNC); 251 BLK_RW_ASYNC);
254 }
255 } 252 }
256 return ret;
257} 253}
258 254
259static void nfs_end_page_writeback(struct page *page) 255static void nfs_end_page_writeback(struct page *page)
@@ -315,10 +311,10 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
315 if (IS_ERR(req)) 311 if (IS_ERR(req))
316 goto out; 312 goto out;
317 313
318 ret = nfs_set_page_writeback(page); 314 nfs_set_page_writeback(page);
319 BUG_ON(ret != 0); 315 WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags));
320 BUG_ON(test_bit(PG_CLEAN, &req->wb_flags));
321 316
317 ret = 0;
322 if (!nfs_pageio_add_request(pgio, req)) { 318 if (!nfs_pageio_add_request(pgio, req)) {
323 nfs_redirty_request(req); 319 nfs_redirty_request(req);
324 ret = pgio->pg_error; 320 ret = pgio->pg_error;
@@ -451,8 +447,6 @@ static void nfs_inode_remove_request(struct nfs_page *req)
451 struct inode *inode = req->wb_context->dentry->d_inode; 447 struct inode *inode = req->wb_context->dentry->d_inode;
452 struct nfs_inode *nfsi = NFS_I(inode); 448 struct nfs_inode *nfsi = NFS_I(inode);
453 449
454 BUG_ON (!NFS_WBACK_BUSY(req));
455
456 spin_lock(&inode->i_lock); 450 spin_lock(&inode->i_lock);
457 if (likely(!PageSwapCache(req->wb_page))) { 451 if (likely(!PageSwapCache(req->wb_page))) {
458 set_page_private(req->wb_page, 0); 452 set_page_private(req->wb_page, 0);
@@ -884,7 +878,7 @@ static bool nfs_write_pageuptodate(struct page *page, struct inode *inode)
884{ 878{
885 if (nfs_have_delegated_attributes(inode)) 879 if (nfs_have_delegated_attributes(inode))
886 goto out; 880 goto out;
887 if (NFS_I(inode)->cache_validity & NFS_INO_REVAL_PAGECACHE) 881 if (NFS_I(inode)->cache_validity & (NFS_INO_INVALID_DATA|NFS_INO_REVAL_PAGECACHE))
888 return false; 882 return false;
889out: 883out:
890 return PageUptodate(page) != 0; 884 return PageUptodate(page) != 0;
@@ -1727,7 +1721,6 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page)
1727 struct nfs_page *req; 1721 struct nfs_page *req;
1728 int ret = 0; 1722 int ret = 0;
1729 1723
1730 BUG_ON(!PageLocked(page));
1731 for (;;) { 1724 for (;;) {
1732 wait_on_page_writeback(page); 1725 wait_on_page_writeback(page);
1733 req = nfs_page_find_request(page); 1726 req = nfs_page_find_request(page);
@@ -1829,7 +1822,7 @@ int __init nfs_init_writepagecache(void)
1829 goto out_destroy_write_mempool; 1822 goto out_destroy_write_mempool;
1830 1823
1831 nfs_commit_mempool = mempool_create_slab_pool(MIN_POOL_COMMIT, 1824 nfs_commit_mempool = mempool_create_slab_pool(MIN_POOL_COMMIT,
1832 nfs_wdata_cachep); 1825 nfs_cdata_cachep);
1833 if (nfs_commit_mempool == NULL) 1826 if (nfs_commit_mempool == NULL)
1834 goto out_destroy_commit_cache; 1827 goto out_destroy_commit_cache;
1835 1828