aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/stackglue.h
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-02-01 18:03:57 -0500
committerMark Fasheh <mfasheh@suse.com>2008-04-18 11:56:05 -0400
commit286eaa95c5c5915a6b72cc3f0a2534161fd7928b (patch)
treedce03b619389cc5b5e2508b30ca3e1411401cf4e /fs/ocfs2/stackglue.h
parente3dad42bf993a0f24eb6e46152356c9b119c15e8 (diff)
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/stackglue.h')
-rw-r--r--fs/ocfs2/stackglue.h36
1 files changed, 32 insertions, 4 deletions
diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h
index 083632215dc5..c96c8bb76863 100644
--- a/fs/ocfs2/stackglue.h
+++ b/fs/ocfs2/stackglue.h
@@ -119,14 +119,21 @@ struct ocfs2_stack_operations {
119 * Once ->disconnect() has returned, the connection structure will 119 * Once ->disconnect() has returned, the connection structure will
120 * be freed. Thus, a stack must not return from ->disconnect() 120 * be freed. Thus, a stack must not return from ->disconnect()
121 * until it will no longer reference the conn pointer. 121 * until it will no longer reference the conn pointer.
122 *
123 * If hangup_pending is zero, ocfs2_cluster_disconnect() will also
124 * be dropping the reference on the module.
122 */ 125 */
123 int (*disconnect)(struct ocfs2_cluster_connection *conn); 126 int (*disconnect)(struct ocfs2_cluster_connection *conn,
127 int hangup_pending);
124 128
125 /* 129 /*
126 * ocfs2_cluster_hangup() exists for compatibility with older 130 * ocfs2_cluster_hangup() exists for compatibility with older
127 * ocfs2 tools. Only the classic stack really needs it. As such 131 * ocfs2 tools. Only the classic stack really needs it. As such
128 * ->hangup() is not required of all stacks. See the comment by 132 * ->hangup() is not required of all stacks. See the comment by
129 * ocfs2_cluster_hangup() for more details. 133 * ocfs2_cluster_hangup() for more details.
134 *
135 * Note that ocfs2_cluster_hangup() can only be called if
136 * hangup_pending was passed to ocfs2_cluster_disconnect().
130 */ 137 */
131 void (*hangup)(const char *group, int grouplen); 138 void (*hangup)(const char *group, int grouplen);
132 139
@@ -184,13 +191,32 @@ struct ocfs2_stack_operations {
184 void (*dump_lksb)(union ocfs2_dlm_lksb *lksb); 191 void (*dump_lksb)(union ocfs2_dlm_lksb *lksb);
185}; 192};
186 193
194/*
195 * Each stack plugin must describe itself by registering a
196 * ocfs2_stack_plugin structure. This is only seen by stackglue and the
197 * stack driver.
198 */
199struct ocfs2_stack_plugin {
200 char *sp_name;
201 struct ocfs2_stack_operations *sp_ops;
202 struct module *sp_owner;
203
204 /* These are managed by the stackglue code. */
205 struct list_head sp_list;
206 unsigned int sp_count;
207 struct ocfs2_locking_protocol *sp_proto;
208};
209
210
211/* Used by the filesystem */
187int ocfs2_cluster_connect(const char *group, 212int ocfs2_cluster_connect(const char *group,
188 int grouplen, 213 int grouplen,
189 void (*recovery_handler)(int node_num, 214 void (*recovery_handler)(int node_num,
190 void *recovery_data), 215 void *recovery_data),
191 void *recovery_data, 216 void *recovery_data,
192 struct ocfs2_cluster_connection **conn); 217 struct ocfs2_cluster_connection **conn);
193int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn); 218int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
219 int hangup_pending);
194void ocfs2_cluster_hangup(const char *group, int grouplen); 220void ocfs2_cluster_hangup(const char *group, int grouplen);
195int ocfs2_cluster_this_node(unsigned int *node); 221int ocfs2_cluster_this_node(unsigned int *node);
196 222
@@ -212,6 +238,8 @@ void ocfs2_dlm_dump_lksb(union ocfs2_dlm_lksb *lksb);
212 238
213void ocfs2_stack_glue_set_locking_protocol(struct ocfs2_locking_protocol *proto); 239void ocfs2_stack_glue_set_locking_protocol(struct ocfs2_locking_protocol *proto);
214 240
215extern struct ocfs2_locking_protocol *stack_glue_lproto; 241
216extern struct ocfs2_stack_operations o2cb_stack_ops; 242/* Used by stack plugins */
243int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin);
244void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin);
217#endif /* STACKGLUE_H */ 245#endif /* STACKGLUE_H */