diff options
author | Joel Becker <joel.becker@oracle.com> | 2010-01-29 18:46:23 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-02-26 18:41:16 -0500 |
commit | 110946c8fb23c1e1e23312afed0977ad4aa37c95 (patch) | |
tree | a71cc2b0f7819d80426ed0a445f42d4558df99fb /fs/ocfs2 | |
parent | c0e4133851ed94c73ee3d34a2f2a245fcd0a60a1 (diff) |
ocfs2: Hang the locking proto on the cluster conn and use it in asts.
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>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/stack_o2cb.c | 15 | ||||
-rw-r--r-- | fs/ocfs2/stack_user.c | 10 | ||||
-rw-r--r-- | fs/ocfs2/stackglue.c | 1 | ||||
-rw-r--r-- | 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 fa9dd79c3615..7020e1253ffa 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) | |||
163 | { | 163 | { |
164 | struct ocfs2_dlm_lksb *lksb = astarg; | 164 | struct ocfs2_dlm_lksb *lksb = astarg; |
165 | 165 | ||
166 | BUG_ON(o2cb_stack.sp_proto == NULL); | 166 | lksb->lksb_conn->cc_proto->lp_lock_ast(lksb); |
167 | |||
168 | o2cb_stack.sp_proto->lp_lock_ast(lksb); | ||
169 | } | 167 | } |
170 | 168 | ||
171 | static void o2dlm_blocking_ast_wrapper(void *astarg, int level) | 169 | static void o2dlm_blocking_ast_wrapper(void *astarg, int level) |
172 | { | 170 | { |
173 | struct ocfs2_dlm_lksb *lksb = astarg; | 171 | struct ocfs2_dlm_lksb *lksb = astarg; |
174 | 172 | ||
175 | BUG_ON(o2cb_stack.sp_proto == NULL); | 173 | lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level); |
176 | |||
177 | o2cb_stack.sp_proto->lp_blocking_ast(lksb, level); | ||
178 | } | 174 | } |
179 | 175 | ||
180 | static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status) | 176 | static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status) |
181 | { | 177 | { |
182 | struct ocfs2_dlm_lksb *lksb = astarg; | 178 | struct ocfs2_dlm_lksb *lksb = astarg; |
183 | |||
184 | int error = dlm_status_to_errno(status); | 179 | int error = dlm_status_to_errno(status); |
185 | 180 | ||
186 | BUG_ON(o2cb_stack.sp_proto == NULL); | ||
187 | |||
188 | /* | 181 | /* |
189 | * In o2dlm, you can get both the lock_ast() for the lock being | 182 | * In o2dlm, you can get both the lock_ast() for the lock being |
190 | * granted and the unlock_ast() for the CANCEL failing. A | 183 | * 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) | |||
199 | if (status == DLM_CANCELGRANT) | 192 | if (status == DLM_CANCELGRANT) |
200 | return; | 193 | return; |
201 | 194 | ||
202 | o2cb_stack.sp_proto->lp_unlock_ast(lksb, error); | 195 | lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, error); |
203 | } | 196 | } |
204 | 197 | ||
205 | static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, | 198 | static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, |
@@ -284,7 +277,7 @@ static int o2cb_cluster_connect(struct ocfs2_cluster_connection *conn) | |||
284 | struct dlm_protocol_version fs_version; | 277 | struct dlm_protocol_version fs_version; |
285 | 278 | ||
286 | BUG_ON(conn == NULL); | 279 | BUG_ON(conn == NULL); |
287 | BUG_ON(o2cb_stack.sp_proto == NULL); | 280 | BUG_ON(conn->cc_proto == NULL); |
288 | 281 | ||
289 | /* for now we only have one cluster/node, make sure we see it | 282 | /* for now we only have one cluster/node, make sure we see it |
290 | * in the heartbeat universe */ | 283 | * in the heartbeat universe */ |
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index 31276bac78f5..b4cf616ef423 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) | |||
668 | struct ocfs2_dlm_lksb *lksb = astarg; | 668 | struct ocfs2_dlm_lksb *lksb = astarg; |
669 | int status = lksb->lksb_fsdlm.sb_status; | 669 | int status = lksb->lksb_fsdlm.sb_status; |
670 | 670 | ||
671 | BUG_ON(ocfs2_user_plugin.sp_proto == NULL); | ||
672 | |||
673 | /* | 671 | /* |
674 | * For now we're punting on the issue of other non-standard errors | 672 | * For now we're punting on the issue of other non-standard errors |
675 | * where we can't tell if the unlock_ast or lock_ast should be called. | 673 | * 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) | |||
681 | */ | 679 | */ |
682 | 680 | ||
683 | if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) | 681 | if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) |
684 | ocfs2_user_plugin.sp_proto->lp_unlock_ast(lksb, 0); | 682 | lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, 0); |
685 | else | 683 | else |
686 | ocfs2_user_plugin.sp_proto->lp_lock_ast(lksb); | 684 | lksb->lksb_conn->cc_proto->lp_lock_ast(lksb); |
687 | } | 685 | } |
688 | 686 | ||
689 | static void fsdlm_blocking_ast_wrapper(void *astarg, int level) | 687 | static void fsdlm_blocking_ast_wrapper(void *astarg, int level) |
690 | { | 688 | { |
691 | struct ocfs2_dlm_lksb *lksb = astarg; | 689 | struct ocfs2_dlm_lksb *lksb = astarg; |
692 | 690 | ||
693 | BUG_ON(ocfs2_user_plugin.sp_proto == NULL); | 691 | lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level); |
694 | |||
695 | ocfs2_user_plugin.sp_proto->lp_blocking_ast(lksb, level); | ||
696 | } | 692 | } |
697 | 693 | ||
698 | static int user_dlm_lock(struct ocfs2_cluster_connection *conn, | 694 | static int user_dlm_lock(struct ocfs2_cluster_connection *conn, |
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c index 8ef9a574315e..010ecabbdeb5 100644 --- a/fs/ocfs2/stackglue.c +++ b/fs/ocfs2/stackglue.c | |||
@@ -343,6 +343,7 @@ int ocfs2_cluster_connect(const char *stack_name, | |||
343 | new_conn->cc_recovery_handler = recovery_handler; | 343 | new_conn->cc_recovery_handler = recovery_handler; |
344 | new_conn->cc_recovery_data = recovery_data; | 344 | new_conn->cc_recovery_data = recovery_data; |
345 | 345 | ||
346 | new_conn->cc_proto = lproto; | ||
346 | /* Start the new connection at our maximum compatibility level */ | 347 | /* Start the new connection at our maximum compatibility level */ |
347 | new_conn->cc_version = lproto->lp_max_version; | 348 | new_conn->cc_version = lproto->lp_max_version; |
348 | 349 | ||
diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h index bb32926912ba..cf8bac23ae09 100644 --- a/fs/ocfs2/stackglue.h +++ b/fs/ocfs2/stackglue.h | |||
@@ -100,6 +100,7 @@ struct ocfs2_cluster_connection { | |||
100 | char cc_name[GROUP_NAME_MAX]; | 100 | char cc_name[GROUP_NAME_MAX]; |
101 | int cc_namelen; | 101 | int cc_namelen; |
102 | struct ocfs2_protocol_version cc_version; | 102 | struct ocfs2_protocol_version cc_version; |
103 | struct ocfs2_locking_protocol *cc_proto; | ||
103 | void (*cc_recovery_handler)(int node_num, void *recovery_data); | 104 | void (*cc_recovery_handler)(int node_num, void *recovery_data); |
104 | void *cc_recovery_data; | 105 | void *cc_recovery_data; |
105 | void *cc_lockspace; | 106 | void *cc_lockspace; |