diff options
author | Chuck Lever <cel@netapp.com> | 2006-03-20 13:44:16 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:16 -0500 |
commit | 262ca07de4d7f1bff20361c1353bb14b3607afb2 (patch) | |
tree | e448a66b4549bbd660f76e81da0067d762a4732e /net/sunrpc/xprt.c | |
parent | e19b63dafdf7d615b0d36b90990a07e7792b9d3a (diff) |
SUNRPC: add a handful of per-xprt counters
Monitor generic transport events. Add a transport switch callout to
format transport counters for export to user-land.
Test plan:
Compile kernel with CONFIG_NFS enabled.
Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r-- | net/sunrpc/xprt.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 8ff2c8acb223..93a0a3ca0d5f 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -548,6 +548,7 @@ void xprt_connect(struct rpc_task *task) | |||
548 | 548 | ||
549 | task->tk_timeout = xprt->connect_timeout; | 549 | task->tk_timeout = xprt->connect_timeout; |
550 | rpc_sleep_on(&xprt->pending, task, xprt_connect_status, NULL); | 550 | rpc_sleep_on(&xprt->pending, task, xprt_connect_status, NULL); |
551 | xprt->stat.connect_start = jiffies; | ||
551 | xprt->ops->connect(task); | 552 | xprt->ops->connect(task); |
552 | } | 553 | } |
553 | return; | 554 | return; |
@@ -558,6 +559,8 @@ static void xprt_connect_status(struct rpc_task *task) | |||
558 | struct rpc_xprt *xprt = task->tk_xprt; | 559 | struct rpc_xprt *xprt = task->tk_xprt; |
559 | 560 | ||
560 | if (task->tk_status >= 0) { | 561 | if (task->tk_status >= 0) { |
562 | xprt->stat.connect_count++; | ||
563 | xprt->stat.connect_time += (long)jiffies - xprt->stat.connect_start; | ||
561 | dprintk("RPC: %4d xprt_connect_status: connection established\n", | 564 | dprintk("RPC: %4d xprt_connect_status: connection established\n", |
562 | task->tk_pid); | 565 | task->tk_pid); |
563 | return; | 566 | return; |
@@ -601,16 +604,14 @@ static void xprt_connect_status(struct rpc_task *task) | |||
601 | struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid) | 604 | struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid) |
602 | { | 605 | { |
603 | struct list_head *pos; | 606 | struct list_head *pos; |
604 | struct rpc_rqst *req = NULL; | ||
605 | 607 | ||
606 | list_for_each(pos, &xprt->recv) { | 608 | list_for_each(pos, &xprt->recv) { |
607 | struct rpc_rqst *entry = list_entry(pos, struct rpc_rqst, rq_list); | 609 | struct rpc_rqst *entry = list_entry(pos, struct rpc_rqst, rq_list); |
608 | if (entry->rq_xid == xid) { | 610 | if (entry->rq_xid == xid) |
609 | req = entry; | 611 | return entry; |
610 | break; | ||
611 | } | ||
612 | } | 612 | } |
613 | return req; | 613 | xprt->stat.bad_xids++; |
614 | return NULL; | ||
614 | } | 615 | } |
615 | 616 | ||
616 | /** | 617 | /** |
@@ -646,6 +647,7 @@ void xprt_complete_rqst(struct rpc_task *task, int copied) | |||
646 | dprintk("RPC: %5u xid %08x complete (%d bytes received)\n", | 647 | dprintk("RPC: %5u xid %08x complete (%d bytes received)\n", |
647 | task->tk_pid, ntohl(req->rq_xid), copied); | 648 | task->tk_pid, ntohl(req->rq_xid), copied); |
648 | 649 | ||
650 | task->tk_xprt->stat.recvs++; | ||
649 | list_del_init(&req->rq_list); | 651 | list_del_init(&req->rq_list); |
650 | req->rq_received = req->rq_private_buf.len = copied; | 652 | req->rq_received = req->rq_private_buf.len = copied; |
651 | rpc_wake_up_task(task); | 653 | rpc_wake_up_task(task); |
@@ -744,12 +746,19 @@ void xprt_transmit(struct rpc_task *task) | |||
744 | if (status == 0) { | 746 | if (status == 0) { |
745 | dprintk("RPC: %4d xmit complete\n", task->tk_pid); | 747 | dprintk("RPC: %4d xmit complete\n", task->tk_pid); |
746 | spin_lock_bh(&xprt->transport_lock); | 748 | spin_lock_bh(&xprt->transport_lock); |
749 | |||
747 | xprt->ops->set_retrans_timeout(task); | 750 | xprt->ops->set_retrans_timeout(task); |
751 | |||
752 | xprt->stat.sends++; | ||
753 | xprt->stat.req_u += xprt->stat.sends - xprt->stat.recvs; | ||
754 | xprt->stat.bklog_u += xprt->backlog.qlen; | ||
755 | |||
748 | /* Don't race with disconnect */ | 756 | /* Don't race with disconnect */ |
749 | if (!xprt_connected(xprt)) | 757 | if (!xprt_connected(xprt)) |
750 | task->tk_status = -ENOTCONN; | 758 | task->tk_status = -ENOTCONN; |
751 | else if (!req->rq_received) | 759 | else if (!req->rq_received) |
752 | rpc_sleep_on(&xprt->pending, task, NULL, xprt_timer); | 760 | rpc_sleep_on(&xprt->pending, task, NULL, xprt_timer); |
761 | |||
753 | xprt->ops->release_xprt(xprt, task); | 762 | xprt->ops->release_xprt(xprt, task); |
754 | spin_unlock_bh(&xprt->transport_lock); | 763 | spin_unlock_bh(&xprt->transport_lock); |
755 | return; | 764 | return; |