Skip to content

Commit 5f2f6bd

Browse files
author
Trond Myklebust
committed
SUNRPC: Simplify xprt_prepare_transmit()
Remove the checks for whether or not we need to transmit, and whether or not a reply has been received. Those are already handled in call_transmit() itself. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 04b3b88 commit 5f2f6bd

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

net/sunrpc/xprt.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,27 +1123,18 @@ bool xprt_prepare_transmit(struct rpc_task *task)
11231123
{
11241124
struct rpc_rqst *req = task->tk_rqstp;
11251125
struct rpc_xprt *xprt = req->rq_xprt;
1126-
bool ret = false;
11271126

11281127
dprintk("RPC: %5u xprt_prepare_transmit\n", task->tk_pid);
11291128

1130-
spin_lock_bh(&xprt->transport_lock);
1131-
if (!req->rq_bytes_sent) {
1132-
if (req->rq_reply_bytes_recvd) {
1133-
task->tk_status = req->rq_reply_bytes_recvd;
1134-
goto out_unlock;
1135-
}
1129+
if (!xprt_lock_write(xprt, task)) {
1130+
/* Race breaker: someone may have transmitted us */
11361131
if (!test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate))
1137-
goto out_unlock;
1138-
}
1139-
if (!xprt->ops->reserve_xprt(xprt, task)) {
1140-
task->tk_status = -EAGAIN;
1141-
goto out_unlock;
1132+
rpc_wake_up_queued_task_set_status(&xprt->sending,
1133+
task, 0);
1134+
return false;
1135+
11421136
}
1143-
ret = true;
1144-
out_unlock:
1145-
spin_unlock_bh(&xprt->transport_lock);
1146-
return ret;
1137+
return true;
11471138
}
11481139

11491140
void xprt_end_transmit(struct rpc_task *task)

0 commit comments

Comments
 (0)