From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2] Move "first lock" glops call
Date: Wed, 01 Aug 2007 14:07:41 +0100 [thread overview]
Message-ID: <1185973661.8765.642.camel@quoit> (raw)
Hi,
Further patches in the glock cleanup series,
Steve.
From 109c714b2b66e656b0004a628239cdf571eafe46 Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <swhiteho@redhat.com>
Date: Tue, 31 Jul 2007 16:53:31 +0100
Subject: [PATCH] [GFS2] Move "first lock" glops call
Rather than setting a flag "HIF_FIRST" for each granted lock holder
that is the first one on the glock's list, and then call the ->go_lock()
glops function later, in the context of the process waiting for the glock,
this patch calls the ->go_lock() function directly, removing the need
for the HIF_FIRST flag.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index d564876..fd8cf02 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -467,6 +467,20 @@ static void rq_mutex(struct gfs2_glock *gl)
wake_up_bit(&gh->gh_iflags, HIF_WAIT);
}
+static void first_holder(struct gfs2_holder *gh)
+{
+ struct gfs2_glock *gl = gh->gh_gl;
+ const struct gfs2_glock_operations *glops = gl->gl_ops;
+
+ if (glops->go_lock) {
+ spin_unlock(&gl->gl_spin);
+ gh->gh_error = glops->go_lock(gh);
+ spin_lock(&gl->gl_spin);
+ if (gh->gh_error)
+ list_del_init(&gh->gh_list);
+ }
+}
+
/**
* rq_promote - process a promote request in the queue
* @gh: the glock holder
@@ -493,8 +507,7 @@ static int rq_promote(struct gfs2_glock *gl)
}
if (list_empty(&gl->gl_holders)) {
- set_bit(HIF_FIRST, &gh->gh_iflags);
- set_bit(GLF_LOCK, &gl->gl_flags);
+ first_holder(gh);
} else {
struct gfs2_holder *next_gh;
if (gh->gh_state == LM_ST_EXCLUSIVE)
@@ -748,10 +761,9 @@ static void xmote_bh(struct gfs2_glock *gl, unsigned int ret)
goto out;
if (relaxed_state_ok(gl->gl_state, gh->gh_state, gh->gh_flags)) {
list_add_tail(&gh->gh_list, &gl->gl_holders);
- gh->gh_error = 0;
set_bit(HIF_HOLDER, &gh->gh_iflags);
- set_bit(HIF_FIRST, &gh->gh_iflags);
- op_done = 0;
+ gh->gh_error = 0;
+ first_holder(gh);
goto out;
}
gh->gh_error = GLR_TRYFAILED;
@@ -868,7 +880,6 @@ static int glock_wait_internal(struct gfs2_holder *gh)
{
struct gfs2_glock *gl = gh->gh_gl;
struct gfs2_sbd *sdp = gl->gl_sbd;
- const struct gfs2_glock_operations *glops = gl->gl_ops;
if (test_bit(HIF_ABORTED, &gh->gh_iflags))
return -EIO;
@@ -898,25 +909,6 @@ static int glock_wait_internal(struct gfs2_holder *gh)
gfs2_assert_withdraw(sdp, relaxed_state_ok(gl->gl_state, gh->gh_state,
gh->gh_flags));
- if (test_bit(HIF_FIRST, &gh->gh_iflags)) {
- gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
-
- if (glops->go_lock) {
- gh->gh_error = glops->go_lock(gh);
- if (gh->gh_error) {
- spin_lock(&gl->gl_spin);
- list_del_init(&gh->gh_list);
- spin_unlock(&gl->gl_spin);
- }
- }
-
- spin_lock(&gl->gl_spin);
- gl->gl_req_gh = NULL;
- clear_bit(GLF_LOCK, &gl->gl_flags);
- run_queue(gl);
- spin_unlock(&gl->gl_spin);
- }
-
return gh->gh_error;
}
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index cda2fba..1d90ff1 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -135,7 +135,6 @@ enum {
/* States */
HIF_HOLDER = 6,
- HIF_FIRST = 7,
HIF_ABORTED = 9,
HIF_WAIT = 10,
};
--
1.5.1.2
reply other threads:[~2007-08-01 13:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1185973661.8765.642.camel@quoit \
--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).