summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2025-08-11 21:35:23 +0200
committerAndreas Gruenbacher <agruenba@redhat.com>2025-09-12 12:02:50 +0200
commitcd493dcf4f827700b66d1adb43f20d3838759beb (patch)
treedfea5d763242ace387d6303b31a8b8db9cf591eb
parent2045364497dbb16663df0267d6f733d964f22866 (diff)
gfs2: run_queue cleanup
Transform the code in run_queue() to make it more readable. No change in functionality. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Andrew Price <anprice@redhat.com>
-rw-r--r--fs/gfs2/glock.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 38f320e13a36..1eba27bb5f3c 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -835,8 +835,12 @@ __acquires(&gl->gl_lockref.lock)
/* While a demote is in progress, the GLF_LOCK flag must be set. */
GLOCK_BUG_ON(gl, test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags));
- if (test_bit(GLF_DEMOTE, &gl->gl_flags) &&
- gl->gl_demote_state != gl->gl_state) {
+ if (test_bit(GLF_DEMOTE, &gl->gl_flags)) {
+ if (gl->gl_demote_state == gl->gl_state) {
+ gfs2_demote_wake(gl);
+ goto promote;
+ }
+
if (find_first_holder(gl))
goto out_unlock;
if (nonblock)
@@ -846,22 +850,21 @@ __acquires(&gl->gl_lockref.lock)
gl->gl_target = gl->gl_demote_state;
do_xmote(gl, NULL, gl->gl_target);
return;
- } else {
- if (test_bit(GLF_DEMOTE, &gl->gl_flags))
- gfs2_demote_wake(gl);
- do_promote(gl);
- if (find_first_holder(gl))
- goto out_unlock;
- gh = find_first_waiter(gl);
- if (!gh)
- goto out_unlock;
- gl->gl_target = gh->gh_state;
- if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)))
- do_error(gl, 0); /* Fail queued try locks */
- do_xmote(gl, gh, gl->gl_target);
- return;
}
+promote:
+ do_promote(gl);
+ if (find_first_holder(gl))
+ goto out_unlock;
+ gh = find_first_waiter(gl);
+ if (!gh)
+ goto out_unlock;
+ gl->gl_target = gh->gh_state;
+ if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)))
+ do_error(gl, 0); /* Fail queued try locks */
+ do_xmote(gl, gh, gl->gl_target);
+ return;
+
out_sched:
clear_bit(GLF_LOCK, &gl->gl_flags);
gl->gl_lockref.count++;