Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 9953
b: refs/heads/master
c: 1570c1e
h: refs/heads/master
i:
  9951: e289e7d
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Sep 23, 2005
1 parent 717f115 commit d6cc6ee
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 50 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 46c0ee8bc4ad3743de05e8b8b20201df44dcb6d3
refs/heads/master: 1570c1e41eabf6b7031f3e4322a2cf1cbe319fee
3 changes: 2 additions & 1 deletion trunk/include/linux/sunrpc/xprt.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,10 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
void xprt_wait_for_buffer_space(struct rpc_task *task);
void xprt_write_space(struct rpc_xprt *xprt);
void xprt_update_rtt(struct rpc_task *task);
void xprt_adjust_cwnd(struct rpc_task *task, int result);
struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid);
void xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied);
void xprt_complete_rqst(struct rpc_task *task, int copied);
void xprt_disconnect(struct rpc_xprt *xprt);

/*
Expand Down
66 changes: 26 additions & 40 deletions trunk/net/sunrpc/xprt.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,56 +591,42 @@ struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid)
return req;
}

/**
* xprt_update_rtt - update an RPC client's RTT state after receiving a reply
* @task: RPC request that recently completed
*
*/
void xprt_update_rtt(struct rpc_task *task)
{
struct rpc_rqst *req = task->tk_rqstp;
struct rpc_rtt *rtt = task->tk_client->cl_rtt;
unsigned timer = task->tk_msg.rpc_proc->p_timer;

if (timer) {
if (req->rq_ntrans == 1)
rpc_update_rtt(rtt, timer,
(long)jiffies - req->rq_xtime);
rpc_set_timeo(rtt, timer, req->rq_ntrans - 1);
}
}

/**
* xprt_complete_rqst - called when reply processing is complete
* @xprt: controlling transport
* @req: RPC request that just completed
* @task: RPC request that recently completed
* @copied: actual number of bytes received from the transport
*
* Caller holds transport lock.
*/
void xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied)
{
struct rpc_task *task = req->rq_task;
struct rpc_clnt *clnt = task->tk_client;

/* Adjust congestion window */
if (!xprt->nocong) {
unsigned timer = task->tk_msg.rpc_proc->p_timer;
xprt_adjust_cwnd(task, copied);
if (timer) {
if (req->rq_ntrans == 1)
rpc_update_rtt(clnt->cl_rtt, timer,
(long)jiffies - req->rq_xtime);
rpc_set_timeo(clnt->cl_rtt, timer, req->rq_ntrans - 1);
}
}
void xprt_complete_rqst(struct rpc_task *task, int copied)
{
struct rpc_rqst *req = task->tk_rqstp;

#ifdef RPC_PROFILE
/* Profile only reads for now */
if (copied > 1024) {
static unsigned long nextstat;
static unsigned long pkt_rtt, pkt_len, pkt_cnt;

pkt_cnt++;
pkt_len += req->rq_slen + copied;
pkt_rtt += jiffies - req->rq_xtime;
if (time_before(nextstat, jiffies)) {
printk("RPC: %lu %ld cwnd\n", jiffies, xprt->cwnd);
printk("RPC: %ld %ld %ld %ld stat\n",
jiffies, pkt_cnt, pkt_len, pkt_rtt);
pkt_rtt = pkt_len = pkt_cnt = 0;
nextstat = jiffies + 5 * HZ;
}
}
#endif
dprintk("RPC: %5u xid %08x complete (%d bytes received)\n",
task->tk_pid, ntohl(req->rq_xid), copied);

dprintk("RPC: %4d has input (%d bytes)\n", task->tk_pid, copied);
list_del_init(&req->rq_list);
req->rq_received = req->rq_private_buf.len = copied;

/* ... and wake up the process. */
rpc_wake_up_task(task);
return;
}

static void xprt_timer(struct rpc_task *task)
Expand Down
13 changes: 5 additions & 8 deletions trunk/net/sunrpc/xprtsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,6 @@ static void xs_udp_data_ready(struct sock *sk, int len)
goto out_unlock;
task = rovr->rq_task;

dprintk("RPC: %4d received reply\n", task->tk_pid);

if ((copied = rovr->rq_private_buf.buflen) > repsize)
copied = repsize;

Expand All @@ -472,7 +470,9 @@ static void xs_udp_data_ready(struct sock *sk, int len)
/* Something worked... */
dst_confirm(skb->dst);

xprt_complete_rqst(xprt, rovr, copied);
xprt_adjust_cwnd(task, copied);
xprt_update_rtt(task);
xprt_complete_rqst(task, copied);

out_unlock:
spin_unlock(&xprt->transport_lock);
Expand Down Expand Up @@ -634,11 +634,8 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, skb_reader_t *desc
}

out:
if (!(xprt->tcp_flags & XPRT_COPY_DATA)) {
dprintk("RPC: %4d received reply complete\n",
req->rq_task->tk_pid);
xprt_complete_rqst(xprt, req, xprt->tcp_copied);
}
if (!(xprt->tcp_flags & XPRT_COPY_DATA))
xprt_complete_rqst(req->rq_task, xprt->tcp_copied);
spin_unlock(&xprt->transport_lock);
xs_tcp_check_recm(xprt);
}
Expand Down

0 comments on commit d6cc6ee

Please sign in to comment.