diff options
| author | Jeff Layton <jlayton@primarydata.com> | 2014-10-28 14:24:13 -0400 |
|---|---|---|
| committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-11-24 12:53:35 -0500 |
| commit | 3705ad64f123271b2b88dbff0c9891b7b90299d2 (patch) | |
| tree | f84b813e2e69ed7f317e3499a638f2892ea6ab91 /net/sunrpc | |
| parent | 860a0d9e511f278bedab62d555a457c18e0841d5 (diff) | |
sunrpc: add new tracepoints in xprt handling code
...so we can keep track of when calls are sent and replies received.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'net/sunrpc')
| -rw-r--r-- | net/sunrpc/xprt.c | 9 | ||||
| -rw-r--r-- | net/sunrpc/xprtsock.c | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 56e4e150e80e..1b2e5e616cae 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
| @@ -49,6 +49,8 @@ | |||
| 49 | #include <linux/sunrpc/metrics.h> | 49 | #include <linux/sunrpc/metrics.h> |
| 50 | #include <linux/sunrpc/bc_xprt.h> | 50 | #include <linux/sunrpc/bc_xprt.h> |
| 51 | 51 | ||
| 52 | #include <trace/events/sunrpc.h> | ||
| 53 | |||
| 52 | #include "sunrpc.h" | 54 | #include "sunrpc.h" |
| 53 | 55 | ||
| 54 | /* | 56 | /* |
| @@ -772,11 +774,14 @@ struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid) | |||
| 772 | struct rpc_rqst *entry; | 774 | struct rpc_rqst *entry; |
| 773 | 775 | ||
| 774 | list_for_each_entry(entry, &xprt->recv, rq_list) | 776 | list_for_each_entry(entry, &xprt->recv, rq_list) |
| 775 | if (entry->rq_xid == xid) | 777 | if (entry->rq_xid == xid) { |
| 778 | trace_xprt_lookup_rqst(xprt, xid, 0); | ||
| 776 | return entry; | 779 | return entry; |
| 780 | } | ||
| 777 | 781 | ||
| 778 | dprintk("RPC: xprt_lookup_rqst did not find xid %08x\n", | 782 | dprintk("RPC: xprt_lookup_rqst did not find xid %08x\n", |
| 779 | ntohl(xid)); | 783 | ntohl(xid)); |
| 784 | trace_xprt_lookup_rqst(xprt, xid, -ENOENT); | ||
| 780 | xprt->stat.bad_xids++; | 785 | xprt->stat.bad_xids++; |
| 781 | return NULL; | 786 | return NULL; |
| 782 | } | 787 | } |
| @@ -810,6 +815,7 @@ void xprt_complete_rqst(struct rpc_task *task, int copied) | |||
| 810 | 815 | ||
| 811 | dprintk("RPC: %5u xid %08x complete (%d bytes received)\n", | 816 | dprintk("RPC: %5u xid %08x complete (%d bytes received)\n", |
| 812 | task->tk_pid, ntohl(req->rq_xid), copied); | 817 | task->tk_pid, ntohl(req->rq_xid), copied); |
| 818 | trace_xprt_complete_rqst(xprt, req->rq_xid, copied); | ||
| 813 | 819 | ||
| 814 | xprt->stat.recvs++; | 820 | xprt->stat.recvs++; |
| 815 | req->rq_rtt = ktime_sub(ktime_get(), req->rq_xtime); | 821 | req->rq_rtt = ktime_sub(ktime_get(), req->rq_xtime); |
| @@ -926,6 +932,7 @@ void xprt_transmit(struct rpc_task *task) | |||
| 926 | 932 | ||
| 927 | req->rq_xtime = ktime_get(); | 933 | req->rq_xtime = ktime_get(); |
| 928 | status = xprt->ops->send_request(task); | 934 | status = xprt->ops->send_request(task); |
| 935 | trace_xprt_transmit(xprt, req->rq_xid, status); | ||
| 929 | if (status != 0) { | 936 | if (status != 0) { |
| 930 | task->tk_status = status; | 937 | task->tk_status = status; |
| 931 | return; | 938 | return; |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 3b305ab17afe..b63e26272dc2 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
| @@ -1454,12 +1454,15 @@ static void xs_tcp_data_ready(struct sock *sk) | |||
| 1454 | struct rpc_xprt *xprt; | 1454 | struct rpc_xprt *xprt; |
| 1455 | read_descriptor_t rd_desc; | 1455 | read_descriptor_t rd_desc; |
| 1456 | int read; | 1456 | int read; |
| 1457 | unsigned long total = 0; | ||
| 1457 | 1458 | ||
| 1458 | dprintk("RPC: xs_tcp_data_ready...\n"); | 1459 | dprintk("RPC: xs_tcp_data_ready...\n"); |
| 1459 | 1460 | ||
| 1460 | read_lock_bh(&sk->sk_callback_lock); | 1461 | read_lock_bh(&sk->sk_callback_lock); |
| 1461 | if (!(xprt = xprt_from_sock(sk))) | 1462 | if (!(xprt = xprt_from_sock(sk))) { |
| 1463 | read = 0; | ||
| 1462 | goto out; | 1464 | goto out; |
| 1465 | } | ||
| 1463 | /* Any data means we had a useful conversation, so | 1466 | /* Any data means we had a useful conversation, so |
| 1464 | * the we don't need to delay the next reconnect | 1467 | * the we don't need to delay the next reconnect |
| 1465 | */ | 1468 | */ |
| @@ -1471,8 +1474,11 @@ static void xs_tcp_data_ready(struct sock *sk) | |||
| 1471 | do { | 1474 | do { |
| 1472 | rd_desc.count = 65536; | 1475 | rd_desc.count = 65536; |
| 1473 | read = tcp_read_sock(sk, &rd_desc, xs_tcp_data_recv); | 1476 | read = tcp_read_sock(sk, &rd_desc, xs_tcp_data_recv); |
| 1477 | if (read > 0) | ||
| 1478 | total += read; | ||
| 1474 | } while (read > 0); | 1479 | } while (read > 0); |
| 1475 | out: | 1480 | out: |
| 1481 | trace_xs_tcp_data_ready(xprt, read, total); | ||
| 1476 | read_unlock_bh(&sk->sk_callback_lock); | 1482 | read_unlock_bh(&sk->sk_callback_lock); |
| 1477 | } | 1483 | } |
| 1478 | 1484 | ||
