diff options
author | Joel Becker <joel.becker@oracle.com> | 2010-01-28 22:22:39 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-02-26 18:41:14 -0500 |
commit | a796d2862aed8117acc9f470f3429a5ee852912e (patch) | |
tree | 71b837ae91effcdb4283e8c0bbf5c3162e7e21e1 /fs/ocfs2/stack_o2cb.c | |
parent | 34a9dd7e29e9129fec40c645a03f1bbbe810e771 (diff) |
ocfs2: Pass lksbs back from stackglue ast/bast functions.
The stackglue ast and bast functions tried to maintain the fiction that
their arguments were void pointers. In reality, stack_user.c had to
know that the argument was an ocfs2_lock_res in order to get the status
off of the lksb. That's ugly.
This changes stackglue to always pass the lksb as the argument to ast
and bast functions. The caller can always use container_of() to get the
ocfs2_lock_res or user_dlm_lock_res. The net effect to the caller is
zero. They still get back the lockres in their ast. stackglue gets
cleaner, and now can use the lksb itself.
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 | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c index 3038c92af493..c4cedff365df 100644 --- a/fs/ocfs2/stack_o2cb.c +++ b/fs/ocfs2/stack_o2cb.c | |||
@@ -161,20 +161,26 @@ 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 | union ocfs2_dlm_lksb *lksb = astarg; | ||
165 | |||
164 | BUG_ON(o2cb_stack.sp_proto == NULL); | 166 | BUG_ON(o2cb_stack.sp_proto == NULL); |
165 | 167 | ||
166 | o2cb_stack.sp_proto->lp_lock_ast(astarg); | 168 | o2cb_stack.sp_proto->lp_lock_ast(lksb); |
167 | } | 169 | } |
168 | 170 | ||
169 | static void o2dlm_blocking_ast_wrapper(void *astarg, int level) | 171 | static void o2dlm_blocking_ast_wrapper(void *astarg, int level) |
170 | { | 172 | { |
173 | union ocfs2_dlm_lksb *lksb = astarg; | ||
174 | |||
171 | BUG_ON(o2cb_stack.sp_proto == NULL); | 175 | BUG_ON(o2cb_stack.sp_proto == NULL); |
172 | 176 | ||
173 | o2cb_stack.sp_proto->lp_blocking_ast(astarg, level); | 177 | o2cb_stack.sp_proto->lp_blocking_ast(lksb, level); |
174 | } | 178 | } |
175 | 179 | ||
176 | static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status) | 180 | static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status) |
177 | { | 181 | { |
182 | union ocfs2_dlm_lksb *lksb = astarg; | ||
183 | |||
178 | int error = dlm_status_to_errno(status); | 184 | int error = dlm_status_to_errno(status); |
179 | 185 | ||
180 | BUG_ON(o2cb_stack.sp_proto == NULL); | 186 | BUG_ON(o2cb_stack.sp_proto == NULL); |
@@ -193,7 +199,7 @@ static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status) | |||
193 | if (status == DLM_CANCELGRANT) | 199 | if (status == DLM_CANCELGRANT) |
194 | return; | 200 | return; |
195 | 201 | ||
196 | o2cb_stack.sp_proto->lp_unlock_ast(astarg, error); | 202 | o2cb_stack.sp_proto->lp_unlock_ast(lksb, error); |
197 | } | 203 | } |
198 | 204 | ||
199 | static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, | 205 | static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, |
@@ -201,8 +207,7 @@ static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, | |||
201 | union ocfs2_dlm_lksb *lksb, | 207 | union ocfs2_dlm_lksb *lksb, |
202 | u32 flags, | 208 | u32 flags, |
203 | void *name, | 209 | void *name, |
204 | unsigned int namelen, | 210 | unsigned int namelen) |
205 | void *astarg) | ||
206 | { | 211 | { |
207 | enum dlm_status status; | 212 | enum dlm_status status; |
208 | int o2dlm_mode = mode_to_o2dlm(mode); | 213 | int o2dlm_mode = mode_to_o2dlm(mode); |
@@ -211,7 +216,7 @@ static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, | |||
211 | 216 | ||
212 | status = dlmlock(conn->cc_lockspace, o2dlm_mode, &lksb->lksb_o2dlm, | 217 | status = dlmlock(conn->cc_lockspace, o2dlm_mode, &lksb->lksb_o2dlm, |
213 | o2dlm_flags, name, namelen, | 218 | o2dlm_flags, name, namelen, |
214 | o2dlm_lock_ast_wrapper, astarg, | 219 | o2dlm_lock_ast_wrapper, lksb, |
215 | o2dlm_blocking_ast_wrapper); | 220 | o2dlm_blocking_ast_wrapper); |
216 | ret = dlm_status_to_errno(status); | 221 | ret = dlm_status_to_errno(status); |
217 | return ret; | 222 | return ret; |
@@ -219,15 +224,14 @@ static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, | |||
219 | 224 | ||
220 | static int o2cb_dlm_unlock(struct ocfs2_cluster_connection *conn, | 225 | static int o2cb_dlm_unlock(struct ocfs2_cluster_connection *conn, |
221 | union ocfs2_dlm_lksb *lksb, | 226 | union ocfs2_dlm_lksb *lksb, |
222 | u32 flags, | 227 | u32 flags) |
223 | void *astarg) | ||
224 | { | 228 | { |
225 | enum dlm_status status; | 229 | enum dlm_status status; |
226 | int o2dlm_flags = flags_to_o2dlm(flags); | 230 | int o2dlm_flags = flags_to_o2dlm(flags); |
227 | int ret; | 231 | int ret; |
228 | 232 | ||
229 | status = dlmunlock(conn->cc_lockspace, &lksb->lksb_o2dlm, | 233 | status = dlmunlock(conn->cc_lockspace, &lksb->lksb_o2dlm, |
230 | o2dlm_flags, o2dlm_unlock_ast_wrapper, astarg); | 234 | o2dlm_flags, o2dlm_unlock_ast_wrapper, lksb); |
231 | ret = dlm_status_to_errno(status); | 235 | ret = dlm_status_to_errno(status); |
232 | return ret; | 236 | return ret; |
233 | } | 237 | } |