Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139521
b: refs/heads/master
c: fb8a1f1
h: refs/heads/master
i:
  139519: 748b8fb
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Mar 11, 2009
1 parent 5a507a5 commit d03cca2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a65318bf3afc93ce49227e849d213799b072c5fd
refs/heads/master: fb8a1f11b64e213d94dfa1cebb2a42a7b8c115c4
1 change: 0 additions & 1 deletion trunk/fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,6 @@ 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);
Expand Down
25 changes: 16 additions & 9 deletions trunk/fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ 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,
Expand Down Expand Up @@ -523,6 +522,12 @@ 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
Expand All @@ -538,16 +543,18 @@ 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 (nfsi->ncommit != 0) {
res = nfs_scan_list(nfsi, dst, idx_start, npages,
NFS_PAGE_TAG_COMMIT);
nfsi->ncommit -= res;
}
return res;
if (!nfs_need_commit(nfsi))
return 0;

return nfs_scan_list(nfsi, dst, idx_start, npages, NFS_PAGE_TAG_COMMIT);
}
#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;
Expand Down Expand Up @@ -820,7 +827,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_I(inode)->ncommit)
if (!nfs_need_commit(NFS_I(inode)))
data->args.stable = NFS_FILE_SYNC;
}

Expand Down
3 changes: 1 addition & 2 deletions trunk/include/linux/nfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ struct nfs_inode {
*/
struct radix_tree_root nfs_page_tree;

unsigned long ncommit,
npages;
unsigned long npages;

/* Open contexts for shared mmap writes */
struct list_head open_files;
Expand Down

0 comments on commit d03cca2

Please sign in to comment.