From: Joel Becker <jlbec@evilplan.org>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 4/7] Shift allocation of ocfs2_live_connection to ocfs2_cluster_connect
Date: Fri, 27 Sep 2013 12:03:05 -0700 [thread overview]
Message-ID: <20130927190304.GE26517@localhost> (raw)
In-Reply-To: <20130927170820.GA11723@shrek.lan>
On Fri, Sep 27, 2013 at 12:08:25PM -0500, Goldwyn Rodrigues wrote:
> This is required because we need the live_connection structure ready
> when we perform the dlm_new_lockspace().
Why? You just allocate it and pass it in. Is it for a future change?
Mention what that change is.
Joel
> ---
> fs/ocfs2/stack_user.c | 31 +++++++++++++++----------------
> 1 file changed, 15 insertions(+), 16 deletions(-)
>
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index 38c69c8..ffefbb5 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -205,16 +205,10 @@ static struct ocfs2_live_connection *ocfs2_connection_find(const char *name)
> * fill_super(), we can't get dupes here.
> */
> static int ocfs2_live_connection_new(struct ocfs2_cluster_connection *conn,
> - struct ocfs2_live_connection **c_ret,
> + struct ocfs2_live_connection *c,
> enum ocfs2_connection_type type)
> {
> int rc = 0;
> - struct ocfs2_live_connection *c;
> -
> - c = kzalloc(sizeof(struct ocfs2_live_connection), GFP_KERNEL);
> - if (!c)
> - return -ENOMEM;
> -
> mutex_lock(&ocfs2_control_lock);
> c->oc_conn = conn;
> c->oc_type = type;
> @@ -229,11 +223,6 @@ static int ocfs2_live_connection_new(struct ocfs2_cluster_connection *conn,
>
> mutex_unlock(&ocfs2_control_lock);
>
> - if (!rc)
> - *c_ret = c;
> - else
> - kfree(c);
> -
> return rc;
> }
>
> @@ -839,12 +828,18 @@ static int user_cluster_disconnect(struct ocfs2_cluster_connection *conn)
> static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
> {
> dlm_lockspace_t *fsdlm;
> - struct ocfs2_live_connection *uninitialized_var(control);
> + struct ocfs2_live_connection *lc = NULL;
> int rc = 0, ops_rv;
> enum ocfs2_connection_type type = NO_CONTROLD;
>
> BUG_ON(conn == NULL);
>
> + lc = kzalloc(sizeof(struct ocfs2_live_connection), GFP_KERNEL);
> + if (!lc) {
> + rc = -ENOMEM;
> + goto out;
> + }
> +
> rc = dlm_new_lockspace(conn->cc_name, conn->cc_cluster_name,
> DLM_LSFL_FS, DLM_LVB_LEN,
> &ocfs2_ls_ops, conn, &ops_rv, &fsdlm);
> @@ -863,7 +858,7 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
> }
> conn->cc_lockspace = fsdlm;
>
> - rc = ocfs2_live_connection_new(conn, &control, type);
> + rc = ocfs2_live_connection_new(conn, lc, type);
> if (rc)
> goto out;
>
> @@ -883,6 +878,7 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
> running_proto.pv_minor);
> rc = -EPROTO;
> user_cluster_disconnect(conn);
> + lc = NULL;
> goto out;
> }
>
> @@ -890,13 +886,16 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
> DLM_LSFL_FS, DLM_LVB_LEN,
> NULL, NULL, NULL, &fsdlm);
> if (rc) {
> - ocfs2_live_connection_drop(control);
> + ocfs2_live_connection_drop(lc);
> + lc = NULL;
> goto out;
> }
> }
>
> - conn->cc_private = control;
> + conn->cc_private = lc;
> out:
> + if (rc && lc)
> + kfree(lc);
> return rc;
> }
>
> --
> 1.8.1.4
>
>
> --
> Goldwyn
>
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-devel
--
"Time is an illusion, lunchtime doubly so."
-Douglas Adams
http://www.jlbec.org/
jlbec at evilplan.org
prev parent reply other threads:[~2013-09-27 19:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-27 17:08 [Ocfs2-devel] [PATCH 4/7] Shift allocation of ocfs2_live_connection to ocfs2_cluster_connect Goldwyn Rodrigues
2013-09-27 19:03 ` Joel Becker [this message]
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=20130927190304.GE26517@localhost \
--to=jlbec@evilplan.org \
--cc=ocfs2-devel@oss.oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.