From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 01/13] GFS2: Remove gotos from function run_queue
Date: Mon, 19 Nov 2018 07:29:19 -0600 [thread overview]
Message-ID: <20181119132931.15726-2-rpeterso@redhat.com> (raw)
In-Reply-To: <20181119132931.15726-1-rpeterso@redhat.com>
This patch removes all the gotos from function run_queue and inlines
the code where necessary. This is a small step toward unravelling the
logic to reorganize the glock state machine.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
fs/gfs2/glock.c | 38 ++++++++++++++++++--------------------
1 file changed, 18 insertions(+), 20 deletions(-)
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 05431324b262..692784faa464 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -628,10 +628,18 @@ __acquires(&gl->gl_lockref.lock)
if (test_bit(GLF_DEMOTE, &gl->gl_flags) &&
gl->gl_demote_state != gl->gl_state) {
- if (find_first_holder(gl))
- goto out_unlock;
- if (nonblock)
- goto out_sched;
+ if (find_first_holder(gl)) {
+ clear_bit(GLF_LOCK, &gl->gl_flags);
+ smp_mb__after_atomic();
+ return;
+ }
+ if (nonblock) {
+ clear_bit(GLF_LOCK, &gl->gl_flags);
+ smp_mb__after_atomic();
+ gl->gl_lockref.count++;
+ __gfs2_glock_queue_work(gl, 0);
+ return;
+ }
set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
GLOCK_BUG_ON(gl, gl->gl_demote_state == LM_ST_EXCLUSIVE);
gl->gl_target = gl->gl_demote_state;
@@ -639,29 +647,19 @@ __acquires(&gl->gl_lockref.lock)
if (test_bit(GLF_DEMOTE, &gl->gl_flags))
gfs2_demote_wake(gl);
ret = do_promote(gl);
- if (ret == 0)
- goto out_unlock;
+ if (ret == 0) {
+ clear_bit(GLF_LOCK, &gl->gl_flags);
+ smp_mb__after_atomic();
+ return;
+ }
if (ret == 2)
- goto out;
+ return;
gh = find_first_waiter(gl);
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);
-out:
- return;
-
-out_sched:
- clear_bit(GLF_LOCK, &gl->gl_flags);
- smp_mb__after_atomic();
- gl->gl_lockref.count++;
- __gfs2_glock_queue_work(gl, 0);
- return;
-
-out_unlock:
- clear_bit(GLF_LOCK, &gl->gl_flags);
- smp_mb__after_atomic();
return;
}
--
2.19.1
next prev parent reply other threads:[~2018-11-19 13:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-19 13:29 [Cluster-devel] [PATCH 00/13] Radical Reform of glock state machine (take 2) Bob Peterson
2018-11-19 13:29 ` Bob Peterson [this message]
2018-11-19 13:29 ` [Cluster-devel] [PATCH 02/13] GFS2: Make do_xmote determine its own gh parameter Bob Peterson
2018-11-19 14:00 ` Steven Whitehouse
2018-11-19 21:06 ` Bob Peterson
2018-11-20 15:46 ` Steven Whitehouse
2018-11-19 13:29 ` [Cluster-devel] [PATCH 03/13] GFS2: Eliminate a goto in finish_xmote Bob Peterson
2018-11-19 13:49 ` Steven Whitehouse
2018-11-19 21:26 ` Bob Peterson
2018-11-20 15:52 ` Steven Whitehouse
2018-11-19 13:29 ` [Cluster-devel] [PATCH 04/13] GFS2: Baby step toward a real state machine: finish_xmote Bob Peterson
2018-11-19 13:29 ` [Cluster-devel] [PATCH 05/13] GFS2: Add do_xmote states to state machine Bob Peterson
2018-11-19 13:29 ` [Cluster-devel] [PATCH 06/13] GFS2: Make do_xmote not call the state machine again Bob Peterson
2018-11-19 13:29 ` [Cluster-devel] [PATCH 07/13] GFS2: Add blocking and non-blocking demote to state machine Bob Peterson
2018-11-19 13:29 ` [Cluster-devel] [PATCH 08/13] GFS2: Add a new GL_ST_PROMOTE state to glock " Bob Peterson
2018-11-19 13:29 ` [Cluster-devel] [PATCH 09/13] GFS2: Replace run_queue with new GL_ST_RUN state in " Bob Peterson
2018-11-19 13:29 ` [Cluster-devel] [PATCH 10/13] GFS2: Reduce redundancy in GL_ST_DEMOTE_NONBLOCK state Bob Peterson
2018-11-19 13:29 ` [Cluster-devel] [PATCH 11/13] GFS2: Reduce glock_work_func to a single call to state_machine Bob Peterson
2018-11-19 13:29 ` [Cluster-devel] [PATCH 12/13] GFS2: Add new GL_ST_UNLOCK state to reduce calls to the __ version Bob Peterson
2018-11-19 13:29 ` [Cluster-devel] [PATCH 13/13] GFS2: Optimization of GL_ST_UNLOCK state Bob Peterson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181119132931.15726-2-rpeterso@redhat.com \
--to=rpeterso@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).