aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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
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')
-rw-r--r--fs/ocfs2/dlmglue.c34
-rw-r--r--fs/ocfs2/stack_o2cb.c22
-rw-r--r--fs/ocfs2/stack_user.c29
-rw-r--r--fs/ocfs2/stackglue.c19
-rw-r--r--fs/ocfs2/stackglue.h42
5 files changed, 70 insertions, 76 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index e044019cb3b1..1ba67df00924 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -297,6 +297,11 @@ static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres)
297 lockres->l_type == OCFS2_LOCK_TYPE_OPEN; 297 lockres->l_type == OCFS2_LOCK_TYPE_OPEN;
298} 298}
299 299
300static inline struct ocfs2_lock_res *ocfs2_lksb_to_lock_res(union ocfs2_dlm_lksb *lksb)
301{
302 return container_of(lksb, struct ocfs2_lock_res, l_lksb);
303}
304
300static inline struct inode *ocfs2_lock_res_inode(struct ocfs2_lock_res *lockres) 305static inline struct inode *ocfs2_lock_res_inode(struct ocfs2_lock_res *lockres)
301{ 306{
302 BUG_ON(!ocfs2_is_inode_lock(lockres)); 307 BUG_ON(!ocfs2_is_inode_lock(lockres));
@@ -1041,9 +1046,9 @@ static unsigned int lockres_set_pending(struct ocfs2_lock_res *lockres)
1041} 1046}
1042 1047
1043 1048
1044static void ocfs2_blocking_ast(void *opaque, int level) 1049static void ocfs2_blocking_ast(union ocfs2_dlm_lksb *lksb, int level)
1045{ 1050{
1046 struct ocfs2_lock_res *lockres = opaque; 1051 struct ocfs2_lock_res *lockres = ocfs2_lksb_to_lock_res(lksb);
1047 struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); 1052 struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres);
1048 int needs_downconvert; 1053 int needs_downconvert;
1049 unsigned long flags; 1054 unsigned long flags;
@@ -1072,9 +1077,9 @@ static void ocfs2_blocking_ast(void *opaque, int level)
1072 ocfs2_wake_downconvert_thread(osb); 1077 ocfs2_wake_downconvert_thread(osb);
1073} 1078}
1074 1079
1075static void ocfs2_locking_ast(void *opaque) 1080static void ocfs2_locking_ast(union ocfs2_dlm_lksb *lksb)
1076{ 1081{
1077 struct ocfs2_lock_res *lockres = opaque; 1082 struct ocfs2_lock_res *lockres = ocfs2_lksb_to_lock_res(lksb);
1078 struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); 1083 struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres);
1079 unsigned long flags; 1084 unsigned long flags;
1080 int status; 1085 int status;
@@ -1189,8 +1194,7 @@ static int ocfs2_lock_create(struct ocfs2_super *osb,
1189 &lockres->l_lksb, 1194 &lockres->l_lksb,
1190 dlm_flags, 1195 dlm_flags,
1191 lockres->l_name, 1196 lockres->l_name,
1192 OCFS2_LOCK_ID_MAX_LEN - 1, 1197 OCFS2_LOCK_ID_MAX_LEN - 1);
1193 lockres);
1194 lockres_clear_pending(lockres, gen, osb); 1198 lockres_clear_pending(lockres, gen, osb);
1195 if (ret) { 1199 if (ret) {
1196 ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres); 1200 ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres);
@@ -1421,8 +1425,7 @@ again:
1421 &lockres->l_lksb, 1425 &lockres->l_lksb,
1422 lkm_flags, 1426 lkm_flags,
1423 lockres->l_name, 1427 lockres->l_name,
1424 OCFS2_LOCK_ID_MAX_LEN - 1, 1428 OCFS2_LOCK_ID_MAX_LEN - 1);
1425 lockres);
1426 lockres_clear_pending(lockres, gen, osb); 1429 lockres_clear_pending(lockres, gen, osb);
1427 if (ret) { 1430 if (ret) {
1428 if (!(lkm_flags & DLM_LKF_NOQUEUE) || 1431 if (!(lkm_flags & DLM_LKF_NOQUEUE) ||
@@ -1859,8 +1862,7 @@ int ocfs2_file_lock(struct file *file, int ex, int trylock)
1859 spin_unlock_irqrestore(&lockres->l_lock, flags); 1862 spin_unlock_irqrestore(&lockres->l_lock, flags);
1860 1863
1861 ret = ocfs2_dlm_lock(osb->cconn, level, &lockres->l_lksb, lkm_flags, 1864 ret = ocfs2_dlm_lock(osb->cconn, level, &lockres->l_lksb, lkm_flags,
1862 lockres->l_name, OCFS2_LOCK_ID_MAX_LEN - 1, 1865 lockres->l_name, OCFS2_LOCK_ID_MAX_LEN - 1);
1863 lockres);
1864 if (ret) { 1866 if (ret) {
1865 if (!trylock || (ret != -EAGAIN)) { 1867 if (!trylock || (ret != -EAGAIN)) {
1866 ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres); 1868 ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres);
@@ -3056,9 +3058,9 @@ void ocfs2_dlm_shutdown(struct ocfs2_super *osb,
3056 mlog_exit_void(); 3058 mlog_exit_void();
3057} 3059}
3058 3060
3059static void ocfs2_unlock_ast(void *opaque, int error) 3061static void ocfs2_unlock_ast(union ocfs2_dlm_lksb *lksb, int error)
3060{ 3062{
3061 struct ocfs2_lock_res *lockres = opaque; 3063 struct ocfs2_lock_res *lockres = ocfs2_lksb_to_lock_res(lksb);
3062 unsigned long flags; 3064 unsigned long flags;
3063 3065
3064 mlog_entry_void(); 3066 mlog_entry_void();
@@ -3167,8 +3169,7 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb,
3167 3169
3168 mlog(0, "lock %s\n", lockres->l_name); 3170 mlog(0, "lock %s\n", lockres->l_name);
3169 3171
3170 ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, lkm_flags, 3172 ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, lkm_flags);
3171 lockres);
3172 if (ret) { 3173 if (ret) {
3173 ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres); 3174 ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres);
3174 mlog(ML_ERROR, "lockres flags: %lu\n", lockres->l_flags); 3175 mlog(ML_ERROR, "lockres flags: %lu\n", lockres->l_flags);
@@ -3309,8 +3310,7 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb,
3309 &lockres->l_lksb, 3310 &lockres->l_lksb,
3310 dlm_flags, 3311 dlm_flags,
3311 lockres->l_name, 3312 lockres->l_name,
3312 OCFS2_LOCK_ID_MAX_LEN - 1, 3313 OCFS2_LOCK_ID_MAX_LEN - 1);
3313 lockres);
3314 lockres_clear_pending(lockres, generation, osb); 3314 lockres_clear_pending(lockres, generation, osb);
3315 if (ret) { 3315 if (ret) {
3316 ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres); 3316 ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres);
@@ -3365,7 +3365,7 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb,
3365 mlog(0, "lock %s\n", lockres->l_name); 3365 mlog(0, "lock %s\n", lockres->l_name);
3366 3366
3367 ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, 3367 ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb,
3368 DLM_LKF_CANCEL, lockres); 3368 DLM_LKF_CANCEL);
3369 if (ret) { 3369 if (ret) {
3370 ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres); 3370 ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres);
3371 ocfs2_recover_from_dlm_error(lockres, 0); 3371 ocfs2_recover_from_dlm_error(lockres, 0);
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
162static void o2dlm_lock_ast_wrapper(void *astarg) 162static 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
169static void o2dlm_blocking_ast_wrapper(void *astarg, int level) 171static 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
176static void o2dlm_unlock_ast_wrapper(void *astarg, enum dlm_status status) 180static 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
199static int o2cb_dlm_lock(struct ocfs2_cluster_connection *conn, 205static 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
220static int o2cb_dlm_unlock(struct ocfs2_cluster_connection *conn, 225static 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}
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index da78a2a334fd..129b93159cca 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -25,7 +25,6 @@
25#include <linux/reboot.h> 25#include <linux/reboot.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27 27
28#include "ocfs2.h" /* For struct ocfs2_lock_res */
29#include "stackglue.h" 28#include "stackglue.h"
30 29
31#include <linux/dlm_plock.h> 30#include <linux/dlm_plock.h>
@@ -664,16 +663,10 @@ static void ocfs2_control_exit(void)
664 -rc); 663 -rc);
665} 664}
666 665
667static struct dlm_lksb *fsdlm_astarg_to_lksb(void *astarg)
668{
669 struct ocfs2_lock_res *res = astarg;
670 return &res->l_lksb.lksb_fsdlm;
671}
672
673static void fsdlm_lock_ast_wrapper(void *astarg) 666static void fsdlm_lock_ast_wrapper(void *astarg)
674{ 667{
675 struct dlm_lksb *lksb = fsdlm_astarg_to_lksb(astarg); 668 union ocfs2_dlm_lksb *lksb = astarg;
676 int status = lksb->sb_status; 669 int status = lksb->lksb_fsdlm.sb_status;
677 670
678 BUG_ON(ocfs2_user_plugin.sp_proto == NULL); 671 BUG_ON(ocfs2_user_plugin.sp_proto == NULL);
679 672
@@ -688,16 +681,18 @@ static void fsdlm_lock_ast_wrapper(void *astarg)
688 */ 681 */
689 682
690 if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) 683 if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL)
691 ocfs2_user_plugin.sp_proto->lp_unlock_ast(astarg, 0); 684 ocfs2_user_plugin.sp_proto->lp_unlock_ast(lksb, 0);
692 else 685 else
693 ocfs2_user_plugin.sp_proto->lp_lock_ast(astarg); 686 ocfs2_user_plugin.sp_proto->lp_lock_ast(lksb);
694} 687}
695 688
696static void fsdlm_blocking_ast_wrapper(void *astarg, int level) 689static void fsdlm_blocking_ast_wrapper(void *astarg, int level)
697{ 690{
691 union ocfs2_dlm_lksb *lksb = astarg;
692
698 BUG_ON(ocfs2_user_plugin.sp_proto == NULL); 693 BUG_ON(ocfs2_user_plugin.sp_proto == NULL);
699 694
700 ocfs2_user_plugin.sp_proto->lp_blocking_ast(astarg, level); 695 ocfs2_user_plugin.sp_proto->lp_blocking_ast(lksb, level);
701} 696}
702 697
703static int user_dlm_lock(struct ocfs2_cluster_connection *conn, 698static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
@@ -705,8 +700,7 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
705 union ocfs2_dlm_lksb *lksb, 700 union ocfs2_dlm_lksb *lksb,
706 u32 flags, 701 u32 flags,
707 void *name, 702 void *name,
708 unsigned int namelen, 703 unsigned int namelen)
709 void *astarg)
710{ 704{
711 int ret; 705 int ret;
712 706
@@ -716,20 +710,19 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
716 710
717 ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm, 711 ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
718 flags|DLM_LKF_NODLCKWT, name, namelen, 0, 712 flags|DLM_LKF_NODLCKWT, name, namelen, 0,
719 fsdlm_lock_ast_wrapper, astarg, 713 fsdlm_lock_ast_wrapper, lksb,
720 fsdlm_blocking_ast_wrapper); 714 fsdlm_blocking_ast_wrapper);
721 return ret; 715 return ret;
722} 716}
723 717
724static int user_dlm_unlock(struct ocfs2_cluster_connection *conn, 718static int user_dlm_unlock(struct ocfs2_cluster_connection *conn,
725 union ocfs2_dlm_lksb *lksb, 719 union ocfs2_dlm_lksb *lksb,
726 u32 flags, 720 u32 flags)
727 void *astarg)
728{ 721{
729 int ret; 722 int ret;
730 723
731 ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid, 724 ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
732 flags, &lksb->lksb_fsdlm, astarg); 725 flags, &lksb->lksb_fsdlm, lksb);
733 return ret; 726 return ret;
734} 727}
735 728
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index f3df0baa9a48..3500d9839d76 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -233,35 +233,32 @@ EXPORT_SYMBOL_GPL(ocfs2_stack_glue_set_locking_protocol);
233 233
234 234
235/* 235/*
236 * The ocfs2_dlm_lock() and ocfs2_dlm_unlock() functions take 236 * The ocfs2_dlm_lock() and ocfs2_dlm_unlock() functions take no argument
237 * "struct ocfs2_lock_res *astarg" instead of "void *astarg" because the 237 * for the ast and bast functions. They will pass the lksb to the ast
238 * underlying stack plugins need to pilfer the lksb off of the lock_res. 238 * and bast. The caller can wrap the lksb with their own structure to
239 * If some other structure needs to be passed as an astarg, the plugins 239 * get more information.
240 * will need to be given a different avenue to the lksb.
241 */ 240 */
242int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn, 241int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn,
243 int mode, 242 int mode,
244 union ocfs2_dlm_lksb *lksb, 243 union ocfs2_dlm_lksb *lksb,
245 u32 flags, 244 u32 flags,
246 void *name, 245 void *name,
247 unsigned int namelen, 246 unsigned int namelen)
248 struct ocfs2_lock_res *astarg)
249{ 247{
250 BUG_ON(lproto == NULL); 248 BUG_ON(lproto == NULL);
251 249
252 return active_stack->sp_ops->dlm_lock(conn, mode, lksb, flags, 250 return active_stack->sp_ops->dlm_lock(conn, mode, lksb, flags,
253 name, namelen, astarg); 251 name, namelen);
254} 252}
255EXPORT_SYMBOL_GPL(ocfs2_dlm_lock); 253EXPORT_SYMBOL_GPL(ocfs2_dlm_lock);
256 254
257int ocfs2_dlm_unlock(struct ocfs2_cluster_connection *conn, 255int ocfs2_dlm_unlock(struct ocfs2_cluster_connection *conn,
258 union ocfs2_dlm_lksb *lksb, 256 union ocfs2_dlm_lksb *lksb,
259 u32 flags, 257 u32 flags)
260 struct ocfs2_lock_res *astarg)
261{ 258{
262 BUG_ON(lproto == NULL); 259 BUG_ON(lproto == NULL);
263 260
264 return active_stack->sp_ops->dlm_unlock(conn, lksb, flags, astarg); 261 return active_stack->sp_ops->dlm_unlock(conn, lksb, flags);
265} 262}
266EXPORT_SYMBOL_GPL(ocfs2_dlm_unlock); 263EXPORT_SYMBOL_GPL(ocfs2_dlm_unlock);
267 264
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);