Skip to contentSkip to conversation

keep lru_list_lock around osync_buffers_list

PATCH New Christoph Hellwig 1 participant 1 message Dec 2, 2002 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 keep lru_list_lock around osync_buffers_list

There's exactly one caller of osync_buffers_list (and it's static to buffer.c), so we can keep holding lru_list_lock over the call to it instead of releasing and reacquiring it.

fs/buffer.c +3 -4
@@ -869,8 +869,8 @@
 		spin_lock(&lru_list_lock);
 	}
 	
-	spin_unlock(&lru_list_lock);
 	err2 = osync_buffers_list(list);
+	spin_unlock(&lru_list_lock);
 
 	if (err)
 		return err;
@@ -887,6 +887,8 @@
  * you dirty the buffers, and then use osync_buffers_list to wait for
  * completion.  Any other dirty buffers which are not yet queued for
  * write will not be flushed to disk by the osync.
+ *
+ * Expects lru_list_lock to be held at entry.
  */
 static int osync_buffers_list(struct list_head *list)
 {
@@ -894,8 +896,6 @@
 	struct list_head *p;
 	int err = 0;
 
-	spin_lock(&lru_list_lock);
-	
  repeat:
 	list_for_each_prev(p, list) {
 		bh = BH_ENTRY(p);
@@ -911,7 +911,6 @@
 		}
 	}
 
-	spin_unlock(&lru_list_lock);
 	return err;
 }