gfs2: do_promote cleanup
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 8 Aug 2023 20:46:34 +0000 (22:46 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 5 Sep 2023 13:58:16 +0000 (15:58 +0200)
Change function do_promote to return true on success, and false
otherwise.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/glock.c

index 1438e74..d0c82b7 100644 (file)
@@ -468,10 +468,10 @@ done:
  * do_promote - promote as many requests as possible on the current queue
  * @gl: The glock
  * 
- * Returns: 1 if there is a blocked holder at the head of the list
+ * Returns true on success (i.e., progress was made or there are no waiters).
  */
 
-static int do_promote(struct gfs2_glock *gl)
+static bool do_promote(struct gfs2_glock *gl)
 {
        struct gfs2_holder *gh, *current_gh;
 
@@ -484,10 +484,10 @@ static int do_promote(struct gfs2_glock *gl)
                         * If we get here, it means we may not grant this
                         * holder for some reason. If this holder is at the
                         * head of the list, it means we have a blocked holder
-                        * at the head, so return 1.
+                        * at the head, so return false.
                         */
                        if (list_is_first(&gh->gh_list, &gl->gl_holders))
-                               return 1;
+                               return false;
                        do_error(gl, 0);
                        break;
                }
@@ -497,7 +497,7 @@ static int do_promote(struct gfs2_glock *gl)
                if (!current_gh)
                        current_gh = gh;
        }
-       return 0;
+       return true;
 }
 
 /**
@@ -834,7 +834,7 @@ __acquires(&gl->gl_lockref.lock)
        } else {
                if (test_bit(GLF_DEMOTE, &gl->gl_flags))
                        gfs2_demote_wake(gl);
-               if (do_promote(gl) == 0)
+               if (do_promote(gl))
                        goto out_unlock;
                gh = find_first_waiter(gl);
                gl->gl_target = gh->gh_state;