Re: [PATCH Version 1 08/11] SUNRPC: add rpc_drain_queue to empty an rpc_waitq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2012-03-15 at 14:40 -0400, andros@xxxxxxxxxx wrote:
> From: Andy Adamson <andros@xxxxxxxxxx>
> 
> Signed-off-by: Andy Adamson <andros@xxxxxxxxxx>
> ---
>  include/linux/sunrpc/sched.h |    1 +
>  net/sunrpc/sched.c           |   27 +++++++++++++++++++++++++++
>  2 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
> index dc0c3cc..fce0873 100644
> --- a/include/linux/sunrpc/sched.h
> +++ b/include/linux/sunrpc/sched.h
> @@ -235,6 +235,7 @@ void		rpc_sleep_on_priority(struct rpc_wait_queue *,
>  void		rpc_wake_up_queued_task(struct rpc_wait_queue *,
>  					struct rpc_task *);
>  void		rpc_wake_up(struct rpc_wait_queue *);
> +void		rpc_drain_queue(struct rpc_wait_queue *);
>  struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
>  struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *,
>  					bool (*)(struct rpc_task *, void *),
> diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
> index 1c570a8..11928ff 100644
> --- a/net/sunrpc/sched.c
> +++ b/net/sunrpc/sched.c
> @@ -551,6 +551,33 @@ void rpc_wake_up(struct rpc_wait_queue *queue)
>  EXPORT_SYMBOL_GPL(rpc_wake_up);
>  
>  /**
> + * rpc_drain_queue - empty the queue and wake up all rpc_tasks
> + * @queue: rpc_wait_queue on which the tasks are sleeping
> + *
> + * Grabs queue->lock
> + */
> +void rpc_drain_queue(struct rpc_wait_queue *queue)
> +{
> +	struct rpc_task *task;
> +	struct list_head *head;
> +
> +	spin_lock_bh(&queue->lock);
> +	head = &queue->tasks[queue->maxpriority];
> +	for (;;) {
> +		while (!list_empty(head)) {
> +			task = list_entry(head->next, struct rpc_task,
> +					  u.tk_wait.list);
> +			rpc_wake_up_task_queue_locked(queue, task);
> +		}
> +		if (head == &queue->tasks[0])
> +			break;
> +		head--;
> +	}
> +	spin_unlock_bh(&queue->lock);
> +}
> +EXPORT_SYMBOL_GPL(rpc_drain_queue);
> +

Confused... How is this function any different from rpc_wake_up()?

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com

��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux