aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/stack_o2cb.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/stack_o2cb.c')
-rw-r--r--fs/ocfs2/stack_o2cb.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
index c9bc3541a33f..ac1d74c63bf5 100644
--- a/fs/ocfs2/stack_o2cb.c
+++ b/fs/ocfs2/stack_o2cb.c
@@ -18,7 +18,7 @@
18 */ 18 */
19 19
20#include <linux/crc32.h> 20#include <linux/crc32.h>
21#include <linux/kmod.h> 21#include <linux/module.h>
22 22
23/* Needed for AOP_TRUNCATED_PAGE in mlog_errno() */ 23/* Needed for AOP_TRUNCATED_PAGE in mlog_errno() */
24#include <linux/fs.h> 24#include <linux/fs.h>
@@ -33,6 +33,8 @@ struct o2dlm_private {
33 struct dlm_eviction_cb op_eviction_cb; 33 struct dlm_eviction_cb op_eviction_cb;
34}; 34};
35 35
36static struct ocfs2_stack_plugin o2cb_stack;
37
36/* These should be identical */ 38/* These should be identical */
37#if (DLM_LOCK_IV != LKM_IVMODE) 39#if (DLM_LOCK_IV != LKM_IVMODE)
38# error Lock modes do not match 40# error Lock modes do not match
@@ -158,23 +160,23 @@ static int dlm_status_to_errno(enum dlm_status status)
158 160
159static void o2dlm_lock_ast_wrapper(void *astarg) 161static void o2dlm_lock_ast_wrapper(void *astarg)
160{ 162{
161 BUG_ON(stack_glue_lproto == NULL); 163 BUG_ON(o2cb_stack.sp_proto == NULL);
162 164
163 stack_glue_lproto->lp_lock_ast(astarg); 165 o2cb_stack.sp_proto->lp_lock_ast(astarg);
164} 166}
165 167
166static void o2dlm_blocking_ast_wrapper(void *astarg, int level) 168static void o2dlm_blocking_ast_wrapper(void *astarg, int level)
167{ 169{
168 BUG_ON(stack_glue_lproto == NULL); 170 BUG_ON(o2cb_stack.sp_proto == NULL);
169 171
170 stack_glue_lproto->lp_blocking_ast(astarg, level); 172 o2cb_stack.sp_proto->lp_blocking_ast(astarg, level);
171} 173}
172 174
173static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status) 175static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status)
174{ 176{
175 int error = dlm_status_to_errno(status); 177 int error = dlm_status_to_errno(status);
176 178
177 BUG_ON(stack_glue_lproto == NULL); 179 BUG_ON(o2cb_stack.sp_proto == NULL);
178 180
179 /* 181 /*
180 * 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,7 +192,7 @@ static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status)
190 if (status == DLM_CANCELGRANT) 192 if (status == DLM_CANCELGRANT)
191 return; 193 return;
192 194
193 stack_glue_lproto->lp_unlock_ast(astarg, error); 195 o2cb_stack.sp_proto->lp_unlock_ast(astarg, error);
194} 196}
195 197
196static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, 198static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn,
@@ -267,6 +269,7 @@ static int o2cb_cluster_connect(struct ocfs2_cluster_connection *conn)
267 struct dlm_protocol_version dlm_version; 269 struct dlm_protocol_version dlm_version;
268 270
269 BUG_ON(conn == NULL); 271 BUG_ON(conn == NULL);
272 BUG_ON(o2cb_stack.sp_proto == NULL);
270 273
271 /* for now we only have one cluster/node, make sure we see it 274 /* for now we only have one cluster/node, make sure we see it
272 * in the heartbeat universe */ 275 * in the heartbeat universe */
@@ -314,7 +317,8 @@ out:
314 return rc; 317 return rc;
315} 318}
316 319
317static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn) 320static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn,
321 int hangup_pending)
318{ 322{
319 struct dlm_ctxt *dlm = conn->cc_lockspace; 323 struct dlm_ctxt *dlm = conn->cc_lockspace;
320 struct o2dlm_private *priv = conn->cc_private; 324 struct o2dlm_private *priv = conn->cc_private;
@@ -393,3 +397,24 @@ struct ocfs2_stack_operations o2cb_stack_ops = {
393 .dump_lksb = o2cb_dump_lksb, 397 .dump_lksb = o2cb_dump_lksb,
394}; 398};
395 399
400static struct ocfs2_stack_plugin o2cb_stack = {
401 .sp_name = "o2cb",
402 .sp_ops = &o2cb_stack_ops,
403 .sp_owner = THIS_MODULE,
404};
405
406static int __init o2cb_stack_init(void)
407{
408 return ocfs2_stack_glue_register(&o2cb_stack);
409}
410
411static void __exit o2cb_stack_exit(void)
412{
413 ocfs2_stack_glue_unregister(&o2cb_stack);
414}
415
416MODULE_AUTHOR("Oracle");
417MODULE_DESCRIPTION("ocfs2 driver for the classic o2cb stack");
418MODULE_LICENSE("GPL");
419module_init(o2cb_stack_init);
420module_exit(o2cb_stack_exit);