All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sunil Mushran <sunil.mushran@oracle.com>
To: Joel Becker <joel.becker@oracle.com>
Cc: ocfs2-devel@oss.oracle.com, mfasheh@suse.com,
	linux-kernel@vger.kernel.org
Subject: [Ocfs2-devel] [PATCH 06/11] ocfs2: Hang the locking proto on the cluster conn and use it in asts.
Date: Fri, 12 Feb 2010 15:59:18 -0800	[thread overview]
Message-ID: <4B75EB56.9030708@oracle.com> (raw)
In-Reply-To: <1265794074-19539-7-git-send-email-joel.becker@oracle.com>

Acked-by: Sunil Mushran <sunil.mushran@oracle.com>

Joel Becker wrote:
> With the ocfs2_cluster_connection hanging off of the ocfs2_dlm_lksb, we
> have access to it in the ast and bast wrapper functions.  Attach the
> ocfs2_locking_protocol to the conn.
>
> Now, instead of refering to a static variable for ast/bast pointers, the
> wrappers can look at the connection.  This means different connections
> can have different ast/bast pointers, and it reduces the need for the
> static pointer.
>
> Signed-off-by: Joel Becker <joel.becker@oracle.com>
> ---
>  fs/ocfs2/stack_o2cb.c |   15 ++++-----------
>  fs/ocfs2/stack_user.c |   10 +++-------
>  fs/ocfs2/stackglue.c  |    1 +
>  fs/ocfs2/stackglue.h  |    1 +
>  4 files changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
> index 41e6bad..abf696a 100644
> --- a/fs/ocfs2/stack_o2cb.c
> +++ b/fs/ocfs2/stack_o2cb.c
> @@ -163,28 +163,21 @@ static void o2dlm_lock_ast_wrapper(void *astarg)
>  {
>  	struct ocfs2_dlm_lksb *lksb = astarg;
>  
> -	BUG_ON(o2cb_stack.sp_proto == NULL);
> -
> -	o2cb_stack.sp_proto->lp_lock_ast(lksb);
> +	lksb->lksb_conn->cc_proto->lp_lock_ast(lksb);
>  }
>  
>  static void o2dlm_blocking_ast_wrapper(void *astarg, int level)
>  {
>  	struct ocfs2_dlm_lksb *lksb = astarg;
>  
> -	BUG_ON(o2cb_stack.sp_proto == NULL);
> -
> -	o2cb_stack.sp_proto->lp_blocking_ast(lksb, level);
> +	lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level);
>  }
>  
>  static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status)
>  {
>  	struct ocfs2_dlm_lksb *lksb = astarg;
> -
>  	int error = dlm_status_to_errno(status);
>  
> -	BUG_ON(o2cb_stack.sp_proto == NULL);
> -
>  	/*
>  	 * In o2dlm, you can get both the lock_ast() for the lock being
>  	 * granted and the unlock_ast() for the CANCEL failing.  A
> @@ -199,7 +192,7 @@ static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status)
>  	if (status == DLM_CANCELGRANT)
>  		return;
>  
> -	o2cb_stack.sp_proto->lp_unlock_ast(lksb, error);
> +	lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, error);
>  }
>  
>  static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn,
> @@ -284,7 +277,7 @@ static int o2cb_cluster_connect(struct ocfs2_cluster_connection *conn)
>  	struct dlm_protocol_version dlm_version;
>  
>  	BUG_ON(conn == NULL);
> -	BUG_ON(o2cb_stack.sp_proto == NULL);
> +	BUG_ON(conn->cc_proto == NULL);
>  
>  	/* for now we only have one cluster/node, make sure we see it
>  	 * in the heartbeat universe */
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index 31276ba..b4cf616 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -668,8 +668,6 @@ static void fsdlm_lock_ast_wrapper(void *astarg)
>  	struct ocfs2_dlm_lksb *lksb = astarg;
>  	int status = lksb->lksb_fsdlm.sb_status;
>  
> -	BUG_ON(ocfs2_user_plugin.sp_proto == NULL);
> -
>  	/*
>  	 * For now we're punting on the issue of other non-standard errors
>  	 * where we can't tell if the unlock_ast or lock_ast should be called.
> @@ -681,18 +679,16 @@ static void fsdlm_lock_ast_wrapper(void *astarg)
>  	 */
>  
>  	if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL)
> -		ocfs2_user_plugin.sp_proto->lp_unlock_ast(lksb, 0);
> +		lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, 0);
>  	else
> -		ocfs2_user_plugin.sp_proto->lp_lock_ast(lksb);
> +		lksb->lksb_conn->cc_proto->lp_lock_ast(lksb);
>  }
>  
>  static void fsdlm_blocking_ast_wrapper(void *astarg, int level)
>  {
>  	struct ocfs2_dlm_lksb *lksb = astarg;
>  
> -	BUG_ON(ocfs2_user_plugin.sp_proto == NULL);
> -
> -	ocfs2_user_plugin.sp_proto->lp_blocking_ast(lksb, level);
> +	lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level);
>  }
>  
>  static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
> diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
> index 8ef9a57..010ecab 100644
> --- a/fs/ocfs2/stackglue.c
> +++ b/fs/ocfs2/stackglue.c
> @@ -343,6 +343,7 @@ int ocfs2_cluster_connect(const char *stack_name,
>  	new_conn->cc_recovery_handler = recovery_handler;
>  	new_conn->cc_recovery_data = recovery_data;
>  
> +	new_conn->cc_proto = lproto;
>  	/* Start the new connection at our maximum compatibility level */
>  	new_conn->cc_version = lproto->lp_max_version;
>  
> diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h
> index bb32926..cf8bac2 100644
> --- a/fs/ocfs2/stackglue.h
> +++ b/fs/ocfs2/stackglue.h
> @@ -100,6 +100,7 @@ struct ocfs2_cluster_connection {
>  	char cc_name[GROUP_NAME_MAX];
>  	int cc_namelen;
>  	struct ocfs2_protocol_version cc_version;
> +	struct ocfs2_locking_protocol *cc_proto;
>  	void (*cc_recovery_handler)(int node_num, void *recovery_data);
>  	void *cc_recovery_data;
>  	void *cc_lockspace;
>   

WARNING: multiple messages have this Message-ID (diff)
From: Sunil Mushran <sunil.mushran@oracle.com>
To: Joel Becker <joel.becker@oracle.com>
Cc: ocfs2-devel@oss.oracle.com, mfasheh@suse.com,
	linux-kernel@vger.kernel.org
Subject: Re: [Ocfs2-devel] [PATCH 06/11] ocfs2: Hang the locking proto on the cluster conn and use it in asts.
Date: Fri, 12 Feb 2010 15:59:18 -0800	[thread overview]
Message-ID: <4B75EB56.9030708@oracle.com> (raw)
In-Reply-To: <1265794074-19539-7-git-send-email-joel.becker@oracle.com>

Acked-by: Sunil Mushran <sunil.mushran@oracle.com>

Joel Becker wrote:
> With the ocfs2_cluster_connection hanging off of the ocfs2_dlm_lksb, we
> have access to it in the ast and bast wrapper functions.  Attach the
> ocfs2_locking_protocol to the conn.
>
> Now, instead of refering to a static variable for ast/bast pointers, the
> wrappers can look at the connection.  This means different connections
> can have different ast/bast pointers, and it reduces the need for the
> static pointer.
>
> Signed-off-by: Joel Becker <joel.becker@oracle.com>
> ---
>  fs/ocfs2/stack_o2cb.c |   15 ++++-----------
>  fs/ocfs2/stack_user.c |   10 +++-------
>  fs/ocfs2/stackglue.c  |    1 +
>  fs/ocfs2/stackglue.h  |    1 +
>  4 files changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
> index 41e6bad..abf696a 100644
> --- a/fs/ocfs2/stack_o2cb.c
> +++ b/fs/ocfs2/stack_o2cb.c
> @@ -163,28 +163,21 @@ static void o2dlm_lock_ast_wrapper(void *astarg)
>  {
>  	struct ocfs2_dlm_lksb *lksb = astarg;
>  
> -	BUG_ON(o2cb_stack.sp_proto == NULL);
> -
> -	o2cb_stack.sp_proto->lp_lock_ast(lksb);
> +	lksb->lksb_conn->cc_proto->lp_lock_ast(lksb);
>  }
>  
>  static void o2dlm_blocking_ast_wrapper(void *astarg, int level)
>  {
>  	struct ocfs2_dlm_lksb *lksb = astarg;
>  
> -	BUG_ON(o2cb_stack.sp_proto == NULL);
> -
> -	o2cb_stack.sp_proto->lp_blocking_ast(lksb, level);
> +	lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level);
>  }
>  
>  static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status)
>  {
>  	struct ocfs2_dlm_lksb *lksb = astarg;
> -
>  	int error = dlm_status_to_errno(status);
>  
> -	BUG_ON(o2cb_stack.sp_proto == NULL);
> -
>  	/*
>  	 * In o2dlm, you can get both the lock_ast() for the lock being
>  	 * granted and the unlock_ast() for the CANCEL failing.  A
> @@ -199,7 +192,7 @@ static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status)
>  	if (status == DLM_CANCELGRANT)
>  		return;
>  
> -	o2cb_stack.sp_proto->lp_unlock_ast(lksb, error);
> +	lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, error);
>  }
>  
>  static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn,
> @@ -284,7 +277,7 @@ static int o2cb_cluster_connect(struct ocfs2_cluster_connection *conn)
>  	struct dlm_protocol_version dlm_version;
>  
>  	BUG_ON(conn == NULL);
> -	BUG_ON(o2cb_stack.sp_proto == NULL);
> +	BUG_ON(conn->cc_proto == NULL);
>  
>  	/* for now we only have one cluster/node, make sure we see it
>  	 * in the heartbeat universe */
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index 31276ba..b4cf616 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -668,8 +668,6 @@ static void fsdlm_lock_ast_wrapper(void *astarg)
>  	struct ocfs2_dlm_lksb *lksb = astarg;
>  	int status = lksb->lksb_fsdlm.sb_status;
>  
> -	BUG_ON(ocfs2_user_plugin.sp_proto == NULL);
> -
>  	/*
>  	 * For now we're punting on the issue of other non-standard errors
>  	 * where we can't tell if the unlock_ast or lock_ast should be called.
> @@ -681,18 +679,16 @@ static void fsdlm_lock_ast_wrapper(void *astarg)
>  	 */
>  
>  	if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL)
> -		ocfs2_user_plugin.sp_proto->lp_unlock_ast(lksb, 0);
> +		lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, 0);
>  	else
> -		ocfs2_user_plugin.sp_proto->lp_lock_ast(lksb);
> +		lksb->lksb_conn->cc_proto->lp_lock_ast(lksb);
>  }
>  
>  static void fsdlm_blocking_ast_wrapper(void *astarg, int level)
>  {
>  	struct ocfs2_dlm_lksb *lksb = astarg;
>  
> -	BUG_ON(ocfs2_user_plugin.sp_proto == NULL);
> -
> -	ocfs2_user_plugin.sp_proto->lp_blocking_ast(lksb, level);
> +	lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level);
>  }
>  
>  static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
> diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
> index 8ef9a57..010ecab 100644
> --- a/fs/ocfs2/stackglue.c
> +++ b/fs/ocfs2/stackglue.c
> @@ -343,6 +343,7 @@ int ocfs2_cluster_connect(const char *stack_name,
>  	new_conn->cc_recovery_handler = recovery_handler;
>  	new_conn->cc_recovery_data = recovery_data;
>  
> +	new_conn->cc_proto = lproto;
>  	/* Start the new connection at our maximum compatibility level */
>  	new_conn->cc_version = lproto->lp_max_version;
>  
> diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h
> index bb32926..cf8bac2 100644
> --- a/fs/ocfs2/stackglue.h
> +++ b/fs/ocfs2/stackglue.h
> @@ -100,6 +100,7 @@ struct ocfs2_cluster_connection {
>  	char cc_name[GROUP_NAME_MAX];
>  	int cc_namelen;
>  	struct ocfs2_protocol_version cc_version;
> +	struct ocfs2_locking_protocol *cc_proto;
>  	void (*cc_recovery_handler)(int node_num, void *recovery_data);
>  	void *cc_recovery_data;
>  	void *cc_lockspace;
>   


  reply	other threads:[~2010-02-12 23:59 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10  9:27 [Ocfs2-devel] [0/11] ocfs2_dlmfs improvements v2 Joel Becker
2010-02-10  9:27 ` Joel Becker
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 01/11] ocfs2_dlmfs: Add capabilities parameter Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-02-11 20:41   ` [Ocfs2-devel] " Sunil Mushran
2010-02-11 20:41     ` Sunil Mushran
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 02/11] ocfs2_dlmfs: Use poll() to signify BASTs Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 03/11] ocfs2_dlmfs: Move to its own directory Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-02-11 21:12   ` [Ocfs2-devel] " Sunil Mushran
2010-02-11 21:12     ` Sunil Mushran
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 04/11] ocfs2: Pass lksbs back from stackglue ast/bast functions Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-02-11 21:20   ` [Ocfs2-devel] " Sunil Mushran
2010-02-11 21:20     ` Sunil Mushran
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 05/11] ocfs2: Attach the connection to the lksb Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-02-12 23:57   ` [Ocfs2-devel] " Sunil Mushran
2010-02-12 23:57     ` Sunil Mushran
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 06/11] ocfs2: Hang the locking proto on the cluster conn and use it in asts Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-02-12 23:59   ` Sunil Mushran [this message]
2010-02-12 23:59     ` [Ocfs2-devel] " Sunil Mushran
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 07/11] ocfs2: Remove the ast pointers from ocfs2_stack_plugins Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-02-13  1:10   ` [Ocfs2-devel] " Sunil Mushran
2010-02-13  1:10     ` Sunil Mushran
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 08/11] ocfs2: Pass the locking protocol into ocfs2_cluster_connect() Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-02-27  0:09   ` [Ocfs2-devel] " Sunil Mushran
2010-02-27  0:09     ` Sunil Mushran
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 09/11] ocfs2_dlmfs: Don't honor truncate. The size of a dlmfs file is LVB_LEN Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-02-27  0:11   ` [Ocfs2-devel] " Sunil Mushran
2010-02-27  0:11     ` Sunil Mushran
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 10/11] ocfs2_dlmfs: Use the stackglue Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-02-27  0:27   ` [Ocfs2-devel] " Sunil Mushran
2010-02-27  0:27     ` Sunil Mushran
2010-02-10  9:27 ` [Ocfs2-devel] [PATCH 11/11] ocfs2_dlmfs: Enable the use of user cluster stacks Joel Becker
2010-02-10  9:27   ` Joel Becker
2010-03-02  0:08   ` [Ocfs2-devel] " Sunil Mushran
2010-03-02  0:08     ` Sunil Mushran

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=4B75EB56.9030708@oracle.com \
    --to=sunil.mushran@oracle.com \
    --cc=joel.becker@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --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.