Skip to content

Commit 9f7e6b4

Browse files
author
Andreas Gruenbacher
committed
gfs2: run_queue cleanup
JIRA: https://issues.redhat.com/browse/RHEL-116886 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git Transform the code in run_queue() to make it more readable. No change in functionality. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> (cherry picked from commit cd493dc)
1 parent 86124e6 commit 9f7e6b4

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

fs/gfs2/glock.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,12 @@ __acquires(&gl->gl_lockref.lock)
835835
/* While a demote is in progress, the GLF_LOCK flag must be set. */
836836
GLOCK_BUG_ON(gl, test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags));
837837

838-
if (test_bit(GLF_DEMOTE, &gl->gl_flags) &&
839-
gl->gl_demote_state != gl->gl_state) {
838+
if (test_bit(GLF_DEMOTE, &gl->gl_flags)) {
839+
if (gl->gl_demote_state == gl->gl_state) {
840+
gfs2_demote_wake(gl);
841+
goto promote;
842+
}
843+
840844
if (find_first_holder(gl))
841845
goto out_unlock;
842846
if (nonblock)
@@ -846,22 +850,21 @@ __acquires(&gl->gl_lockref.lock)
846850
gl->gl_target = gl->gl_demote_state;
847851
do_xmote(gl, NULL, gl->gl_target);
848852
return;
849-
} else {
850-
if (test_bit(GLF_DEMOTE, &gl->gl_flags))
851-
gfs2_demote_wake(gl);
852-
do_promote(gl);
853-
if (find_first_holder(gl))
854-
goto out_unlock;
855-
gh = find_first_waiter(gl);
856-
if (!gh)
857-
goto out_unlock;
858-
gl->gl_target = gh->gh_state;
859-
if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)))
860-
do_error(gl, 0); /* Fail queued try locks */
861-
do_xmote(gl, gh, gl->gl_target);
862-
return;
863853
}
864854

855+
promote:
856+
do_promote(gl);
857+
if (find_first_holder(gl))
858+
goto out_unlock;
859+
gh = find_first_waiter(gl);
860+
if (!gh)
861+
goto out_unlock;
862+
gl->gl_target = gh->gh_state;
863+
if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)))
864+
do_error(gl, 0); /* Fail queued try locks */
865+
do_xmote(gl, gh, gl->gl_target);
866+
return;
867+
865868
out_sched:
866869
clear_bit(GLF_LOCK, &gl->gl_flags);
867870
gl->gl_lockref.count++;

0 commit comments

Comments
 (0)