From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH 11/12] GFS2: Add new GL_ST_UNLOCK state to reduce calls to the __ version
Date: Mon, 9 Jul 2018 12:50:27 -0500 [thread overview]
Message-ID: <20180709175028.17090-12-rpeterso@redhat.com> (raw)
In-Reply-To: <20180709175028.17090-1-rpeterso@redhat.com>
Before this patch, the truncate code called __state_machine but
only did the unlock of GLF_UNLOCK. This patch adds a new state
GL_ST_UNLOCK does the same thing, thus allowing it to call the
regular state_machine function. This reduces the calls to the
helper.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
fs/gfs2/glock.c | 11 ++++++-----
fs/gfs2/glock.h | 1 +
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index e20bb1222c01..b7b8cf16d613 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -749,6 +749,11 @@ static void __state_machine(struct gfs2_glock *gl, int new_state,
}
gl->gl_mch = GL_ST_RUN;
break;
+
+ case GL_ST_UNLOCK:
+ clear_bit(GLF_LOCK, &gl->gl_flags);
+ gl->gl_mch = GL_ST_RUN;
+ break;
}
} while (gl->gl_mch != GL_ST_IDLE || new_state != GL_ST_IDLE);
@@ -773,7 +778,6 @@ static void __state_machine(struct gfs2_glock *gl, int new_state,
* @gl: pointer to the glock we are transitioning
* @new_state: The new state we need to execute
*
- * Just like __state_machine but it acquires the gl_lockref lock
*/
static void state_machine(struct gfs2_glock *gl, int new_state,
const int nonblock)
@@ -1733,10 +1737,7 @@ void gfs2_glock_finish_truncate(struct gfs2_inode *ip)
ret = gfs2_truncatei_resume(ip);
gfs2_assert_withdraw(gl->gl_name.ln_sbd, ret == 0);
- spin_lock(&gl->gl_lockref.lock);
- clear_bit(GLF_LOCK, &gl->gl_flags);
- __state_machine(gl, GL_ST_RUN, 1);
- spin_unlock(&gl->gl_lockref.lock);
+ state_machine(gl, GL_ST_UNLOCK, 1);
}
static const char *state2str(unsigned state)
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index 0b1dffb92e8a..5bbf3118c7c3 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -131,6 +131,7 @@ enum gl_machine_states {
GL_ST_PROMOTE = 6, /* Promote the lock */
GL_ST_RUN = 7, /* "Run" or progress the lock */
GL_ST_WORK = 8, /* Perform general glock work */
+ GL_ST_UNLOCK = 9, /* Unlock then run */
};
struct lm_lockops {
--
2.17.1
next prev parent reply other threads:[~2018-07-09 17:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-09 17:50 [Cluster-devel] [GFS2 PATCH 00/12] Radical Reform of glock state machine Bob Peterson
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 01/12] GFS2: Make do_xmote determine its own gh parameter Bob Peterson
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 02/12] GFS2: Eliminate a goto in finish_xmote Bob Peterson
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 03/12] GFS2: Baby step toward a real state machine: finish_xmote Bob Peterson
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 04/12] GFS2: Add do_xmote states to state machine Bob Peterson
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 05/12] GFS2: Make do_xmote not call the state machine again Bob Peterson
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 06/12] GFS2: Add blocking and non-blocking demote to state machine Bob Peterson
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 07/12] GFS2: Add a new GL_ST_PROMOTE state to glock " Bob Peterson
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 08/12] GFS2: Replace run_queue with new GL_ST_RUN state in " Bob Peterson
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 09/12] GFS2: Reduce redundancy in GL_ST_DEMOTE_NONBLOCK state Bob Peterson
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 10/12] GFS2: Reduce glock_work_func to a single call to state_machine Bob Peterson
2018-07-09 17:50 ` Bob Peterson [this message]
2018-07-09 17:50 ` [Cluster-devel] [GFS2 PATCH 12/12] GFS2: Optimization of GL_ST_UNLOCK state Bob Peterson
2018-07-10 8:27 ` [Cluster-devel] [GFS2 PATCH 00/12] Radical Reform of glock state machine Steven Whitehouse
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=20180709175028.17090-12-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).