aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-02-29 02:48:05 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-02-29 02:48:05 -0500
commitcdd0972945dbcb8ea24db365d9b0e100af2a27bb (patch)
treed41204db20ccc81cecf99a332e2fa764075e8637
parent5e4424af9a1f062c6451681dff24a26e27741cc6 (diff)
parentcbc20059259edee4ea24c923e6627c394830c972 (diff)
Merge branch 'cleanups' into next
-rw-r--r--fs/nfs/write.c34
-rw-r--r--include/linux/sunrpc/clnt.h9
-rw-r--r--net/sunrpc/clnt.c4
3 files changed, 26 insertions, 21 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 30513029c00c..1667e3984418 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -351,15 +351,13 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
351/* 351/*
352 * Insert a write request into an inode 352 * Insert a write request into an inode
353 */ 353 */
354static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req) 354static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
355{ 355{
356 struct nfs_inode *nfsi = NFS_I(inode); 356 struct nfs_inode *nfsi = NFS_I(inode);
357 int error; 357 int error;
358 358
359 error = radix_tree_insert(&nfsi->nfs_page_tree, req->wb_index, req); 359 error = radix_tree_insert(&nfsi->nfs_page_tree, req->wb_index, req);
360 BUG_ON(error == -EEXIST); 360 BUG_ON(error);
361 if (error)
362 return error;
363 if (!nfsi->npages) { 361 if (!nfsi->npages) {
364 igrab(inode); 362 igrab(inode);
365 if (nfs_have_delegation(inode, FMODE_WRITE)) 363 if (nfs_have_delegation(inode, FMODE_WRITE))
@@ -369,8 +367,8 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
369 set_page_private(req->wb_page, (unsigned long)req); 367 set_page_private(req->wb_page, (unsigned long)req);
370 nfsi->npages++; 368 nfsi->npages++;
371 kref_get(&req->wb_kref); 369 kref_get(&req->wb_kref);
372 radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); 370 radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index,
373 return 0; 371 NFS_PAGE_TAG_LOCKED);
374} 372}
375 373
376/* 374/*
@@ -582,6 +580,13 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
582 /* Loop over all inode entries and see if we find 580 /* Loop over all inode entries and see if we find
583 * A request for the page we wish to update 581 * A request for the page we wish to update
584 */ 582 */
583 if (new) {
584 if (radix_tree_preload(GFP_NOFS)) {
585 nfs_release_request(new);
586 return ERR_PTR(-ENOMEM);
587 }
588 }
589
585 spin_lock(&inode->i_lock); 590 spin_lock(&inode->i_lock);
586 req = nfs_page_find_request_locked(page); 591 req = nfs_page_find_request_locked(page);
587 if (req) { 592 if (req) {
@@ -592,28 +597,27 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
592 error = nfs_wait_on_request(req); 597 error = nfs_wait_on_request(req);
593 nfs_release_request(req); 598 nfs_release_request(req);
594 if (error < 0) { 599 if (error < 0) {
595 if (new) 600 if (new) {
601 radix_tree_preload_end();
596 nfs_release_request(new); 602 nfs_release_request(new);
603 }
597 return ERR_PTR(error); 604 return ERR_PTR(error);
598 } 605 }
599 continue; 606 continue;
600 } 607 }
601 spin_unlock(&inode->i_lock); 608 spin_unlock(&inode->i_lock);
602 if (new) 609 if (new) {
610 radix_tree_preload_end();
603 nfs_release_request(new); 611 nfs_release_request(new);
612 }
604 break; 613 break;
605 } 614 }
606 615
607 if (new) { 616 if (new) {
608 int error;
609 nfs_lock_request_dontget(new); 617 nfs_lock_request_dontget(new);
610 error = nfs_inode_add_request(inode, new); 618 nfs_inode_add_request(inode, new);
611 if (error) {
612 spin_unlock(&inode->i_lock);
613 nfs_unlock_request(new);
614 return ERR_PTR(error);
615 }
616 spin_unlock(&inode->i_lock); 619 spin_unlock(&inode->i_lock);
620 radix_tree_preload_end();
617 req = new; 621 req = new;
618 goto zero_page; 622 goto zero_page;
619 } 623 }
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 129a86e25d29..6fff7f82ef12 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -127,11 +127,12 @@ int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
127void rpcb_getport_async(struct rpc_task *); 127void rpcb_getport_async(struct rpc_task *);
128 128
129void rpc_call_start(struct rpc_task *); 129void rpc_call_start(struct rpc_task *);
130int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 130int rpc_call_async(struct rpc_clnt *clnt,
131 int flags, const struct rpc_call_ops *tk_ops, 131 const struct rpc_message *msg, int flags,
132 const struct rpc_call_ops *tk_ops,
132 void *calldata); 133 void *calldata);
133int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, 134int rpc_call_sync(struct rpc_clnt *clnt,
134 int flags); 135 const struct rpc_message *msg, int flags);
135struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, 136struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
136 int flags); 137 int flags);
137void rpc_restart_call(struct rpc_task *); 138void rpc_restart_call(struct rpc_task *);
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 0e209af39797..ea14314331b0 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -548,7 +548,7 @@ EXPORT_SYMBOL_GPL(rpc_run_task);
548 * @msg: RPC call parameters 548 * @msg: RPC call parameters
549 * @flags: RPC call flags 549 * @flags: RPC call flags
550 */ 550 */
551int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, int flags) 551int rpc_call_sync(struct rpc_clnt *clnt, const struct rpc_message *msg, int flags)
552{ 552{
553 struct rpc_task *task; 553 struct rpc_task *task;
554 struct rpc_task_setup task_setup_data = { 554 struct rpc_task_setup task_setup_data = {
@@ -579,7 +579,7 @@ EXPORT_SYMBOL_GPL(rpc_call_sync);
579 * @data: user call data 579 * @data: user call data
580 */ 580 */
581int 581int
582rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, 582rpc_call_async(struct rpc_clnt *clnt, const struct rpc_message *msg, int flags,
583 const struct rpc_call_ops *tk_ops, void *data) 583 const struct rpc_call_ops *tk_ops, void *data)
584{ 584{
585 struct rpc_task *task; 585 struct rpc_task *task;