From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 v3 PATCH 09/13] gfs2: split glock instantiation off from do_promote
Date: Tue, 12 Oct 2021 23:48:38 +0200 [thread overview]
Message-ID: <CAHc6FU6wKBFOwuWPw7o6+tx4hVPhhFitSzx607qQ-8YYU5kTCw@mail.gmail.com> (raw)
In-Reply-To: <20211011194008.50097-10-rpeterso@redhat.com>
On Mon, Oct 11, 2021 at 9:41 PM Bob Peterson <rpeterso@redhat.com> wrote:
> 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>
> ---
> fs/gfs2/glock.c | 47 +++++++++++++++++++++++++++++++++++++----------
> 1 file changed, 37 insertions(+), 10 deletions(-)
>
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index 1d64b45d1ea9..39bfac34e8a4 100644
> --- a/fs/gfs2/glock.c
> +++ b/fs/gfs2/glock.c
> @@ -380,6 +380,33 @@ static void do_error(struct gfs2_glock *gl, const int ret)
> }
> }
>
> +/**
> + * gfs2_instantiate - Call the glops instantiate function
> + * @gl: The glock
> + *
> + * Returns: 0 if instantiate was successful, 2 if type specific operation is
> + * underway, or error.
> + */
> +static int gfs2_instantiate(struct gfs2_holder *gh)
> +{
> + struct gfs2_glock *gl = gh->gh_gl;
> + const struct gfs2_glock_operations *glops = gl->gl_ops;
> + int ret;
> +
> + ret = glops->go_instantiate(gh);
> + switch(ret) {
> + case 0:
> + break;
> + case 1:
> + ret = 2;
> + break;
> + default:
> + gh->gh_error = ret;
> + break;
> + }
> + return ret;
> +}
Moving the return value tweaking here doesn't help, it only
complicates gfs2_instantiate. So let me revert that.
> +
> /**
> * do_promote - promote as many requests as possible on the current queue
> * @gl: The glock
> @@ -392,7 +419,6 @@ static int do_promote(struct gfs2_glock *gl)
> __releases(&gl->gl_lockref.lock)
> __acquires(&gl->gl_lockref.lock)
> {
> - const struct gfs2_glock_operations *glops = gl->gl_ops;
> struct gfs2_holder *gh, *tmp;
> bool lock_released;
> int ret;
> @@ -409,19 +435,20 @@ __acquires(&gl->gl_lockref.lock)
> break;
> }
> if (gh->gh_list.prev == &gl->gl_holders &&
> - !(gh->gh_flags & GL_SKIP) && glops->go_instantiate) {
> + !(gh->gh_flags & GL_SKIP) && gl->gl_ops->go_instantiate) {
> lock_released = true;
> spin_unlock(&gl->gl_lockref.lock);
> - ret = glops->go_instantiate(gh);
> + ret = gfs2_instantiate(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 (ret == 2)
> + return ret;
> + else {
> + list_del_init(&gh->gh_list);
> + trace_gfs2_glock_queue(gh, 0);
> + gfs2_holder_wake(gh);
> + goto restart;
> + }
We can replace the "else { XXX }" with "XXX" here.
> }
> }
> set_bit(HIF_HOLDER, &gh->gh_iflags);
> --
> 2.31.1
>
Thanks,
Andreas
next prev parent reply other threads:[~2021-10-12 21:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 19:39 [Cluster-devel] [GFS2 v3 PATCH 00/13] gfs2: fix bugs related to node_scope and go_lock Bob Peterson
2021-10-11 19:39 ` [Cluster-devel] [GFS2 v3 PATCH 01/13] gfs2: Allow append and immutable bits to coexist Bob Peterson
2021-10-11 19:39 ` [Cluster-devel] [GFS2 v3 PATCH 02/13] gfs2: Save ip from gfs2_glock_nq_init Bob Peterson
2021-10-11 19:39 ` [Cluster-devel] [GFS2 v3 PATCH 03/13] gfs2: dequeue iopen holder in gfs2_inode_lookup error Bob Peterson
2021-10-11 19:39 ` [Cluster-devel] [GFS2 v3 PATCH 04/13] gfs2: dump glocks from gfs2_consist_OBJ_i Bob Peterson
2021-10-11 19:40 ` [Cluster-devel] [GFS2 v3 PATCH 05/13] gfs2: change go_lock to go_instantiate Bob Peterson
2021-10-11 19:40 ` [Cluster-devel] [GFS2 v3 PATCH 06/13] gfs2: Remove 'first' trace_gfs2_promote argument Bob Peterson
2021-10-11 19:40 ` [Cluster-devel] [GFS2 v3 PATCH 07/13] gfs2: re-factor function do_promote Bob Peterson
2021-10-11 19:40 ` [Cluster-devel] [GFS2 v3 PATCH 08/13] gfs2: further simplify do_promote Bob Peterson
2021-10-11 19:40 ` [Cluster-devel] [GFS2 v3 PATCH 09/13] gfs2: split glock instantiation off from do_promote Bob Peterson
2021-10-12 21:48 ` Andreas Gruenbacher [this message]
2021-10-11 19:40 ` [Cluster-devel] [GFS2 v3 PATCH 10/13] gfs2: fix GL_SKIP node_scope problems Bob Peterson
2021-10-11 19:40 ` [Cluster-devel] [GFS2 v3 PATCH 11/13] gfs2: Eliminate GIF_INVALID flag Bob Peterson
2021-10-11 19:40 ` [Cluster-devel] [GFS2 v3 PATCH 12/13] gfs2: remove RDF_UPTODATE flag Bob Peterson
2021-10-11 19:40 ` [Cluster-devel] [GFS2 v3 PATCH 13/13] gfs2: set glock object after nq Bob Peterson
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=CAHc6FU6wKBFOwuWPw7o6+tx4hVPhhFitSzx607qQ-8YYU5kTCw@mail.gmail.com \
--to=agruenba@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).