Skip to content

Commit

Permalink
rpc: add rpc_queue_empty function
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Alexandros Batsakis authored and Trond Myklebust committed Dec 15, 2009
1 parent afe6c27 commit 48f1861
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/linux/sunrpc/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down
14 changes: 14 additions & 0 deletions net/sunrpc/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 48f1861

Please sign in to comment.