* [PATCH] Use list_first_entry in locks_wake_up_blocks
@ 2007-09-19 12:44 Pavel Emelyanov
2007-09-19 19:22 ` J. Bruce Fields
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2007-09-19 12:44 UTC (permalink / raw)
To: Andrew Morton; +Cc: J. Bruce Fields, Linux Kernel Mailing List, devel
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 :)
Signed-off-by: Pavel Emelyanov <xemul@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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Use list_first_entry in locks_wake_up_blocks
2007-09-19 12:44 [PATCH] Use list_first_entry in locks_wake_up_blocks Pavel Emelyanov
@ 2007-09-19 19:22 ` J. Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2007-09-19 19:22 UTC (permalink / raw)
To: Pavel Emelyanov; +Cc: Andrew Morton, Linux Kernel Mailing List, devel
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@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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-19 19:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-19 12:44 [PATCH] Use list_first_entry in locks_wake_up_blocks Pavel Emelyanov
2007-09-19 19:22 ` J. Bruce Fields
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox