From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] [GFS2] Merge ->go_drop_th() with ->go_xmote_th()
Date: Mon, 30 Jul 2007 10:32:16 +0100 [thread overview]
Message-ID: <11857879493817-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <11857879472203-git-send-email-swhiteho@redhat.com>
The drop and xmote callbacks were functionally identical
for glock types which had those callbacks. This patch
merges the functions while at the same time adding
an extra variable to the go_xmote_th() function for
future use (the new state). Thus both the new and old
states are now available in that callback.
This results in a fair amount of duplicate code being removed.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 79d61ff..dd23ab1 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -822,7 +822,7 @@ static void gfs2_glock_xmote_th(struct gfs2_glock *gl, struct gfs2_holder *gh)
unsigned int lck_ret;
if (glops->go_xmote_th)
- glops->go_xmote_th(gl);
+ glops->go_xmote_th(gl, state);
gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
gfs2_assert_warn(sdp, list_empty(&gl->gl_holders));
@@ -901,8 +901,8 @@ static void gfs2_glock_drop_th(struct gfs2_glock *gl)
const struct gfs2_glock_operations *glops = gl->gl_ops;
unsigned int ret;
- if (glops->go_drop_th)
- glops->go_drop_th(gl);
+ if (glops->go_xmote_th)
+ glops->go_xmote_th(gl, LM_ST_UNLOCKED);
gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
gfs2_assert_warn(sdp, list_empty(&gl->gl_holders));
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 777ca46..3a9729f 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -114,7 +114,7 @@ static void gfs2_pte_inval(struct gfs2_glock *gl)
* not return to caller to demote/unlock the glock until I/O is complete.
*/
-static void meta_go_sync(struct gfs2_glock *gl)
+static void meta_go_sync(struct gfs2_glock *gl, unsigned new_state)
{
if (gl->gl_state != LM_ST_EXCLUSIVE)
return;
@@ -178,7 +178,7 @@ static void inode_go_sync(struct gfs2_glock *gl)
*
*/
-static void inode_go_xmote_th(struct gfs2_glock *gl)
+static void inode_go_xmote_th(struct gfs2_glock *gl, unsigned new_state)
{
if (gl->gl_state != LM_ST_UNLOCKED)
gfs2_pte_inval(gl);
@@ -207,22 +207,6 @@ static void inode_go_xmote_bh(struct gfs2_glock *gl)
}
/**
- * inode_go_drop_th - unlock a glock
- * @gl: the glock
- *
- * Invoked from rq_demote().
- * Another node needs the lock in EXCLUSIVE mode, or lock (unused for too long)
- * is being purged from our node's glock cache; we're dropping lock.
- */
-
-static void inode_go_drop_th(struct gfs2_glock *gl)
-{
- gfs2_pte_inval(gl);
- if (gl->gl_state == LM_ST_EXCLUSIVE)
- inode_go_sync(gl);
-}
-
-/**
* inode_go_inval - prepare a inode glock to be released
* @gl: the glock
* @flags:
@@ -363,7 +347,7 @@ static void rgrp_go_unlock(struct gfs2_holder *gh)
*
*/
-static void trans_go_xmote_th(struct gfs2_glock *gl)
+static void trans_go_xmote_th(struct gfs2_glock *gl, unsigned new_state)
{
struct gfs2_sbd *sdp = gl->gl_sbd;
@@ -408,24 +392,6 @@ static void trans_go_xmote_bh(struct gfs2_glock *gl)
}
/**
- * trans_go_drop_th - unlock the transaction glock
- * @gl: the glock
- *
- * We want to sync the device even with localcaching. Remember
- * that localcaching journal replay only marks buffers dirty.
- */
-
-static void trans_go_drop_th(struct gfs2_glock *gl)
-{
- struct gfs2_sbd *sdp = gl->gl_sbd;
-
- if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
- gfs2_meta_syncfs(sdp);
- gfs2_log_shutdown(sdp);
- }
-}
-
-/**
* quota_go_demote_ok - Check to see if it's ok to unlock a quota glock
* @gl: the glock
*
@@ -439,14 +405,12 @@ static int quota_go_demote_ok(struct gfs2_glock *gl)
const struct gfs2_glock_operations gfs2_meta_glops = {
.go_xmote_th = meta_go_sync,
- .go_drop_th = meta_go_sync,
.go_type = LM_TYPE_META,
};
const struct gfs2_glock_operations gfs2_inode_glops = {
.go_xmote_th = inode_go_xmote_th,
.go_xmote_bh = inode_go_xmote_bh,
- .go_drop_th = inode_go_drop_th,
.go_inval = inode_go_inval,
.go_demote_ok = inode_go_demote_ok,
.go_lock = inode_go_lock,
@@ -456,7 +420,6 @@ const struct gfs2_glock_operations gfs2_inode_glops = {
const struct gfs2_glock_operations gfs2_rgrp_glops = {
.go_xmote_th = meta_go_sync,
- .go_drop_th = meta_go_sync,
.go_inval = meta_go_inval,
.go_demote_ok = rgrp_go_demote_ok,
.go_lock = rgrp_go_lock,
@@ -467,7 +430,6 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = {
const struct gfs2_glock_operations gfs2_trans_glops = {
.go_xmote_th = trans_go_xmote_th,
.go_xmote_bh = trans_go_xmote_bh,
- .go_drop_th = trans_go_drop_th,
.go_type = LM_TYPE_NONDISK,
};
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 170ba93..8b91f83 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -122,9 +122,8 @@ struct gfs2_bufdata {
};
struct gfs2_glock_operations {
- void (*go_xmote_th) (struct gfs2_glock *gl);
+ void (*go_xmote_th) (struct gfs2_glock *gl, unsigned new_state);
void (*go_xmote_bh) (struct gfs2_glock *gl);
- void (*go_drop_th) (struct gfs2_glock *gl);
void (*go_inval) (struct gfs2_glock *gl, int flags);
int (*go_demote_ok) (struct gfs2_glock *gl);
int (*go_lock) (struct gfs2_holder *gh);
--
1.5.1.2
next prev parent reply other threads:[~2007-07-30 9:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-30 9:32 [Cluster-devel] [GFS2] Clean up glock layer Steven Whitehouse
2007-07-30 9:32 ` [Cluster-devel] [PATCH] [GFS2] Clean up arguments to rq_mutex/rq_promote Steven Whitehouse
2007-07-30 9:32 ` [Cluster-devel] [PATCH] [GFS2] Clean up run_queue() Steven Whitehouse
2007-07-30 9:32 ` Steven Whitehouse [this message]
2007-07-30 9:32 ` [Cluster-devel] [PATCH] [GFS2] Merge gfs2_glock_drop_th() into gfs2_glock_xmote_th() Steven Whitehouse
2007-07-30 9:32 ` [Cluster-devel] [PATCH] [GFs2] Remove reclaim logic from rq_promote() Steven Whitehouse
2007-08-02 13:39 ` [Cluster-devel] [PATCH] [GFS2] Clean up run_queue() David Teigland
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=11857879493817-git-send-email-swhiteho@redhat.com \
--to=swhiteho@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).