OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] Use list_first_entry in locks_wake_up_blocks
[PATCH] Use list_first_entry in locks_wake_up_blocks [message #20511] Wed, 19 September 2007 12:44 Go to previous message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
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)
 
Read Message
Read Message
Previous Topic: [PATCH] Wake up mandatory locks waiter on chmod
Next Topic: [PATCH 2/5][GFS2] Cleanup explicit check for mandatory locks
Goto Forum:
  


Current Time: Thu Sep 19 07:38:17 GMT 2024

Total time taken to generate the page: 0.06294 seconds