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: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:
Bob Peterson 2021-09-13 12:54:16 -05:00 committed by Andreas Gruenbacher
parent 4c69038d90
commit c1442f6b53
3 changed files with 15 additions and 15 deletions

View File

@ -502,6 +502,7 @@ restart:
}
if (gh->gh_list.prev == &gl->gl_holders &&
glops->go_lock) {
if (!(gh->gh_flags & GL_SKIP)) {
spin_unlock(&gl->gl_lockref.lock);
/* FIXME: eliminate this eventually */
ret = glops->go_lock(gh);
@ -515,6 +516,7 @@ restart:
gfs2_holder_wake(gh);
goto restart;
}
}
set_bit(HIF_HOLDER, &gh->gh_iflags);
trace_gfs2_promote(gh, 1);
gfs2_holder_wake(gh);

View File

@ -495,7 +495,7 @@ static int inode_go_lock(struct gfs2_holder *gh)
struct gfs2_inode *ip = gl->gl_object;
int error = 0;
if (!ip || (gh->gh_flags & GL_SKIP))
if (!ip)
return 0;
if (test_bit(GIF_INVALID, &ip->i_flags)) {

View File

@ -1292,8 +1292,6 @@ int gfs2_rgrp_go_lock(struct gfs2_holder *gh)
{
struct gfs2_rgrpd *rgd = gh->gh_gl->gl_object;
if (gh->gh_flags & GL_SKIP)
return 0;
return gfs2_rgrp_bh_get(rgd);
}