diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-09-16 13:04:50 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-06 10:46:34 -0500 |
commit | 28c6925fce3927a9fe3c5b44af5fb266680fdcea (patch) | |
tree | 89692ec971c9703a0c437c40816b1f84ab2e3a74 /fs/nfs | |
parent | c8541ecdd5692bcfbcb5305cab9a873288d29175 (diff) | |
download | blackbird-obmc-linux-28c6925fce3927a9fe3c5b44af5fb266680fdcea.tar.gz blackbird-obmc-linux-28c6925fce3927a9fe3c5b44af5fb266680fdcea.zip |
NFS: Clean up nfs_flush_inode()
Make it take a struct writepages argument, and rename to
nfs_flush_mapping().
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/write.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 4948dc1fbd74..1d72096c4d22 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -79,8 +79,7 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context*, unsigned int, unsigned int); static int nfs_wait_on_write_congestion(struct address_space *, int); static int nfs_wait_on_requests(struct inode *, unsigned long, unsigned int); -static int nfs_flush_inode(struct inode *inode, unsigned long idx_start, - unsigned int npages, int how); +static int nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how); static const struct rpc_call_ops nfs_write_partial_ops; static const struct rpc_call_ops nfs_write_full_ops; static const struct rpc_call_ops nfs_commit_ops; @@ -352,7 +351,7 @@ do_it: if (!IS_SYNC(inode) && inode_referenced) { err = nfs_writepage_async(ctx, inode, page, 0, offset); if (!wbc->for_writepages) - nfs_flush_inode(inode, 0, 0, wb_priority(wbc)); + nfs_flush_mapping(page->mapping, wbc, wb_priority(wbc)); } else { err = nfs_writepage_sync(ctx, inode, page, 0, offset, priority); @@ -391,11 +390,10 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) return 0; nfs_wait_on_write_congestion(mapping, 0); } - err = nfs_flush_inode(inode, 0, 0, wb_priority(wbc)); + err = nfs_flush_mapping(mapping, wbc, wb_priority(wbc)); if (err < 0) goto out; nfs_add_stats(inode, NFSIOS_WRITEPAGES, err); - wbc->nr_to_write -= err; if (!wbc->nonblocking && wbc->sync_mode == WB_SYNC_ALL) { err = nfs_wait_on_requests(inode, 0, 0); if (err < 0) @@ -1469,20 +1467,22 @@ static inline int nfs_commit_list(struct inode *inode, struct list_head *head, i } #endif -static int nfs_flush_inode(struct inode *inode, unsigned long idx_start, - unsigned int npages, int how) +static int nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how) { - struct nfs_inode *nfsi = NFS_I(inode); + struct nfs_inode *nfsi = NFS_I(mapping->host); LIST_HEAD(head); + pgoff_t index = wbc->range_start >> PAGE_CACHE_SHIFT; + unsigned long npages = 1 + (wbc->range_end >> PAGE_CACHE_SHIFT) - index; int res; spin_lock(&nfsi->req_lock); - res = nfs_scan_dirty(inode, &head, idx_start, npages); + res = nfs_scan_dirty(mapping->host, &head, index, npages); spin_unlock(&nfsi->req_lock); if (res) { - int error = nfs_flush_list(inode, &head, res, how); + int error = nfs_flush_list(mapping->host, &head, res, how); if (error < 0) return error; + wbc->nr_to_write -= res; } return res; } |