diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-02-01 17:39:35 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-04-18 11:56:04 -0400 |
commit | 4670c46ded9a18268d1265417ff4ac72145a7917 (patch) | |
tree | 4f70822ddee389a9c8ed572b215a3355c20db3a1 /fs/ocfs2/stackglue.h | |
parent | 8f2c9c1b16bf6ed0903b29c49d56fa0109a390e4 (diff) |
ocfs2: Introduce the new ocfs2_cluster_connect/disconnect() API.
This step introduces a cluster stack agnostic API for initializing and
exiting. fs/ocfs2/dlmglue.c no longer uses o2cb/o2dlm knowledge to
connect to the stack. It is all handled in stackglue.c.
heartbeat.c no longer needs to know how it gets called.
ocfs2_do_node_down() is now a clean recovery trigger.
The big gotcha is the ordering of initializations and de-initializations done
underneath ocfs2_cluster_connect(). ocfs2_dlm_init() used to do all
o2dlm initialization in one block. Thus, the o2dlm functionality of
ocfs2_cluster_connect() is very straightforward. ocfs2_dlm_shutdown(),
however, did a few things between de-registration of the eviction
callback and actually shutting down the domain. Now de-registration and
shutdown of the domain are wrapped within the single
ocfs2_cluster_disconnect() call. I've checked the code paths to make
sure we can safely tear down things in ocfs2_dlm_shutdown() before
calling ocfs2_cluster_disconnect(). The filesystem has already set
itself to ignore the callback.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/stackglue.h')
-rw-r--r-- | fs/ocfs2/stackglue.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h index 3c91e241892b..3900b5c3933c 100644 --- a/fs/ocfs2/stackglue.h +++ b/fs/ocfs2/stackglue.h | |||
@@ -32,9 +32,22 @@ | |||
32 | */ | 32 | */ |
33 | #define DLM_LKF_LOCAL 0x00100000 | 33 | #define DLM_LKF_LOCAL 0x00100000 |
34 | 34 | ||
35 | /* | ||
36 | * This shadows DLM_LOCKSPACE_LEN in fs/dlm/dlm_internal.h. That probably | ||
37 | * wants to be in a public header. | ||
38 | */ | ||
39 | #define GROUP_NAME_MAX 64 | ||
40 | |||
41 | |||
35 | #include "dlm/dlmapi.h" | 42 | #include "dlm/dlmapi.h" |
36 | 43 | ||
44 | struct ocfs2_protocol_version { | ||
45 | u8 pv_major; | ||
46 | u8 pv_minor; | ||
47 | }; | ||
48 | |||
37 | struct ocfs2_locking_protocol { | 49 | struct ocfs2_locking_protocol { |
50 | struct ocfs2_protocol_version lp_max_version; | ||
38 | void (*lp_lock_ast)(void *astarg); | 51 | void (*lp_lock_ast)(void *astarg); |
39 | void (*lp_blocking_ast)(void *astarg, int level); | 52 | void (*lp_blocking_ast)(void *astarg, int level); |
40 | void (*lp_unlock_ast)(void *astarg, int error); | 53 | void (*lp_unlock_ast)(void *astarg, int error); |
@@ -44,14 +57,32 @@ union ocfs2_dlm_lksb { | |||
44 | struct dlm_lockstatus lksb_o2dlm; | 57 | struct dlm_lockstatus lksb_o2dlm; |
45 | }; | 58 | }; |
46 | 59 | ||
47 | int ocfs2_dlm_lock(struct dlm_ctxt *dlm, | 60 | struct ocfs2_cluster_connection { |
61 | char cc_name[GROUP_NAME_MAX]; | ||
62 | int cc_namelen; | ||
63 | struct ocfs2_protocol_version cc_version; | ||
64 | void (*cc_recovery_handler)(int node_num, void *recovery_data); | ||
65 | void *cc_recovery_data; | ||
66 | void *cc_lockspace; | ||
67 | void *cc_private; | ||
68 | }; | ||
69 | |||
70 | int ocfs2_cluster_connect(const char *group, | ||
71 | int grouplen, | ||
72 | void (*recovery_handler)(int node_num, | ||
73 | void *recovery_data), | ||
74 | void *recovery_data, | ||
75 | struct ocfs2_cluster_connection **conn); | ||
76 | int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn); | ||
77 | |||
78 | int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn, | ||
48 | int mode, | 79 | int mode, |
49 | union ocfs2_dlm_lksb *lksb, | 80 | union ocfs2_dlm_lksb *lksb, |
50 | u32 flags, | 81 | u32 flags, |
51 | void *name, | 82 | void *name, |
52 | unsigned int namelen, | 83 | unsigned int namelen, |
53 | void *astarg); | 84 | void *astarg); |
54 | int ocfs2_dlm_unlock(struct dlm_ctxt *dlm, | 85 | int ocfs2_dlm_unlock(struct ocfs2_cluster_connection *conn, |
55 | union ocfs2_dlm_lksb *lksb, | 86 | union ocfs2_dlm_lksb *lksb, |
56 | u32 flags, | 87 | u32 flags, |
57 | void *astarg); | 88 | void *astarg); |