Skip to content

Commit e6f8560

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: split glock instantiation off from do_promote
Before this patch, function do_promote had a section of code that did the actual instantiation. This patch splits that off into its own function, gfs2_instantiate, which prepares us for the next patch that will use that function. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 60d8bae commit e6f8560

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

fs/gfs2/glock.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,21 @@ find_first_strong_holder(struct gfs2_glock *gl)
472472
return NULL;
473473
}
474474

475+
/*
476+
* gfs2_instantiate - Call the glops instantiate function
477+
* @gl: The glock
478+
*
479+
* Returns: 0 if instantiate was successful, 2 if type specific operation is
480+
* underway, or error.
481+
*/
482+
static int gfs2_instantiate(struct gfs2_holder *gh)
483+
{
484+
struct gfs2_glock *gl = gh->gh_gl;
485+
const struct gfs2_glock_operations *glops = gl->gl_ops;
486+
487+
return glops->go_instantiate(gh);
488+
}
489+
475490
/**
476491
* do_promote - promote as many requests as possible on the current queue
477492
* @gl: The glock
@@ -484,7 +499,6 @@ static int do_promote(struct gfs2_glock *gl)
484499
__releases(&gl->gl_lockref.lock)
485500
__acquires(&gl->gl_lockref.lock)
486501
{
487-
const struct gfs2_glock_operations *glops = gl->gl_ops;
488502
struct gfs2_holder *gh, *tmp, *first_gh;
489503
bool incompat_holders_demoted = false;
490504
bool lock_released;
@@ -513,10 +527,10 @@ __acquires(&gl->gl_lockref.lock)
513527
first_gh = gh;
514528
}
515529
if (gh->gh_list.prev == &gl->gl_holders &&
516-
!(gh->gh_flags & GL_SKIP) && glops->go_instantiate) {
530+
!(gh->gh_flags & GL_SKIP) && gl->gl_ops->go_instantiate) {
517531
lock_released = true;
518532
spin_unlock(&gl->gl_lockref.lock);
519-
ret = glops->go_instantiate(gh);
533+
ret = gfs2_instantiate(gh);
520534
spin_lock(&gl->gl_lockref.lock);
521535
if (ret) {
522536
if (ret == 1)

0 commit comments

Comments
 (0)