Skip to content

Commit a13ce7c

Browse files
committed
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>
1 parent cab92c1 commit a13ce7c

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

fs/nfs/nfs4proc.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,10 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
559559
{
560560
struct nfs4_session *session;
561561
struct nfs4_slot_table *tbl;
562+
struct nfs4_slot *slot = res->sr_slot;
562563
bool send_new_highest_used_slotid = false;
563564

564-
if (!res->sr_slot) {
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;
565+
tbl = slot->table;
571566
session = tbl->session;
572567

573568
spin_lock(&tbl->slot_tbl_lock);
@@ -577,11 +572,11 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
577572
if (tbl->highest_used_slotid > tbl->target_highest_slotid)
578573
send_new_highest_used_slotid = true;
579574

580-
if (nfs41_wake_and_assign_slot(tbl, res->sr_slot)) {
575+
if (nfs41_wake_and_assign_slot(tbl, slot)) {
581576
send_new_highest_used_slotid = false;
582577
goto out_unlock;
583578
}
584-
nfs4_free_slot(tbl, res->sr_slot);
579+
nfs4_free_slot(tbl, slot);
585580

586581
if (tbl->highest_used_slotid != NFS4_NO_SLOT)
587582
send_new_highest_used_slotid = false;
@@ -595,16 +590,17 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
595590
int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
596591
{
597592
struct nfs4_session *session;
598-
struct nfs4_slot *slot;
593+
struct nfs4_slot *slot = res->sr_slot;
599594
struct nfs_client *clp;
600595
bool interrupted = false;
601596
int ret = 1;
602597

598+
if (slot == NULL)
599+
goto out_noaction;
603600
/* don't increment the sequence number if the task wasn't sent */
604601
if (!RPC_WAS_SENT(task))
605602
goto out;
606603

607-
slot = res->sr_slot;
608604
session = slot->table->session;
609605

610606
if (slot->interrupted) {
@@ -679,6 +675,7 @@ int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
679675
/* The session may be reset by one of the error handlers. */
680676
dprintk("%s: Error %d free the slot \n", __func__, res->sr_status);
681677
nfs41_sequence_free_slot(res);
678+
out_noaction:
682679
return ret;
683680
retry_nowait:
684681
if (rpc_restart_call_prepare(task)) {

0 commit comments

Comments
 (0)