aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-12-13 15:23:47 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-02-03 18:35:07 -0500
commitd30c8348a4ba292a09addd122de2f3189c21a7ff (patch)
tree4aa5bf398902741643c8e6e88d5676ca02b5dfa2 /fs/nfs
parentf40313ac39fedca519c36fdc454acf2632e641da (diff)
NFS: nfs_writepages() cleanup
Strip out the call to nfs_commit_inode(), and allow that to be done by nfs_write_inode(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/inode.c15
-rw-r--r--fs/nfs/write.c21
2 files changed, 11 insertions, 25 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index d83498282837..4ef454763886 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -65,13 +65,18 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr)
65 65
66int nfs_write_inode(struct inode *inode, int sync) 66int nfs_write_inode(struct inode *inode, int sync)
67{ 67{
68 int flags = sync ? FLUSH_SYNC : 0;
69 int ret; 68 int ret;
70 69
71 ret = nfs_commit_inode(inode, flags); 70 if (sync) {
72 if (ret < 0) 71 ret = filemap_fdatawait(inode->i_mapping);
73 return ret; 72 if (ret == 0)
74 return 0; 73 ret = nfs_commit_inode(inode, FLUSH_SYNC);
74 } else
75 ret = nfs_commit_inode(inode, 0);
76 if (ret >= 0)
77 return 0;
78 __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
79 return ret;
75} 80}
76 81
77void nfs_clear_inode(struct inode *inode) 82void nfs_clear_inode(struct inode *inode)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index fab214a4bcb0..f983c51e05ac 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -79,7 +79,6 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context*,
79 unsigned int, unsigned int); 79 unsigned int, unsigned int);
80static void nfs_mark_request_dirty(struct nfs_page *req); 80static void nfs_mark_request_dirty(struct nfs_page *req);
81static int nfs_wait_on_write_congestion(struct address_space *, int); 81static int nfs_wait_on_write_congestion(struct address_space *, int);
82static int nfs_wait_on_requests(struct inode *, unsigned long, unsigned int);
83static long nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how); 82static long nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how);
84static const struct rpc_call_ops nfs_write_partial_ops; 83static const struct rpc_call_ops nfs_write_partial_ops;
85static const struct rpc_call_ops nfs_write_full_ops; 84static const struct rpc_call_ops nfs_write_full_ops;
@@ -360,14 +359,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
360 if (err < 0) 359 if (err < 0)
361 goto out; 360 goto out;
362 nfs_add_stats(inode, NFSIOS_WRITEPAGES, err); 361 nfs_add_stats(inode, NFSIOS_WRITEPAGES, err);
363 if (!wbc->nonblocking && wbc->sync_mode == WB_SYNC_ALL) { 362 err = 0;
364 err = nfs_wait_on_requests(inode, 0, 0);
365 if (err < 0)
366 goto out;
367 }
368 err = nfs_commit_inode(inode, wb_priority(wbc));
369 if (err > 0)
370 err = 0;
371out: 363out:
372 clear_bit(BDI_write_congested, &bdi->state); 364 clear_bit(BDI_write_congested, &bdi->state);
373 wake_up_all(&nfs_write_congestion); 365 wake_up_all(&nfs_write_congestion);
@@ -516,17 +508,6 @@ static int nfs_wait_on_requests_locked(struct inode *inode, unsigned long idx_st
516 return res; 508 return res;
517} 509}
518 510
519static int nfs_wait_on_requests(struct inode *inode, unsigned long idx_start, unsigned int npages)
520{
521 struct nfs_inode *nfsi = NFS_I(inode);
522 int ret;
523
524 spin_lock(&nfsi->req_lock);
525 ret = nfs_wait_on_requests_locked(inode, idx_start, npages);
526 spin_unlock(&nfsi->req_lock);
527 return ret;
528}
529
530static void nfs_cancel_dirty_list(struct list_head *head) 511static void nfs_cancel_dirty_list(struct list_head *head)
531{ 512{
532 struct nfs_page *req; 513 struct nfs_page *req;