SUNRPC: track length of RPC wait queues
authorChuck Lever <cel@netapp.com>
Mon, 20 Mar 2006 18:44:15 +0000 (13:44 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 20 Mar 2006 18:44:15 +0000 (13:44 -0500)
RPC wait queue length will eventually be exported to userland via the RPC
iostats interface.

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>
include/linux/sunrpc/sched.h
net/sunrpc/sched.c

index a390c9b8a01e8182bd0a77161bd088d3a514233a..6c23f73a799a0760649ccc89eefd34d1f50ac272 100644 (file)
@@ -203,6 +203,7 @@ struct rpc_wait_queue {
        unsigned char           priority;               /* current priority */
        unsigned char           count;                  /* # task groups remaining serviced so far */
        unsigned char           nr;                     /* # tasks remaining for cookie */
+       unsigned short          qlen;                   /* total # tasks waiting in queue */
 #ifdef RPC_DEBUG
        const char *            name;
 #endif
index 1b74420d16030d034635733eff748b5aede50c98..aa0449dcd8e521d53448c8c1a2f98a8f84c27786 100644 (file)
@@ -181,6 +181,7 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue, struct rpc_task *
        else
                list_add_tail(&task->u.tk_wait.list, &queue->tasks[0]);
        task->u.tk_wait.rpc_waitq = queue;
+       queue->qlen++;
        rpc_set_queued(task);
 
        dprintk("RPC: %4d added to queue %p \"%s\"\n",
@@ -215,6 +216,7 @@ static void __rpc_remove_wait_queue(struct rpc_task *task)
                __rpc_remove_wait_queue_priority(task);
        else
                list_del(&task->u.tk_wait.list);
+       queue->qlen--;
        dprintk("RPC: %4d removed from queue %p \"%s\"\n",
                                task->tk_pid, queue, rpc_qname(queue));
 }