[Devel] Re: [PATCH] Use list_first_entry in locks_wake_up_blocks

J. Bruce Fields bfields at fieldses.org
Wed Sep 19 12:22:12 PDT 2007


On Wed, Sep 19, 2007 at 04:44:07PM +0400, Pavel Emelyanov wrote:
> This routine deletes all the elements from the list
> with the "while (!list_empty())" loop, and we already
> have a list_first_entry() macro to help it look nicer :)

OK.

--b.

> 
> Signed-off-by: Pavel Emelyanov <xemul at openvz.org>
> 
> ---
> 
> diff --git a/fs/locks.c b/fs/locks.c
> index 746dc70..5fa072a 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -534,7 +534,9 @@ static void locks_insert_block(struct fi
>  static void locks_wake_up_blocks(struct file_lock *blocker)
>  {
>  	while (!list_empty(&blocker->fl_block)) {
> -		struct file_lock *waiter = list_entry(blocker->fl_block.next,
> +		struct file_lock *waiter;
> +
> +		waiter = list_first_entry(&blocker->fl_block,
>  				struct file_lock, fl_block);
>  		__locks_delete_block(waiter);
>  		if (waiter->fl_lmops && waiter->fl_lmops->fl_notify)




More information about the Devel mailing list