rpc: add rpc_queue_empty function
authorAlexandros Batsakis <batsakis@netapp.com>
Tue, 15 Dec 2009 05:27:53 +0000 (21:27 -0800)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 15 Dec 2009 18:51:17 +0000 (13:51 -0500)
Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
include/linux/sunrpc/sched.h
net/sunrpc/sched.c

index 1906782ec86bc6b668998e17bc3a68d6c244a334..9157405f93201c4dc33c0ef54428056ad997996f 100644 (file)
@@ -229,6 +229,7 @@ void                rpc_wake_up_queued_task(struct rpc_wait_queue *,
 void           rpc_wake_up(struct rpc_wait_queue *);
 struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
 void           rpc_wake_up_status(struct rpc_wait_queue *, int);
+int            rpc_queue_empty(struct rpc_wait_queue *);
 void           rpc_delay(struct rpc_task *, unsigned long);
 void *         rpc_malloc(struct rpc_task *, size_t);
 void           rpc_free(void *);
index cef74ba0666c2c7cab9a755a29c8ce5985a5dde7..89ea8e69ec78994e1fc568c0bd87a0f1ceb52cd5 100644 (file)
@@ -384,6 +384,20 @@ static void rpc_wake_up_task_queue_locked(struct rpc_wait_queue *queue, struct r
                __rpc_do_wake_up_task(queue, task);
 }
 
+/*
+ * Tests whether rpc queue is empty
+ */
+int rpc_queue_empty(struct rpc_wait_queue *queue)
+{
+       int res;
+
+       spin_lock_bh(&queue->lock);
+       res = queue->qlen;
+       spin_unlock_bh(&queue->lock);
+       return (res == 0);
+}
+EXPORT_SYMBOL_GPL(rpc_queue_empty);
+
 /*
  * Wake up a task on a specific queue
  */