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.c25
1 files changed, 16 insertions, 9 deletions
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
525static int
526nfs_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
538nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages) 543nfs_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
553static inline int nfs_need_commit(struct nfs_inode *nfsi)
554{
555 return 0;
556}
557
551static inline int nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages) 558static 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