diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-02-01 15:03:57 -0800 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-04-18 08:56:05 -0700 |
commit | 286eaa95c5c5915a6b72cc3f0a2534161fd7928b (patch) | |
tree | dce03b619389cc5b5e2508b30ca3e1411401cf4e /fs/ocfs2/stack_o2cb.c | |
parent | e3dad42bf993a0f24eb6e46152356c9b119c15e8 (diff) | |
download | linux-next-286eaa95c5c5915a6b72cc3f0a2534161fd7928b.tar.gz |
ocfs2: Break out stackglue into modules.
We define the ocfs2_stack_plugin structure to represent a stack driver.
The o2cb stack code is split into stack_o2cb.c. This becomes the
ocfs2_stack_o2cb.ko module.
The stackglue generic functions are similarly split into the
ocfs2_stackglue.ko module. This module now provides an interface to
register drivers. The ocfs2_stack_o2cb driver registers itself. As
part of this interface, ocfs2_stackglue can load drivers on demand.
This is accomplished in ocfs2_cluster_connect().
ocfs2_cluster_disconnect() is now notified when a _hangup() is pending.
If a hangup is pending, it will not release the driver module and will
let _hangup() do that.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/stack_o2cb.c')
-rw-r--r-- | fs/ocfs2/stack_o2cb.c | 41 |
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 @@ */ #include <linux/crc32.h> -#include <linux/kmod.h> +#include <linux/module.h> /* Needed for AOP_TRUNCATED_PAGE in mlog_errno() */ #include <linux/fs.h> @@ -33,6 +33,8 @@ struct o2dlm_private { struct dlm_eviction_cb op_eviction_cb; }; +static struct ocfs2_stack_plugin o2cb_stack; + /* These should be identical */ #if (DLM_LOCK_IV != LKM_IVMODE) # error Lock modes do not match @@ -158,23 +160,23 @@ static int dlm_status_to_errno(enum dlm_status status) static void o2dlm_lock_ast_wrapper(void *astarg) { - BUG_ON(stack_glue_lproto == NULL); + BUG_ON(o2cb_stack.sp_proto == NULL); - stack_glue_lproto->lp_lock_ast(astarg); + o2cb_stack.sp_proto->lp_lock_ast(astarg); } static void o2dlm_blocking_ast_wrapper(void *astarg, int level) { - BUG_ON(stack_glue_lproto == NULL); + BUG_ON(o2cb_stack.sp_proto == NULL); - stack_glue_lproto->lp_blocking_ast(astarg, level); + o2cb_stack.sp_proto->lp_blocking_ast(astarg, level); } static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status) { int error = dlm_status_to_errno(status); - BUG_ON(stack_glue_lproto == NULL); + BUG_ON(o2cb_stack.sp_proto == NULL); /* * 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) if (status == DLM_CANCELGRANT) return; - stack_glue_lproto->lp_unlock_ast(astarg, error); + o2cb_stack.sp_proto->lp_unlock_ast(astarg, error); } static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, @@ -267,6 +269,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); /* for now we only have one cluster/node, make sure we see it * in the heartbeat universe */ @@ -314,7 +317,8 @@ out: return rc; } -static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn) +static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn, + int hangup_pending) { struct dlm_ctxt *dlm = conn->cc_lockspace; struct o2dlm_private *priv = conn->cc_private; @@ -393,3 +397,24 @@ struct ocfs2_stack_operations o2cb_stack_ops = { .dump_lksb = o2cb_dump_lksb, }; +static struct ocfs2_stack_plugin o2cb_stack = { + .sp_name = "o2cb", + .sp_ops = &o2cb_stack_ops, + .sp_owner = THIS_MODULE, +}; + +static int __init o2cb_stack_init(void) +{ + return ocfs2_stack_glue_register(&o2cb_stack); +} + +static void __exit o2cb_stack_exit(void) +{ + ocfs2_stack_glue_unregister(&o2cb_stack); +} + +MODULE_AUTHOR("Oracle"); +MODULE_DESCRIPTION("ocfs2 driver for the classic o2cb stack"); +MODULE_LICENSE("GPL"); +module_init(o2cb_stack_init); +module_exit(o2cb_stack_exit); |