diff options
author | Bob Peterson <rpeterso@redhat.com> | 2021-09-13 12:54:16 -0500 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2021-10-25 08:42:17 +0200 |
commit | c1442f6b53d887d08a098ec23056be7cfea1e3c7 (patch) | |
tree | 0c6ddb607a901f3cef47fcd2d86989999b2eef87 /fs/gfs2 | |
parent | 4c69038d9087109e4dcf559cd0ecb44875af3089 (diff) |
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>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/glock.c | 26 | ||||
-rw-r--r-- | fs/gfs2/glops.c | 2 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 2 |
3 files changed, 15 insertions, 15 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index ff1227287284..5d6b253030a1 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -502,18 +502,20 @@ restart: } if (gh->gh_list.prev == &gl->gl_holders && glops->go_lock) { - spin_unlock(&gl->gl_lockref.lock); - /* FIXME: eliminate this eventually */ - ret = glops->go_lock(gh); - spin_lock(&gl->gl_lockref.lock); - if (ret) { - if (ret == 1) - return 2; - gh->gh_error = ret; - list_del_init(&gh->gh_list); - trace_gfs2_glock_queue(gh, 0); - gfs2_holder_wake(gh); - goto restart; + if (!(gh->gh_flags & GL_SKIP)) { + spin_unlock(&gl->gl_lockref.lock); + /* FIXME: eliminate this eventually */ + ret = glops->go_lock(gh); + spin_lock(&gl->gl_lockref.lock); + if (ret) { + if (ret == 1) + return 2; + gh->gh_error = ret; + list_del_init(&gh->gh_list); + trace_gfs2_glock_queue(gh, 0); + gfs2_holder_wake(gh); + goto restart; + } } set_bit(HIF_HOLDER, &gh->gh_iflags); trace_gfs2_promote(gh, 1); diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 79c621c7863d..4b19f513570f 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -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)) { diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 7a13a687e4f2..1fb66f6e6a0c 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -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); } |