aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/stackglue.h
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2010-01-28 22:22:39 -0500
committerJoel Becker <joel.becker@oracle.com>2010-02-26 18:41:14 -0500
commita796d2862aed8117acc9f470f3429a5ee852912e (patch)
tree71b837ae91effcdb4283e8c0bbf5c3162e7e21e1 /fs/ocfs2/stackglue.h
parent34a9dd7e29e9129fec40c645a03f1bbbe810e771 (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/stackglue.h')
-rw-r--r--fs/ocfs2/stackglue.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h
index 03a44d60eac9..d699117fb851 100644
--- a/fs/ocfs2/stackglue.h
+++ b/fs/ocfs2/stackglue.h
@@ -56,17 +56,6 @@ struct ocfs2_protocol_version {
56}; 56};
57 57
58/* 58/*
59 * The ocfs2_locking_protocol defines the handlers called on ocfs2's behalf.
60 */
61struct ocfs2_locking_protocol {
62 struct ocfs2_protocol_version lp_max_version;
63 void (*lp_lock_ast)(void *astarg);
64 void (*lp_blocking_ast)(void *astarg, int level);
65 void (*lp_unlock_ast)(void *astarg, int error);
66};
67
68
69/*
70 * The dlm_lockstatus struct includes lvb space, but the dlm_lksb struct only 59 * The dlm_lockstatus struct includes lvb space, but the dlm_lksb struct only
71 * has a pointer to separately allocated lvb space. This struct exists only to 60 * has a pointer to separately allocated lvb space. This struct exists only to
72 * include in the lksb union to make space for a combined dlm_lksb and lvb. 61 * include in the lksb union to make space for a combined dlm_lksb and lvb.
@@ -88,6 +77,17 @@ union ocfs2_dlm_lksb {
88}; 77};
89 78
90/* 79/*
80 * The ocfs2_locking_protocol defines the handlers called on ocfs2's behalf.
81 */
82struct ocfs2_locking_protocol {
83 struct ocfs2_protocol_version lp_max_version;
84 void (*lp_lock_ast)(union ocfs2_dlm_lksb *lksb);
85 void (*lp_blocking_ast)(union ocfs2_dlm_lksb *lksb, int level);
86 void (*lp_unlock_ast)(union ocfs2_dlm_lksb *lksb, int error);
87};
88
89
90/*
91 * A cluster connection. Mostly opaque to ocfs2, the connection holds 91 * A cluster connection. Mostly opaque to ocfs2, the connection holds
92 * state for the underlying stack. ocfs2 does use cc_version to determine 92 * state for the underlying stack. ocfs2 does use cc_version to determine
93 * locking compatibility. 93 * locking compatibility.
@@ -155,27 +155,29 @@ struct ocfs2_stack_operations {
155 * 155 *
156 * ast and bast functions are not part of the call because the 156 * ast and bast functions are not part of the call because the
157 * stack will likely want to wrap ast and bast calls before passing 157 * stack will likely want to wrap ast and bast calls before passing
158 * them to stack->sp_proto. 158 * them to stack->sp_proto. There is no astarg. The lksb will
159 * be passed back to the ast and bast functions. The caller can
160 * use this to find their object.
159 */ 161 */
160 int (*dlm_lock)(struct ocfs2_cluster_connection *conn, 162 int (*dlm_lock)(struct ocfs2_cluster_connection *conn,
161 int mode, 163 int mode,
162 union ocfs2_dlm_lksb *lksb, 164 union ocfs2_dlm_lksb *lksb,
163 u32 flags, 165 u32 flags,
164 void *name, 166 void *name,
165 unsigned int namelen, 167 unsigned int namelen);
166 void *astarg);
167 168
168 /* 169 /*
169 * Call the underlying dlm unlock function. The ->dlm_unlock() 170 * Call the underlying dlm unlock function. The ->dlm_unlock()
170 * function should convert the flags as appropriate. 171 * function should convert the flags as appropriate.
171 * 172 *
172 * The unlock ast is not passed, as the stack will want to wrap 173 * The unlock ast is not passed, as the stack will want to wrap
173 * it before calling stack->sp_proto->lp_unlock_ast(). 174 * it before calling stack->sp_proto->lp_unlock_ast(). There is
175 * no astarg. The lksb will be passed back to the unlock ast
176 * function. The caller can use this to find their object.
174 */ 177 */
175 int (*dlm_unlock)(struct ocfs2_cluster_connection *conn, 178 int (*dlm_unlock)(struct ocfs2_cluster_connection *conn,
176 union ocfs2_dlm_lksb *lksb, 179 union ocfs2_dlm_lksb *lksb,
177 u32 flags, 180 u32 flags);
178 void *astarg);
179 181
180 /* 182 /*
181 * Return the status of the current lock status block. The fs 183 * Return the status of the current lock status block. The fs
@@ -249,12 +251,10 @@ int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn,
249 union ocfs2_dlm_lksb *lksb, 251 union ocfs2_dlm_lksb *lksb,
250 u32 flags, 252 u32 flags,
251 void *name, 253 void *name,
252 unsigned int namelen, 254 unsigned int namelen);
253 struct ocfs2_lock_res *astarg);
254int ocfs2_dlm_unlock(struct ocfs2_cluster_connection *conn, 255int ocfs2_dlm_unlock(struct ocfs2_cluster_connection *conn,
255 union ocfs2_dlm_lksb *lksb, 256 union ocfs2_dlm_lksb *lksb,
256 u32 flags, 257 u32 flags);
257 struct ocfs2_lock_res *astarg);
258 258
259int ocfs2_dlm_lock_status(union ocfs2_dlm_lksb *lksb); 259int ocfs2_dlm_lock_status(union ocfs2_dlm_lksb *lksb);
260int ocfs2_dlm_lvb_valid(union ocfs2_dlm_lksb *lksb); 260int ocfs2_dlm_lvb_valid(union ocfs2_dlm_lksb *lksb);