Skip to content

Commit 86124e6

Browse files
author
Andreas Gruenbacher
committed
gfs2: Simplify do_promote
JIRA: https://issues.redhat.com/browse/RHEL-116886 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git While not immediately obvious, do_promote() returns whether or not there are any active holders in the queue. But the function description is confusing, and this information is easy to come by for callers anyway, so turn do_promote() into a void function. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> (cherry picked from commit 2045364)
1 parent 62abf26 commit 86124e6

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

fs/gfs2/glock.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,9 @@ int gfs2_instantiate(struct gfs2_holder *gh)
482482
/**
483483
* do_promote - promote as many requests as possible on the current queue
484484
* @gl: The glock
485-
*
486-
* Returns true on success (i.e., progress was made or there are no waiters).
487485
*/
488486

489-
static bool do_promote(struct gfs2_glock *gl)
487+
static void do_promote(struct gfs2_glock *gl)
490488
{
491489
struct gfs2_holder *gh, *current_gh;
492490

@@ -497,13 +495,10 @@ static bool do_promote(struct gfs2_glock *gl)
497495
if (!may_grant(gl, current_gh, gh)) {
498496
/*
499497
* If we get here, it means we may not grant this
500-
* holder for some reason. If this holder is at the
501-
* head of the list, it means we have a blocked holder
502-
* at the head, so return false.
498+
* holder for some reason.
503499
*/
504-
if (list_is_first(&gh->gh_list, &gl->gl_holders))
505-
return false;
506-
do_error(gl, 0); /* Fail queued try locks */
500+
if (current_gh)
501+
do_error(gl, 0); /* Fail queued try locks */
507502
break;
508503
}
509504
set_bit(HIF_HOLDER, &gh->gh_iflags);
@@ -512,7 +507,6 @@ static bool do_promote(struct gfs2_glock *gl)
512507
if (!current_gh)
513508
current_gh = gh;
514509
}
515-
return true;
516510
}
517511

518512
/**
@@ -855,7 +849,8 @@ __acquires(&gl->gl_lockref.lock)
855849
} else {
856850
if (test_bit(GLF_DEMOTE, &gl->gl_flags))
857851
gfs2_demote_wake(gl);
858-
if (do_promote(gl))
852+
do_promote(gl);
853+
if (find_first_holder(gl))
859854
goto out_unlock;
860855
gh = find_first_waiter(gl);
861856
if (!gh)

0 commit comments

Comments
 (0)