diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-02-19 19:53:39 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-03-05 15:44:54 -0500 |
commit | ff778d02bf867e1733a09b34ad6dbb723b024814 (patch) | |
tree | d22e33628b93f31c08089a3bf0ec4cc00a409b7a /fs/nfs/write.c | |
parent | 8fc795f703c5138e1a8bfb88c69f52632031aa6a (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/write.c')
-rw-r--r-- | fs/nfs/write.c | 14 |
1 files changed, 10 insertions, 4 deletions
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 | |||
573 | nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages) | 574 | nfs_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 |
583 | static inline int nfs_need_commit(struct nfs_inode *nfsi) | 588 | static 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) { |