xprt.c (e65372124cd749ebbe4ac2abe5a511d7d1ac68db) xprt.c (0c77668ddb4e7bdfbca462c6185d154d0b8889ae)
1/*
2 * linux/net/sunrpc/xprt.c
3 *
4 * This is a generic RPC call interface supporting congestion avoidance,
5 * and asynchronous calls.
6 *
7 * The interface works like this:
8 *

--- 1151 unchanged lines hidden (view full) ---

1160 if (req->rq_cong) {
1161 xprt_clear_congestion_window_wait(xprt);
1162 list_for_each_entry(pos, &xprt->xmit_queue, rq_xmit) {
1163 if (pos->rq_cong)
1164 continue;
1165 /* Note: req is added _before_ pos */
1166 list_add_tail(&req->rq_xmit, &pos->rq_xmit);
1167 INIT_LIST_HEAD(&req->rq_xmit2);
1/*
2 * linux/net/sunrpc/xprt.c
3 *
4 * This is a generic RPC call interface supporting congestion avoidance,
5 * and asynchronous calls.
6 *
7 * The interface works like this:
8 *

--- 1151 unchanged lines hidden (view full) ---

1160 if (req->rq_cong) {
1161 xprt_clear_congestion_window_wait(xprt);
1162 list_for_each_entry(pos, &xprt->xmit_queue, rq_xmit) {
1163 if (pos->rq_cong)
1164 continue;
1165 /* Note: req is added _before_ pos */
1166 list_add_tail(&req->rq_xmit, &pos->rq_xmit);
1167 INIT_LIST_HEAD(&req->rq_xmit2);
1168 trace_xprt_enq_xmit(task, 1);
1168 goto out;
1169 }
1170 } else if (RPC_IS_SWAPPER(task)) {
1171 list_for_each_entry(pos, &xprt->xmit_queue, rq_xmit) {
1172 if (pos->rq_cong || pos->rq_bytes_sent)
1173 continue;
1174 if (RPC_IS_SWAPPER(pos->rq_task))
1175 continue;
1176 /* Note: req is added _before_ pos */
1177 list_add_tail(&req->rq_xmit, &pos->rq_xmit);
1178 INIT_LIST_HEAD(&req->rq_xmit2);
1169 goto out;
1170 }
1171 } else if (RPC_IS_SWAPPER(task)) {
1172 list_for_each_entry(pos, &xprt->xmit_queue, rq_xmit) {
1173 if (pos->rq_cong || pos->rq_bytes_sent)
1174 continue;
1175 if (RPC_IS_SWAPPER(pos->rq_task))
1176 continue;
1177 /* Note: req is added _before_ pos */
1178 list_add_tail(&req->rq_xmit, &pos->rq_xmit);
1179 INIT_LIST_HEAD(&req->rq_xmit2);
1180 trace_xprt_enq_xmit(task, 2);
1179 goto out;
1180 }
1181 } else if (!req->rq_seqno) {
1182 list_for_each_entry(pos, &xprt->xmit_queue, rq_xmit) {
1183 if (pos->rq_task->tk_owner != task->tk_owner)
1184 continue;
1185 list_add_tail(&req->rq_xmit2, &pos->rq_xmit2);
1186 INIT_LIST_HEAD(&req->rq_xmit);
1181 goto out;
1182 }
1183 } else if (!req->rq_seqno) {
1184 list_for_each_entry(pos, &xprt->xmit_queue, rq_xmit) {
1185 if (pos->rq_task->tk_owner != task->tk_owner)
1186 continue;
1187 list_add_tail(&req->rq_xmit2, &pos->rq_xmit2);
1188 INIT_LIST_HEAD(&req->rq_xmit);
1189 trace_xprt_enq_xmit(task, 3);
1187 goto out;
1188 }
1189 }
1190 list_add_tail(&req->rq_xmit, &xprt->xmit_queue);
1191 INIT_LIST_HEAD(&req->rq_xmit2);
1190 goto out;
1191 }
1192 }
1193 list_add_tail(&req->rq_xmit, &xprt->xmit_queue);
1194 INIT_LIST_HEAD(&req->rq_xmit2);
1195 trace_xprt_enq_xmit(task, 4);
1192out:
1193 set_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate);
1194 spin_unlock(&xprt->queue_lock);
1195 }
1196}
1197
1198/**
1199 * xprt_request_dequeue_transmit_locked - remove a task from the transmission queue

--- 108 unchanged lines hidden (view full) ---

1308xprt_request_transmit(struct rpc_rqst *req, struct rpc_task *snd_task)
1309{
1310 struct rpc_xprt *xprt = req->rq_xprt;
1311 struct rpc_task *task = req->rq_task;
1312 unsigned int connect_cookie;
1313 int is_retrans = RPC_WAS_SENT(task);
1314 int status;
1315
1196out:
1197 set_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate);
1198 spin_unlock(&xprt->queue_lock);
1199 }
1200}
1201
1202/**
1203 * xprt_request_dequeue_transmit_locked - remove a task from the transmission queue

--- 108 unchanged lines hidden (view full) ---

1312xprt_request_transmit(struct rpc_rqst *req, struct rpc_task *snd_task)
1313{
1314 struct rpc_xprt *xprt = req->rq_xprt;
1315 struct rpc_task *task = req->rq_task;
1316 unsigned int connect_cookie;
1317 int is_retrans = RPC_WAS_SENT(task);
1318 int status;
1319
1316 dprintk("RPC: %5u xprt_transmit(%u)\n", task->tk_pid, req->rq_slen);
1317
1318 if (!req->rq_bytes_sent) {
1319 if (xprt_request_data_received(task)) {
1320 status = 0;
1321 goto out_dequeue;
1322 }
1323 /* Verify that our message lies in the RPCSEC_GSS window */
1324 if (rpcauth_xmit_need_reencode(task)) {
1325 status = -EBADMSG;

--- 5 unchanged lines hidden (view full) ---

1331 * Update req->rq_ntrans before transmitting to avoid races with
1332 * xprt_update_rtt(), which needs to know that it is recording a
1333 * reply to the first transmission.
1334 */
1335 req->rq_ntrans++;
1336
1337 connect_cookie = xprt->connect_cookie;
1338 status = xprt->ops->send_request(req);
1320 if (!req->rq_bytes_sent) {
1321 if (xprt_request_data_received(task)) {
1322 status = 0;
1323 goto out_dequeue;
1324 }
1325 /* Verify that our message lies in the RPCSEC_GSS window */
1326 if (rpcauth_xmit_need_reencode(task)) {
1327 status = -EBADMSG;

--- 5 unchanged lines hidden (view full) ---

1333 * Update req->rq_ntrans before transmitting to avoid races with
1334 * xprt_update_rtt(), which needs to know that it is recording a
1335 * reply to the first transmission.
1336 */
1337 req->rq_ntrans++;
1338
1339 connect_cookie = xprt->connect_cookie;
1340 status = xprt->ops->send_request(req);
1339 trace_xprt_transmit(xprt, req->rq_xid, status);
1340 if (status != 0) {
1341 req->rq_ntrans--;
1341 if (status != 0) {
1342 req->rq_ntrans--;
1343 trace_xprt_transmit(req, status);
1342 return status;
1343 }
1344
1345 if (is_retrans)
1346 task->tk_client->cl_stats->rpcretrans++;
1347
1348 xprt_inject_disconnect(xprt);
1349
1344 return status;
1345 }
1346
1347 if (is_retrans)
1348 task->tk_client->cl_stats->rpcretrans++;
1349
1350 xprt_inject_disconnect(xprt);
1351
1350 dprintk("RPC: %5u xmit complete\n", task->tk_pid);
1351 task->tk_flags |= RPC_TASK_SENT;
1352 spin_lock_bh(&xprt->transport_lock);
1353
1354 xprt->stat.sends++;
1355 xprt->stat.req_u += xprt->stat.sends - xprt->stat.recvs;
1356 xprt->stat.bklog_u += xprt->backlog.qlen;
1357 xprt->stat.sending_u += xprt->sending.qlen;
1358 xprt->stat.pending_u += xprt->pending.qlen;
1359 spin_unlock_bh(&xprt->transport_lock);
1360
1361 req->rq_connect_cookie = connect_cookie;
1362out_dequeue:
1352 task->tk_flags |= RPC_TASK_SENT;
1353 spin_lock_bh(&xprt->transport_lock);
1354
1355 xprt->stat.sends++;
1356 xprt->stat.req_u += xprt->stat.sends - xprt->stat.recvs;
1357 xprt->stat.bklog_u += xprt->backlog.qlen;
1358 xprt->stat.sending_u += xprt->sending.qlen;
1359 xprt->stat.pending_u += xprt->pending.qlen;
1360 spin_unlock_bh(&xprt->transport_lock);
1361
1362 req->rq_connect_cookie = connect_cookie;
1363out_dequeue:
1364 trace_xprt_transmit(req, status);
1363 xprt_request_dequeue_transmit(task);
1364 rpc_wake_up_queued_task_set_status(&xprt->sending, task, status);
1365 return status;
1366}
1367
1368/**
1369 * xprt_transmit - send an RPC request on a transport
1370 * @task: controlling RPC task

--- 540 unchanged lines hidden ---
1365 xprt_request_dequeue_transmit(task);
1366 rpc_wake_up_queued_task_set_status(&xprt->sending, task, status);
1367 return status;
1368}
1369
1370/**
1371 * xprt_transmit - send an RPC request on a transport
1372 * @task: controlling RPC task

--- 540 unchanged lines hidden ---