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

[Cluster-devel] [PATCH] [GFS2] Clean up run_queue()



A further clean up to make the logic a bit more obvious and
remove a local variable which is no longer required.

Signed-off-by: Steven Whitehouse <swhiteho redhat com>

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 65d6eba..79d61ff 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -564,24 +564,19 @@ static int rq_demote(struct gfs2_glock *gl)
  */
 static void run_queue(struct gfs2_glock *gl)
 {
-	int blocked;
-
-	for (;;) {
-		blocked = 1;
-		if (test_bit(GLF_LOCK, &gl->gl_flags))
-			break;
-
+	while(test_bit(GLF_LOCK, &gl->gl_flags) == 0) {
 		if (!list_empty(&gl->gl_waiters1)) {
 			rq_mutex(gl);
 			break;
-		} else if (test_bit(GLF_DEMOTE, &gl->gl_flags)) {
-			blocked = rq_demote(gl);
+		}
+		if (test_bit(GLF_DEMOTE, &gl->gl_flags)) {
+			if (rq_demote(gl) == 0)
+				continue;
 		} else if (!list_empty(&gl->gl_waiters3)) {
-			blocked = rq_promote(gl);
+			if (rq_promote(gl) == 0)
+				continue;
 		}
-
-		if (blocked)
-			break;
+		break;
 	}
 }
 
-- 
1.5.1.2


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