aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-02-19 19:53:39 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-03-05 15:44:54 -0500
commitff778d02bf867e1733a09b34ad6dbb723b024814 (patch)
treed22e33628b93f31c08089a3bf0ec4cc00a409b7a /fs/nfs
parent8fc795f703c5138e1a8bfb88c69f52632031aa6a (diff)
NFS: Add a count of the number of unstable writes carried by an inode
In order to know when we should do opportunistic commits of the unstable writes, when the VM is doing a background flush, we add a field to count the number of unstable writes. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/inode.c1
-rw-r--r--fs/nfs/write.c14
2 files changed, 11 insertions, 4 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 89e98312599d..aa5a831001ab 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1404,6 +1404,7 @@ static void init_once(void *foo)
1404 INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); 1404 INIT_LIST_HEAD(&nfsi->access_cache_inode_lru);
1405 INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); 1405 INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC);
1406 nfsi->npages = 0; 1406 nfsi->npages = 0;
1407 nfsi->ncommit = 0;
1407 atomic_set(&nfsi->silly_count, 1); 1408 atomic_set(&nfsi->silly_count, 1);
1408 INIT_HLIST_HEAD(&nfsi->silly_list); 1409 INIT_HLIST_HEAD(&nfsi->silly_list);
1409 init_waitqueue_head(&nfsi->waitqueue); 1410 init_waitqueue_head(&nfsi->waitqueue);
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 09e97097baaa..dc08a6fbde67 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -438,6 +438,7 @@ nfs_mark_request_commit(struct nfs_page *req)
438 radix_tree_tag_set(&nfsi->nfs_page_tree, 438 radix_tree_tag_set(&nfsi->nfs_page_tree,
439 req->wb_index, 439 req->wb_index,
440 NFS_PAGE_TAG_COMMIT); 440 NFS_PAGE_TAG_COMMIT);
441 nfsi->ncommit++;
441 spin_unlock(&inode->i_lock); 442 spin_unlock(&inode->i_lock);
442 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 443 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
443 inc_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_RECLAIMABLE); 444 inc_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_RECLAIMABLE);
@@ -573,11 +574,15 @@ static int
573nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages) 574nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages)
574{ 575{
575 struct nfs_inode *nfsi = NFS_I(inode); 576 struct nfs_inode *nfsi = NFS_I(inode);
577 int ret;
576 578
577 if (!nfs_need_commit(nfsi)) 579 if (!nfs_need_commit(nfsi))
578 return 0; 580 return 0;
579 581
580 return nfs_scan_list(nfsi, dst, idx_start, npages, NFS_PAGE_TAG_COMMIT); 582 ret = nfs_scan_list(nfsi, dst, idx_start, npages, NFS_PAGE_TAG_COMMIT);
583 if (ret > 0)
584 nfsi->ncommit -= ret;
585 return ret;
581} 586}
582#else 587#else
583static inline int nfs_need_commit(struct nfs_inode *nfsi) 588static inline int nfs_need_commit(struct nfs_inode *nfsi)
@@ -642,9 +647,10 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode,
642 spin_lock(&inode->i_lock); 647 spin_lock(&inode->i_lock);
643 } 648 }
644 649
645 if (nfs_clear_request_commit(req)) 650 if (nfs_clear_request_commit(req) &&
646 radix_tree_tag_clear(&NFS_I(inode)->nfs_page_tree, 651 radix_tree_tag_clear(&NFS_I(inode)->nfs_page_tree,
647 req->wb_index, NFS_PAGE_TAG_COMMIT); 652 req->wb_index, NFS_PAGE_TAG_COMMIT) != NULL)
653 NFS_I(inode)->ncommit--;
648 654
649 /* Okay, the request matches. Update the region */ 655 /* Okay, the request matches. Update the region */
650 if (offset < req->wb_offset) { 656 if (offset < req->wb_offset) {