From a1a2a413908091f8c31c72cf9d4eeae2abe2a012 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Mon, 16 Mar 2009 21:48:02 +1100 Subject: Revert "NFS: cleanup - remove struct nfs_inode->ncommit" This reverts commit fb8a1f11b64e213d94dfa1cebb2a42a7b8c115c4. --- fs/nfs/inode.c | 1 + fs/nfs/write.c | 25 +++++++++---------------- include/linux/nfs_fs.h | 3 ++- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index e87a080a45af..3dee11b64196 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1364,6 +1364,7 @@ static void init_once(void *foo) INIT_LIST_HEAD(&nfsi->access_cache_entry_lru); INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); + nfsi->ncommit = 0; nfsi->npages = 0; atomic_set(&nfsi->silly_count, 1); INIT_HLIST_HEAD(&nfsi->silly_list); diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 36fd35e0de83..57413560df54 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -419,6 +419,7 @@ nfs_mark_request_commit(struct nfs_page *req) struct nfs_inode *nfsi = NFS_I(inode); spin_lock(&inode->i_lock); + nfsi->ncommit++; set_bit(PG_CLEAN, &(req)->wb_flags); radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index, @@ -537,12 +538,6 @@ static void nfs_cancel_commit_list(struct list_head *head) } } -static int -nfs_need_commit(struct nfs_inode *nfsi) -{ - return radix_tree_tagged(&nfsi->nfs_page_tree, NFS_PAGE_TAG_COMMIT); -} - #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) /* * nfs_scan_commit - Scan an inode for commit requests @@ -558,18 +553,16 @@ static int nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages) { struct nfs_inode *nfsi = NFS_I(inode); + int res = 0; - if (!nfs_need_commit(nfsi)) - return 0; - - return nfs_scan_list(nfsi, dst, idx_start, npages, NFS_PAGE_TAG_COMMIT); + if (nfsi->ncommit != 0) { + res = nfs_scan_list(nfsi, dst, idx_start, npages, + NFS_PAGE_TAG_COMMIT); + nfsi->ncommit -= res; + } + return res; } #else -static inline int nfs_need_commit(struct nfs_inode *nfsi) -{ - return 0; -} - static inline int nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, unsigned int npages) { return 0; @@ -842,7 +835,7 @@ static int nfs_write_rpcsetup(struct nfs_page *req, data->args.stable = NFS_UNSTABLE; if (how & FLUSH_STABLE) { data->args.stable = NFS_DATA_SYNC; - if (!nfs_need_commit(NFS_I(inode))) + if (!NFS_I(inode)->ncommit) data->args.stable = NFS_FILE_SYNC; } diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 230665a3de0d..db67f7781cf9 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -166,7 +166,8 @@ struct nfs_inode { */ struct radix_tree_root nfs_page_tree; - unsigned long npages; + unsigned long ncommit, + npages; /* Open contexts for shared mmap writes */ struct list_head open_files; -- cgit v1.2.3