diff options
Diffstat (limited to 'fs/ocfs2/stack_o2cb.c')
-rw-r--r-- | fs/ocfs2/stack_o2cb.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c index 3038c92af493..7020e1253ffa 100644 --- a/fs/ocfs2/stack_o2cb.c +++ b/fs/ocfs2/stack_o2cb.c | |||
@@ -161,24 +161,23 @@ static int dlm_status_to_errno(enum dlm_status status) | |||
161 | 161 | ||
162 | static void o2dlm_lock_ast_wrapper(void *astarg) | 162 | static void o2dlm_lock_ast_wrapper(void *astarg) |
163 | { | 163 | { |
164 | BUG_ON(o2cb_stack.sp_proto == NULL); | 164 | struct ocfs2_dlm_lksb *lksb = astarg; |
165 | 165 | ||
166 | o2cb_stack.sp_proto->lp_lock_ast(astarg); | 166 | lksb->lksb_conn->cc_proto->lp_lock_ast(lksb); |
167 | } | 167 | } |
168 | 168 | ||
169 | static void o2dlm_blocking_ast_wrapper(void *astarg, int level) | 169 | static void o2dlm_blocking_ast_wrapper(void *astarg, int level) |
170 | { | 170 | { |
171 | BUG_ON(o2cb_stack.sp_proto == NULL); | 171 | struct ocfs2_dlm_lksb *lksb = astarg; |
172 | 172 | ||
173 | o2cb_stack.sp_proto->lp_blocking_ast(astarg, level); | 173 | lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level); |
174 | } | 174 | } |
175 | 175 | ||
176 | 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) |
177 | { | 177 | { |
178 | struct ocfs2_dlm_lksb *lksb = astarg; | ||
178 | int error = dlm_status_to_errno(status); | 179 | int error = dlm_status_to_errno(status); |
179 | 180 | ||
180 | BUG_ON(o2cb_stack.sp_proto == NULL); | ||
181 | |||
182 | /* | 181 | /* |
183 | * 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 |
184 | * granted and the unlock_ast() for the CANCEL failing. A | 183 | * granted and the unlock_ast() for the CANCEL failing. A |
@@ -193,16 +192,15 @@ static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status) | |||
193 | if (status == DLM_CANCELGRANT) | 192 | if (status == DLM_CANCELGRANT) |
194 | return; | 193 | return; |
195 | 194 | ||
196 | o2cb_stack.sp_proto->lp_unlock_ast(astarg, error); | 195 | lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, error); |
197 | } | 196 | } |
198 | 197 | ||
199 | static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, | 198 | static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, |
200 | int mode, | 199 | int mode, |
201 | union ocfs2_dlm_lksb *lksb, | 200 | struct ocfs2_dlm_lksb *lksb, |
202 | u32 flags, | 201 | u32 flags, |
203 | void *name, | 202 | void *name, |
204 | unsigned int namelen, | 203 | unsigned int namelen) |
205 | void *astarg) | ||
206 | { | 204 | { |
207 | enum dlm_status status; | 205 | enum dlm_status status; |
208 | int o2dlm_mode = mode_to_o2dlm(mode); | 206 | int o2dlm_mode = mode_to_o2dlm(mode); |
@@ -211,28 +209,27 @@ static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, | |||
211 | 209 | ||
212 | status = dlmlock(conn->cc_lockspace, o2dlm_mode, &lksb->lksb_o2dlm, | 210 | status = dlmlock(conn->cc_lockspace, o2dlm_mode, &lksb->lksb_o2dlm, |
213 | o2dlm_flags, name, namelen, | 211 | o2dlm_flags, name, namelen, |
214 | o2dlm_lock_ast_wrapper, astarg, | 212 | o2dlm_lock_ast_wrapper, lksb, |
215 | o2dlm_blocking_ast_wrapper); | 213 | o2dlm_blocking_ast_wrapper); |
216 | ret = dlm_status_to_errno(status); | 214 | ret = dlm_status_to_errno(status); |
217 | return ret; | 215 | return ret; |
218 | } | 216 | } |
219 | 217 | ||
220 | static int o2cb_dlm_unlock(struct ocfs2_cluster_connection *conn, | 218 | static int o2cb_dlm_unlock(struct ocfs2_cluster_connection *conn, |
221 | union ocfs2_dlm_lksb *lksb, | 219 | struct ocfs2_dlm_lksb *lksb, |
222 | u32 flags, | 220 | u32 flags) |
223 | void *astarg) | ||
224 | { | 221 | { |
225 | enum dlm_status status; | 222 | enum dlm_status status; |
226 | int o2dlm_flags = flags_to_o2dlm(flags); | 223 | int o2dlm_flags = flags_to_o2dlm(flags); |
227 | int ret; | 224 | int ret; |
228 | 225 | ||
229 | status = dlmunlock(conn->cc_lockspace, &lksb->lksb_o2dlm, | 226 | status = dlmunlock(conn->cc_lockspace, &lksb->lksb_o2dlm, |
230 | o2dlm_flags, o2dlm_unlock_ast_wrapper, astarg); | 227 | o2dlm_flags, o2dlm_unlock_ast_wrapper, lksb); |
231 | ret = dlm_status_to_errno(status); | 228 | ret = dlm_status_to_errno(status); |
232 | return ret; | 229 | return ret; |
233 | } | 230 | } |
234 | 231 | ||
235 | static int o2cb_dlm_lock_status(union ocfs2_dlm_lksb *lksb) | 232 | static int o2cb_dlm_lock_status(struct ocfs2_dlm_lksb *lksb) |
236 | { | 233 | { |
237 | return dlm_status_to_errno(lksb->lksb_o2dlm.status); | 234 | return dlm_status_to_errno(lksb->lksb_o2dlm.status); |
238 | } | 235 | } |
@@ -242,17 +239,17 @@ static int o2cb_dlm_lock_status(union ocfs2_dlm_lksb *lksb) | |||
242 | * contents, it will zero out the LVB. Thus the caller can always trust | 239 | * contents, it will zero out the LVB. Thus the caller can always trust |
243 | * the contents. | 240 | * the contents. |
244 | */ | 241 | */ |
245 | static int o2cb_dlm_lvb_valid(union ocfs2_dlm_lksb *lksb) | 242 | static int o2cb_dlm_lvb_valid(struct ocfs2_dlm_lksb *lksb) |
246 | { | 243 | { |
247 | return 1; | 244 | return 1; |
248 | } | 245 | } |
249 | 246 | ||
250 | static void *o2cb_dlm_lvb(union ocfs2_dlm_lksb *lksb) | 247 | static void *o2cb_dlm_lvb(struct ocfs2_dlm_lksb *lksb) |
251 | { | 248 | { |
252 | return (void *)(lksb->lksb_o2dlm.lvb); | 249 | return (void *)(lksb->lksb_o2dlm.lvb); |
253 | } | 250 | } |
254 | 251 | ||
255 | static void o2cb_dump_lksb(union ocfs2_dlm_lksb *lksb) | 252 | static void o2cb_dump_lksb(struct ocfs2_dlm_lksb *lksb) |
256 | { | 253 | { |
257 | dlm_print_one_lock(lksb->lksb_o2dlm.lockid); | 254 | dlm_print_one_lock(lksb->lksb_o2dlm.lockid); |
258 | } | 255 | } |
@@ -280,7 +277,7 @@ static int o2cb_cluster_connect(struct ocfs2_cluster_connection *conn) | |||
280 | struct dlm_protocol_version fs_version; | 277 | struct dlm_protocol_version fs_version; |
281 | 278 | ||
282 | BUG_ON(conn == NULL); | 279 | BUG_ON(conn == NULL); |
283 | BUG_ON(o2cb_stack.sp_proto == NULL); | 280 | BUG_ON(conn->cc_proto == NULL); |
284 | 281 | ||
285 | /* 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 |
286 | * in the heartbeat universe */ | 283 | * in the heartbeat universe */ |