Commit c1442f6b authored by Bob Peterson's avatar Bob Peterson Committed by Andreas Gruenbacher

gfs2: move GL_SKIP check from glops to do_promote

Before this patch, each individual "go_lock" glock operation (glop)
checked the GL_SKIP flag, and if set, would skip further processing.

This patch changes the logic so the go_lock caller, function go_promote,
checks the GL_SKIP flag before calling the go_lock op in the first place.
This avoids having to unnecessarily unlock gl_lockref.lock only to
re-lock it again.
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 4c69038d
...@@ -502,18 +502,20 @@ __acquires(&gl->gl_lockref.lock) ...@@ -502,18 +502,20 @@ __acquires(&gl->gl_lockref.lock)
} }
if (gh->gh_list.prev == &gl->gl_holders && if (gh->gh_list.prev == &gl->gl_holders &&
glops->go_lock) { glops->go_lock) {
spin_unlock(&gl->gl_lockref.lock); if (!(gh->gh_flags & GL_SKIP)) {
/* FIXME: eliminate this eventually */ spin_unlock(&gl->gl_lockref.lock);
ret = glops->go_lock(gh); /* FIXME: eliminate this eventually */
spin_lock(&gl->gl_lockref.lock); ret = glops->go_lock(gh);
if (ret) { spin_lock(&gl->gl_lockref.lock);
if (ret == 1) if (ret) {
return 2; if (ret == 1)
gh->gh_error = ret; return 2;
list_del_init(&gh->gh_list); gh->gh_error = ret;
trace_gfs2_glock_queue(gh, 0); list_del_init(&gh->gh_list);
gfs2_holder_wake(gh); trace_gfs2_glock_queue(gh, 0);
goto restart; gfs2_holder_wake(gh);
goto restart;
}
} }
set_bit(HIF_HOLDER, &gh->gh_iflags); set_bit(HIF_HOLDER, &gh->gh_iflags);
trace_gfs2_promote(gh, 1); trace_gfs2_promote(gh, 1);
......
...@@ -495,7 +495,7 @@ static int inode_go_lock(struct gfs2_holder *gh) ...@@ -495,7 +495,7 @@ static int inode_go_lock(struct gfs2_holder *gh)
struct gfs2_inode *ip = gl->gl_object; struct gfs2_inode *ip = gl->gl_object;
int error = 0; int error = 0;
if (!ip || (gh->gh_flags & GL_SKIP)) if (!ip)
return 0; return 0;
if (test_bit(GIF_INVALID, &ip->i_flags)) { if (test_bit(GIF_INVALID, &ip->i_flags)) {
......
...@@ -1292,8 +1292,6 @@ int gfs2_rgrp_go_lock(struct gfs2_holder *gh) ...@@ -1292,8 +1292,6 @@ int gfs2_rgrp_go_lock(struct gfs2_holder *gh)
{ {
struct gfs2_rgrpd *rgd = gh->gh_gl->gl_object; struct gfs2_rgrpd *rgd = gh->gh_gl->gl_object;
if (gh->gh_flags & GL_SKIP)
return 0;
return gfs2_rgrp_bh_get(rgd); return gfs2_rgrp_bh_get(rgd);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment