aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2014-01-29 12:24:03 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-01-29 12:24:03 -0500
commita13ce7c629366880c1072d4d113d3dab6c53510d (patch)
tree130afc3a1c81b1f55bafd128da553cc3452fc68a /fs/nfs/nfs4proc.c
parentcab92c19821a814ecf5a5279e2699bf28e66caee (diff)
NFSv4.1: Clean up nfs41_sequence_done
Move the test for res->sr_slot == NULL out of the nfs41_sequence_free_slot helper and into the main function for efficiency. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 493e9cce1f11..42da6af77587 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -559,15 +559,10 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
559{ 559{
560 struct nfs4_session *session; 560 struct nfs4_session *session;
561 struct nfs4_slot_table *tbl; 561 struct nfs4_slot_table *tbl;
562 struct nfs4_slot *slot = res->sr_slot;
562 bool send_new_highest_used_slotid = false; 563 bool send_new_highest_used_slotid = false;
563 564
564 if (!res->sr_slot) { 565 tbl = slot->table;
565 /* just wake up the next guy waiting since
566 * we may have not consumed a slot after all */
567 dprintk("%s: No slot\n", __func__);
568 return;
569 }
570 tbl = res->sr_slot->table;
571 session = tbl->session; 566 session = tbl->session;
572 567
573 spin_lock(&tbl->slot_tbl_lock); 568 spin_lock(&tbl->slot_tbl_lock);
@@ -577,11 +572,11 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
577 if (tbl->highest_used_slotid > tbl->target_highest_slotid) 572 if (tbl->highest_used_slotid > tbl->target_highest_slotid)
578 send_new_highest_used_slotid = true; 573 send_new_highest_used_slotid = true;
579 574
580 if (nfs41_wake_and_assign_slot(tbl, res->sr_slot)) { 575 if (nfs41_wake_and_assign_slot(tbl, slot)) {
581 send_new_highest_used_slotid = false; 576 send_new_highest_used_slotid = false;
582 goto out_unlock; 577 goto out_unlock;
583 } 578 }
584 nfs4_free_slot(tbl, res->sr_slot); 579 nfs4_free_slot(tbl, slot);
585 580
586 if (tbl->highest_used_slotid != NFS4_NO_SLOT) 581 if (tbl->highest_used_slotid != NFS4_NO_SLOT)
587 send_new_highest_used_slotid = false; 582 send_new_highest_used_slotid = false;
@@ -595,16 +590,17 @@ out_unlock:
595int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res) 590int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
596{ 591{
597 struct nfs4_session *session; 592 struct nfs4_session *session;
598 struct nfs4_slot *slot; 593 struct nfs4_slot *slot = res->sr_slot;
599 struct nfs_client *clp; 594 struct nfs_client *clp;
600 bool interrupted = false; 595 bool interrupted = false;
601 int ret = 1; 596 int ret = 1;
602 597
598 if (slot == NULL)
599 goto out_noaction;
603 /* don't increment the sequence number if the task wasn't sent */ 600 /* don't increment the sequence number if the task wasn't sent */
604 if (!RPC_WAS_SENT(task)) 601 if (!RPC_WAS_SENT(task))
605 goto out; 602 goto out;
606 603
607 slot = res->sr_slot;
608 session = slot->table->session; 604 session = slot->table->session;
609 605
610 if (slot->interrupted) { 606 if (slot->interrupted) {
@@ -679,6 +675,7 @@ out:
679 /* The session may be reset by one of the error handlers. */ 675 /* The session may be reset by one of the error handlers. */
680 dprintk("%s: Error %d free the slot \n", __func__, res->sr_status); 676 dprintk("%s: Error %d free the slot \n", __func__, res->sr_status);
681 nfs41_sequence_free_slot(res); 677 nfs41_sequence_free_slot(res);
678out_noaction:
682 return ret; 679 return ret;
683retry_nowait: 680retry_nowait:
684 if (rpc_restart_call_prepare(task)) { 681 if (rpc_restart_call_prepare(task)) {