diff options
-rw-r--r-- | fs/nfs/inode.c | 1 | ||||
-rw-r--r-- | fs/nfs/write.c | 25 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 3 |
3 files changed, 17 insertions, 12 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index b7656bd3706f..00f116cdadc6 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1345,7 +1345,6 @@ static void init_once(void *foo) | |||
1345 | INIT_LIST_HEAD(&nfsi->access_cache_entry_lru); | 1345 | INIT_LIST_HEAD(&nfsi->access_cache_entry_lru); |
1346 | INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); | 1346 | INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); |
1347 | INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); | 1347 | INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); |
1348 | nfsi->ncommit = 0; | ||
1349 | nfsi->npages = 0; | 1348 | nfsi->npages = 0; |
1350 | atomic_set(&nfsi->silly_count, 1); | 1349 | atomic_set(&nfsi->silly_count, 1); |
1351 | INIT_HLIST_HEAD(&nfsi->silly_list); | 1350 | INIT_HLIST_HEAD(&nfsi->silly_list); |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 9f9845859fc1..1a999939fedf 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -404,7 +404,6 @@ nfs_mark_request_commit(struct nfs_page *req) | |||
404 | struct nfs_inode *nfsi = NFS_I(inode); | 404 | struct nfs_inode *nfsi = NFS_I(inode); |
405 | 405 | ||
406 | spin_lock(&inode->i_lock); | 406 | spin_lock(&inode->i_lock); |
407 | nfsi->ncommit++; | ||
408 | set_bit(PG_CLEAN, &(req)->wb_flags); | 407 | set_bit(PG_CLEAN, &(req)->wb_flags); |
409 | radix_tree_tag_set(&nfsi->nfs_page_tree, | 408 | radix_tree_tag_set(&nfsi->nfs_page_tree, |
410 | req->wb_index, | 409 | req->wb_index, |
@@ -523,6 +522,12 @@ static void nfs_cancel_commit_list(struct list_head *head) | |||
523 | } | 522 | } |
524 | } | 523 | } |
525 | 524 | ||
525 | static int | ||
526 | nfs_need_commit(struct nfs_inode *nfsi) | ||
527 | { | ||
528 | return radix_tree_tagged(&nfsi->nfs_page_tree, NFS_PAGE_TAG_COMMIT); | ||
529 | } | ||
530 | |||
526 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 531 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
527 | /* | 532 | /* |
528 | * nfs_scan_commit - Scan an inode for commit requests | 533 | * nfs_scan_commit - Scan an inode for commit requests |
@@ -538,16 +543,18 @@ static int | |||
538 | nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages) | 543 | nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages) |
539 | { | 544 | { |
540 | struct nfs_inode *nfsi = NFS_I(inode); | 545 | struct nfs_inode *nfsi = NFS_I(inode); |
541 | int res = 0; | ||
542 | 546 | ||
543 | if (nfsi->ncommit != 0) { | 547 | if (!nfs_need_commit(nfsi)) |
544 | res = nfs_scan_list(nfsi, dst, idx_start, npages, | 548 | return 0; |
545 | NFS_PAGE_TAG_COMMIT); | 549 | |
546 | nfsi->ncommit -= res; | 550 | return nfs_scan_list(nfsi, dst, idx_start, npages, NFS_PAGE_TAG_COMMIT); |
547 | } | ||
548 | return res; | ||
549 | } | 551 | } |
550 | #else | 552 | #else |
553 | static inline int nfs_need_commit(struct nfs_inode *nfsi) | ||
554 | { | ||
555 | return 0; | ||
556 | } | ||
557 | |||
551 | static inline int nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages) | 558 | static inline int nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages) |
552 | { | 559 | { |
553 | return 0; | 560 | return 0; |
@@ -820,7 +827,7 @@ static int nfs_write_rpcsetup(struct nfs_page *req, | |||
820 | data->args.stable = NFS_UNSTABLE; | 827 | data->args.stable = NFS_UNSTABLE; |
821 | if (how & FLUSH_STABLE) { | 828 | if (how & FLUSH_STABLE) { |
822 | data->args.stable = NFS_DATA_SYNC; | 829 | data->args.stable = NFS_DATA_SYNC; |
823 | if (!NFS_I(inode)->ncommit) | 830 | if (!nfs_need_commit(NFS_I(inode))) |
824 | data->args.stable = NFS_FILE_SYNC; | 831 | data->args.stable = NFS_FILE_SYNC; |
825 | } | 832 | } |
826 | 833 | ||
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index db867b04ac3c..c9fecd3e8f0f 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -166,8 +166,7 @@ struct nfs_inode { | |||
166 | */ | 166 | */ |
167 | struct radix_tree_root nfs_page_tree; | 167 | struct radix_tree_root nfs_page_tree; |
168 | 168 | ||
169 | unsigned long ncommit, | 169 | unsigned long npages; |
170 | npages; | ||
171 | 170 | ||
172 | /* Open contexts for shared mmap writes */ | 171 | /* Open contexts for shared mmap writes */ |
173 | struct list_head open_files; | 172 | struct list_head open_files; |