diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-02-01 15:14:57 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-04-18 11:56:03 -0400 |
commit | bd3e76105d4478ab89951a52d1a35250d24a9f16 (patch) | |
tree | 3a024471d62491f0160031663e0db23f42be37b8 /fs/ocfs2/dlmglue.c | |
parent | 24ef1815e5e13e50196eb1ab8ddc0d783443bdf8 (diff) |
ocfs2: Use global DLM_ constants in generic code.
The ocfs2 generic code should use the values in <linux/dlmconstants.h>.
stackglue.c will convert them to o2dlm values.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/dlmglue.c')
-rw-r--r-- | fs/ocfs2/dlmglue.c | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index aea3bef19171..b8ac903ef8ef 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #include <cluster/nodemanager.h> | 37 | #include <cluster/nodemanager.h> |
38 | #include <cluster/tcp.h> | 38 | #include <cluster/tcp.h> |
39 | 39 | ||
40 | #include <dlm/dlmapi.h> | ||
41 | |||
42 | #define MLOG_MASK_PREFIX ML_DLM_GLUE | 40 | #define MLOG_MASK_PREFIX ML_DLM_GLUE |
43 | #include <cluster/masklog.h> | 41 | #include <cluster/masklog.h> |
44 | 42 | ||
@@ -317,7 +315,7 @@ static inline struct ocfs2_super *ocfs2_get_lockres_osb(struct ocfs2_lock_res *l | |||
317 | static int ocfs2_lock_create(struct ocfs2_super *osb, | 315 | static int ocfs2_lock_create(struct ocfs2_super *osb, |
318 | struct ocfs2_lock_res *lockres, | 316 | struct ocfs2_lock_res *lockres, |
319 | int level, | 317 | int level, |
320 | int dlm_flags); | 318 | u32 dlm_flags); |
321 | static inline int ocfs2_may_continue_on_blocked_lock(struct ocfs2_lock_res *lockres, | 319 | static inline int ocfs2_may_continue_on_blocked_lock(struct ocfs2_lock_res *lockres, |
322 | int wanted); | 320 | int wanted); |
323 | static void ocfs2_cluster_unlock(struct ocfs2_super *osb, | 321 | static void ocfs2_cluster_unlock(struct ocfs2_super *osb, |
@@ -407,9 +405,9 @@ static void ocfs2_lock_res_init_common(struct ocfs2_super *osb, | |||
407 | res->l_ops = ops; | 405 | res->l_ops = ops; |
408 | res->l_priv = priv; | 406 | res->l_priv = priv; |
409 | 407 | ||
410 | res->l_level = LKM_IVMODE; | 408 | res->l_level = DLM_LOCK_IV; |
411 | res->l_requested = LKM_IVMODE; | 409 | res->l_requested = DLM_LOCK_IV; |
412 | res->l_blocking = LKM_IVMODE; | 410 | res->l_blocking = DLM_LOCK_IV; |
413 | res->l_action = OCFS2_AST_INVALID; | 411 | res->l_action = OCFS2_AST_INVALID; |
414 | res->l_unlock_action = OCFS2_UNLOCK_INVALID; | 412 | res->l_unlock_action = OCFS2_UNLOCK_INVALID; |
415 | 413 | ||
@@ -605,10 +603,10 @@ static inline void ocfs2_inc_holders(struct ocfs2_lock_res *lockres, | |||
605 | BUG_ON(!lockres); | 603 | BUG_ON(!lockres); |
606 | 604 | ||
607 | switch(level) { | 605 | switch(level) { |
608 | case LKM_EXMODE: | 606 | case DLM_LOCK_EX: |
609 | lockres->l_ex_holders++; | 607 | lockres->l_ex_holders++; |
610 | break; | 608 | break; |
611 | case LKM_PRMODE: | 609 | case DLM_LOCK_PR: |
612 | lockres->l_ro_holders++; | 610 | lockres->l_ro_holders++; |
613 | break; | 611 | break; |
614 | default: | 612 | default: |
@@ -626,11 +624,11 @@ static inline void ocfs2_dec_holders(struct ocfs2_lock_res *lockres, | |||
626 | BUG_ON(!lockres); | 624 | BUG_ON(!lockres); |
627 | 625 | ||
628 | switch(level) { | 626 | switch(level) { |
629 | case LKM_EXMODE: | 627 | case DLM_LOCK_EX: |
630 | BUG_ON(!lockres->l_ex_holders); | 628 | BUG_ON(!lockres->l_ex_holders); |
631 | lockres->l_ex_holders--; | 629 | lockres->l_ex_holders--; |
632 | break; | 630 | break; |
633 | case LKM_PRMODE: | 631 | case DLM_LOCK_PR: |
634 | BUG_ON(!lockres->l_ro_holders); | 632 | BUG_ON(!lockres->l_ro_holders); |
635 | lockres->l_ro_holders--; | 633 | lockres->l_ro_holders--; |
636 | break; | 634 | break; |
@@ -645,12 +643,12 @@ static inline void ocfs2_dec_holders(struct ocfs2_lock_res *lockres, | |||
645 | * lock types are added. */ | 643 | * lock types are added. */ |
646 | static inline int ocfs2_highest_compat_lock_level(int level) | 644 | static inline int ocfs2_highest_compat_lock_level(int level) |
647 | { | 645 | { |
648 | int new_level = LKM_EXMODE; | 646 | int new_level = DLM_LOCK_EX; |
649 | 647 | ||
650 | if (level == LKM_EXMODE) | 648 | if (level == DLM_LOCK_EX) |
651 | new_level = LKM_NLMODE; | 649 | new_level = DLM_LOCK_NL; |
652 | else if (level == LKM_PRMODE) | 650 | else if (level == DLM_LOCK_PR) |
653 | new_level = LKM_PRMODE; | 651 | new_level = DLM_LOCK_PR; |
654 | return new_level; | 652 | return new_level; |
655 | } | 653 | } |
656 | 654 | ||
@@ -689,12 +687,12 @@ static inline void ocfs2_generic_handle_downconvert_action(struct ocfs2_lock_res | |||
689 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY)); | 687 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY)); |
690 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_ATTACHED)); | 688 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_ATTACHED)); |
691 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED)); | 689 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED)); |
692 | BUG_ON(lockres->l_blocking <= LKM_NLMODE); | 690 | BUG_ON(lockres->l_blocking <= DLM_LOCK_NL); |
693 | 691 | ||
694 | lockres->l_level = lockres->l_requested; | 692 | lockres->l_level = lockres->l_requested; |
695 | if (lockres->l_level <= | 693 | if (lockres->l_level <= |
696 | ocfs2_highest_compat_lock_level(lockres->l_blocking)) { | 694 | ocfs2_highest_compat_lock_level(lockres->l_blocking)) { |
697 | lockres->l_blocking = LKM_NLMODE; | 695 | lockres->l_blocking = DLM_LOCK_NL; |
698 | lockres_clear_flags(lockres, OCFS2_LOCK_BLOCKED); | 696 | lockres_clear_flags(lockres, OCFS2_LOCK_BLOCKED); |
699 | } | 697 | } |
700 | lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); | 698 | lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); |
@@ -713,7 +711,7 @@ static inline void ocfs2_generic_handle_convert_action(struct ocfs2_lock_res *lo | |||
713 | * information is already up to data. Convert from NL to | 711 | * information is already up to data. Convert from NL to |
714 | * *anything* however should mark ourselves as needing an | 712 | * *anything* however should mark ourselves as needing an |
715 | * update */ | 713 | * update */ |
716 | if (lockres->l_level == LKM_NLMODE && | 714 | if (lockres->l_level == DLM_LOCK_NL && |
717 | lockres->l_ops->flags & LOCK_TYPE_REQUIRES_REFRESH) | 715 | lockres->l_ops->flags & LOCK_TYPE_REQUIRES_REFRESH) |
718 | lockres_or_flags(lockres, OCFS2_LOCK_NEEDS_REFRESH); | 716 | lockres_or_flags(lockres, OCFS2_LOCK_NEEDS_REFRESH); |
719 | 717 | ||
@@ -730,7 +728,7 @@ static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *loc | |||
730 | BUG_ON((!(lockres->l_flags & OCFS2_LOCK_BUSY))); | 728 | BUG_ON((!(lockres->l_flags & OCFS2_LOCK_BUSY))); |
731 | BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED); | 729 | BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED); |
732 | 730 | ||
733 | if (lockres->l_requested > LKM_NLMODE && | 731 | if (lockres->l_requested > DLM_LOCK_NL && |
734 | !(lockres->l_flags & OCFS2_LOCK_LOCAL) && | 732 | !(lockres->l_flags & OCFS2_LOCK_LOCAL) && |
735 | lockres->l_ops->flags & LOCK_TYPE_REQUIRES_REFRESH) | 733 | lockres->l_ops->flags & LOCK_TYPE_REQUIRES_REFRESH) |
736 | lockres_or_flags(lockres, OCFS2_LOCK_NEEDS_REFRESH); | 734 | lockres_or_flags(lockres, OCFS2_LOCK_NEEDS_REFRESH); |
@@ -775,7 +773,7 @@ static void ocfs2_blocking_ast(void *opaque, int level) | |||
775 | int needs_downconvert; | 773 | int needs_downconvert; |
776 | unsigned long flags; | 774 | unsigned long flags; |
777 | 775 | ||
778 | BUG_ON(level <= LKM_NLMODE); | 776 | BUG_ON(level <= DLM_LOCK_NL); |
779 | 777 | ||
780 | mlog(0, "BAST fired for lockres %s, blocking %d, level %d type %s\n", | 778 | mlog(0, "BAST fired for lockres %s, blocking %d, level %d type %s\n", |
781 | lockres->l_name, level, lockres->l_level, | 779 | lockres->l_name, level, lockres->l_level, |
@@ -866,7 +864,7 @@ static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres, | |||
866 | static int ocfs2_lock_create(struct ocfs2_super *osb, | 864 | static int ocfs2_lock_create(struct ocfs2_super *osb, |
867 | struct ocfs2_lock_res *lockres, | 865 | struct ocfs2_lock_res *lockres, |
868 | int level, | 866 | int level, |
869 | int dlm_flags) | 867 | u32 dlm_flags) |
870 | { | 868 | { |
871 | int ret = 0; | 869 | int ret = 0; |
872 | enum dlm_status status = DLM_NORMAL; | 870 | enum dlm_status status = DLM_NORMAL; |
@@ -874,7 +872,7 @@ static int ocfs2_lock_create(struct ocfs2_super *osb, | |||
874 | 872 | ||
875 | mlog_entry_void(); | 873 | mlog_entry_void(); |
876 | 874 | ||
877 | mlog(0, "lock %s, level = %d, flags = %d\n", lockres->l_name, level, | 875 | mlog(0, "lock %s, level = %d, flags = %u\n", lockres->l_name, level, |
878 | dlm_flags); | 876 | dlm_flags); |
879 | 877 | ||
880 | spin_lock_irqsave(&lockres->l_lock, flags); | 878 | spin_lock_irqsave(&lockres->l_lock, flags); |
@@ -1016,7 +1014,7 @@ static int ocfs2_wait_for_mask_interruptible(struct ocfs2_mask_waiter *mw, | |||
1016 | static int ocfs2_cluster_lock(struct ocfs2_super *osb, | 1014 | static int ocfs2_cluster_lock(struct ocfs2_super *osb, |
1017 | struct ocfs2_lock_res *lockres, | 1015 | struct ocfs2_lock_res *lockres, |
1018 | int level, | 1016 | int level, |
1019 | int lkm_flags, | 1017 | u32 lkm_flags, |
1020 | int arg_flags) | 1018 | int arg_flags) |
1021 | { | 1019 | { |
1022 | struct ocfs2_mask_waiter mw; | 1020 | struct ocfs2_mask_waiter mw; |
@@ -1030,7 +1028,7 @@ static int ocfs2_cluster_lock(struct ocfs2_super *osb, | |||
1030 | ocfs2_init_mask_waiter(&mw); | 1028 | ocfs2_init_mask_waiter(&mw); |
1031 | 1029 | ||
1032 | if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) | 1030 | if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) |
1033 | lkm_flags |= LKM_VALBLK; | 1031 | lkm_flags |= DLM_LKF_VALBLK; |
1034 | 1032 | ||
1035 | again: | 1033 | again: |
1036 | wait = 0; | 1034 | wait = 0; |
@@ -1074,18 +1072,18 @@ again: | |||
1074 | 1072 | ||
1075 | if (!(lockres->l_flags & OCFS2_LOCK_ATTACHED)) { | 1073 | if (!(lockres->l_flags & OCFS2_LOCK_ATTACHED)) { |
1076 | lockres->l_action = OCFS2_AST_ATTACH; | 1074 | lockres->l_action = OCFS2_AST_ATTACH; |
1077 | lkm_flags &= ~LKM_CONVERT; | 1075 | lkm_flags &= ~DLM_LKF_CONVERT; |
1078 | } else { | 1076 | } else { |
1079 | lockres->l_action = OCFS2_AST_CONVERT; | 1077 | lockres->l_action = OCFS2_AST_CONVERT; |
1080 | lkm_flags |= LKM_CONVERT; | 1078 | lkm_flags |= DLM_LKF_CONVERT; |
1081 | } | 1079 | } |
1082 | 1080 | ||
1083 | lockres->l_requested = level; | 1081 | lockres->l_requested = level; |
1084 | lockres_or_flags(lockres, OCFS2_LOCK_BUSY); | 1082 | lockres_or_flags(lockres, OCFS2_LOCK_BUSY); |
1085 | spin_unlock_irqrestore(&lockres->l_lock, flags); | 1083 | spin_unlock_irqrestore(&lockres->l_lock, flags); |
1086 | 1084 | ||
1087 | BUG_ON(level == LKM_IVMODE); | 1085 | BUG_ON(level == DLM_LOCK_IV); |
1088 | BUG_ON(level == LKM_NLMODE); | 1086 | BUG_ON(level == DLM_LOCK_NL); |
1089 | 1087 | ||
1090 | mlog(0, "lock %s, convert from %d to level = %d\n", | 1088 | mlog(0, "lock %s, convert from %d to level = %d\n", |
1091 | lockres->l_name, lockres->l_level, level); | 1089 | lockres->l_name, lockres->l_level, level); |
@@ -1099,7 +1097,7 @@ again: | |||
1099 | OCFS2_LOCK_ID_MAX_LEN - 1, | 1097 | OCFS2_LOCK_ID_MAX_LEN - 1, |
1100 | lockres); | 1098 | lockres); |
1101 | if (status != DLM_NORMAL) { | 1099 | if (status != DLM_NORMAL) { |
1102 | if ((lkm_flags & LKM_NOQUEUE) && | 1100 | if ((lkm_flags & DLM_LKF_NOQUEUE) && |
1103 | (status == DLM_NOTQUEUED)) | 1101 | (status == DLM_NOTQUEUED)) |
1104 | ret = -EAGAIN; | 1102 | ret = -EAGAIN; |
1105 | else { | 1103 | else { |
@@ -1175,9 +1173,9 @@ static int ocfs2_create_new_lock(struct ocfs2_super *osb, | |||
1175 | int ex, | 1173 | int ex, |
1176 | int local) | 1174 | int local) |
1177 | { | 1175 | { |
1178 | int level = ex ? LKM_EXMODE : LKM_PRMODE; | 1176 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; |
1179 | unsigned long flags; | 1177 | unsigned long flags; |
1180 | int lkm_flags = local ? LKM_LOCAL : 0; | 1178 | u32 lkm_flags = local ? DLM_LKF_LOCAL : 0; |
1181 | 1179 | ||
1182 | spin_lock_irqsave(&lockres->l_lock, flags); | 1180 | spin_lock_irqsave(&lockres->l_lock, flags); |
1183 | BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED); | 1181 | BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED); |
@@ -1220,7 +1218,7 @@ int ocfs2_create_new_inode_locks(struct inode *inode) | |||
1220 | } | 1218 | } |
1221 | 1219 | ||
1222 | /* | 1220 | /* |
1223 | * We don't want to use LKM_LOCAL on a meta data lock as they | 1221 | * We don't want to use DLM_LKF_LOCAL on a meta data lock as they |
1224 | * don't use a generation in their lock names. | 1222 | * don't use a generation in their lock names. |
1225 | */ | 1223 | */ |
1226 | ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_inode_lockres, 1, 0); | 1224 | ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_inode_lockres, 1, 0); |
@@ -1259,7 +1257,7 @@ int ocfs2_rw_lock(struct inode *inode, int write) | |||
1259 | 1257 | ||
1260 | lockres = &OCFS2_I(inode)->ip_rw_lockres; | 1258 | lockres = &OCFS2_I(inode)->ip_rw_lockres; |
1261 | 1259 | ||
1262 | level = write ? LKM_EXMODE : LKM_PRMODE; | 1260 | level = write ? DLM_LOCK_EX : DLM_LOCK_PR; |
1263 | 1261 | ||
1264 | status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, level, 0, | 1262 | status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, level, 0, |
1265 | 0); | 1263 | 0); |
@@ -1272,7 +1270,7 @@ int ocfs2_rw_lock(struct inode *inode, int write) | |||
1272 | 1270 | ||
1273 | void ocfs2_rw_unlock(struct inode *inode, int write) | 1271 | void ocfs2_rw_unlock(struct inode *inode, int write) |
1274 | { | 1272 | { |
1275 | int level = write ? LKM_EXMODE : LKM_PRMODE; | 1273 | int level = write ? DLM_LOCK_EX : DLM_LOCK_PR; |
1276 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres; | 1274 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres; |
1277 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1275 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1278 | 1276 | ||
@@ -1310,7 +1308,7 @@ int ocfs2_open_lock(struct inode *inode) | |||
1310 | lockres = &OCFS2_I(inode)->ip_open_lockres; | 1308 | lockres = &OCFS2_I(inode)->ip_open_lockres; |
1311 | 1309 | ||
1312 | status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, | 1310 | status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, |
1313 | LKM_PRMODE, 0, 0); | 1311 | DLM_LOCK_PR, 0, 0); |
1314 | if (status < 0) | 1312 | if (status < 0) |
1315 | mlog_errno(status); | 1313 | mlog_errno(status); |
1316 | 1314 | ||
@@ -1338,16 +1336,16 @@ int ocfs2_try_open_lock(struct inode *inode, int write) | |||
1338 | 1336 | ||
1339 | lockres = &OCFS2_I(inode)->ip_open_lockres; | 1337 | lockres = &OCFS2_I(inode)->ip_open_lockres; |
1340 | 1338 | ||
1341 | level = write ? LKM_EXMODE : LKM_PRMODE; | 1339 | level = write ? DLM_LOCK_EX : DLM_LOCK_PR; |
1342 | 1340 | ||
1343 | /* | 1341 | /* |
1344 | * The file system may already holding a PRMODE/EXMODE open lock. | 1342 | * The file system may already holding a PRMODE/EXMODE open lock. |
1345 | * Since we pass LKM_NOQUEUE, the request won't block waiting on | 1343 | * Since we pass DLM_LKF_NOQUEUE, the request won't block waiting on |
1346 | * other nodes and the -EAGAIN will indicate to the caller that | 1344 | * other nodes and the -EAGAIN will indicate to the caller that |
1347 | * this inode is still in use. | 1345 | * this inode is still in use. |
1348 | */ | 1346 | */ |
1349 | status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, | 1347 | status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, |
1350 | level, LKM_NOQUEUE, 0); | 1348 | level, DLM_LKF_NOQUEUE, 0); |
1351 | 1349 | ||
1352 | out: | 1350 | out: |
1353 | mlog_exit(status); | 1351 | mlog_exit(status); |
@@ -1372,10 +1370,10 @@ void ocfs2_open_unlock(struct inode *inode) | |||
1372 | 1370 | ||
1373 | if(lockres->l_ro_holders) | 1371 | if(lockres->l_ro_holders) |
1374 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, | 1372 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, |
1375 | LKM_PRMODE); | 1373 | DLM_LOCK_PR); |
1376 | if(lockres->l_ex_holders) | 1374 | if(lockres->l_ex_holders) |
1377 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, | 1375 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, |
1378 | LKM_EXMODE); | 1376 | DLM_LOCK_EX); |
1379 | 1377 | ||
1380 | out: | 1378 | out: |
1381 | mlog_exit_void(); | 1379 | mlog_exit_void(); |
@@ -1462,7 +1460,7 @@ int ocfs2_file_lock(struct file *file, int ex, int trylock) | |||
1462 | ocfs2_init_mask_waiter(&mw); | 1460 | ocfs2_init_mask_waiter(&mw); |
1463 | 1461 | ||
1464 | if ((lockres->l_flags & OCFS2_LOCK_BUSY) || | 1462 | if ((lockres->l_flags & OCFS2_LOCK_BUSY) || |
1465 | (lockres->l_level > LKM_NLMODE)) { | 1463 | (lockres->l_level > DLM_LOCK_NL)) { |
1466 | mlog(ML_ERROR, | 1464 | mlog(ML_ERROR, |
1467 | "File lock \"%s\" has busy or locked state: flags: 0x%lx, " | 1465 | "File lock \"%s\" has busy or locked state: flags: 0x%lx, " |
1468 | "level: %u\n", lockres->l_name, lockres->l_flags, | 1466 | "level: %u\n", lockres->l_name, lockres->l_flags, |
@@ -1570,7 +1568,7 @@ void ocfs2_file_unlock(struct file *file) | |||
1570 | * Fake a blocking ast for the downconvert code. | 1568 | * Fake a blocking ast for the downconvert code. |
1571 | */ | 1569 | */ |
1572 | lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED); | 1570 | lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED); |
1573 | lockres->l_blocking = LKM_EXMODE; | 1571 | lockres->l_blocking = DLM_LOCK_EX; |
1574 | 1572 | ||
1575 | ocfs2_prepare_downconvert(lockres, LKM_NLMODE); | 1573 | ocfs2_prepare_downconvert(lockres, LKM_NLMODE); |
1576 | lockres_add_mask_waiter(lockres, &mw, OCFS2_LOCK_BUSY, 0); | 1574 | lockres_add_mask_waiter(lockres, &mw, OCFS2_LOCK_BUSY, 0); |
@@ -1599,11 +1597,11 @@ static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, | |||
1599 | * condition. */ | 1597 | * condition. */ |
1600 | if (lockres->l_flags & OCFS2_LOCK_BLOCKED) { | 1598 | if (lockres->l_flags & OCFS2_LOCK_BLOCKED) { |
1601 | switch(lockres->l_blocking) { | 1599 | switch(lockres->l_blocking) { |
1602 | case LKM_EXMODE: | 1600 | case DLM_LOCK_EX: |
1603 | if (!lockres->l_ex_holders && !lockres->l_ro_holders) | 1601 | if (!lockres->l_ex_holders && !lockres->l_ro_holders) |
1604 | kick = 1; | 1602 | kick = 1; |
1605 | break; | 1603 | break; |
1606 | case LKM_PRMODE: | 1604 | case DLM_LOCK_PR: |
1607 | if (!lockres->l_ex_holders) | 1605 | if (!lockres->l_ex_holders) |
1608 | kick = 1; | 1606 | kick = 1; |
1609 | break; | 1607 | break; |
@@ -1921,7 +1919,8 @@ int ocfs2_inode_lock_full(struct inode *inode, | |||
1921 | int ex, | 1919 | int ex, |
1922 | int arg_flags) | 1920 | int arg_flags) |
1923 | { | 1921 | { |
1924 | int status, level, dlm_flags, acquired; | 1922 | int status, level, acquired; |
1923 | u32 dlm_flags; | ||
1925 | struct ocfs2_lock_res *lockres = NULL; | 1924 | struct ocfs2_lock_res *lockres = NULL; |
1926 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1925 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1927 | struct buffer_head *local_bh = NULL; | 1926 | struct buffer_head *local_bh = NULL; |
@@ -1951,10 +1950,10 @@ int ocfs2_inode_lock_full(struct inode *inode, | |||
1951 | ocfs2_wait_for_recovery(osb); | 1950 | ocfs2_wait_for_recovery(osb); |
1952 | 1951 | ||
1953 | lockres = &OCFS2_I(inode)->ip_inode_lockres; | 1952 | lockres = &OCFS2_I(inode)->ip_inode_lockres; |
1954 | level = ex ? LKM_EXMODE : LKM_PRMODE; | 1953 | level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; |
1955 | dlm_flags = 0; | 1954 | dlm_flags = 0; |
1956 | if (arg_flags & OCFS2_META_LOCK_NOQUEUE) | 1955 | if (arg_flags & OCFS2_META_LOCK_NOQUEUE) |
1957 | dlm_flags |= LKM_NOQUEUE; | 1956 | dlm_flags |= DLM_LKF_NOQUEUE; |
1958 | 1957 | ||
1959 | status = ocfs2_cluster_lock(osb, lockres, level, dlm_flags, arg_flags); | 1958 | status = ocfs2_cluster_lock(osb, lockres, level, dlm_flags, arg_flags); |
1960 | if (status < 0) { | 1959 | if (status < 0) { |
@@ -2105,7 +2104,7 @@ int ocfs2_inode_lock_atime(struct inode *inode, | |||
2105 | void ocfs2_inode_unlock(struct inode *inode, | 2104 | void ocfs2_inode_unlock(struct inode *inode, |
2106 | int ex) | 2105 | int ex) |
2107 | { | 2106 | { |
2108 | int level = ex ? LKM_EXMODE : LKM_PRMODE; | 2107 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; |
2109 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_inode_lockres; | 2108 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_inode_lockres; |
2110 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 2109 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
2111 | 2110 | ||
@@ -2126,7 +2125,7 @@ int ocfs2_super_lock(struct ocfs2_super *osb, | |||
2126 | int ex) | 2125 | int ex) |
2127 | { | 2126 | { |
2128 | int status = 0; | 2127 | int status = 0; |
2129 | int level = ex ? LKM_EXMODE : LKM_PRMODE; | 2128 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; |
2130 | struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; | 2129 | struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; |
2131 | 2130 | ||
2132 | mlog_entry_void(); | 2131 | mlog_entry_void(); |
@@ -2168,7 +2167,7 @@ bail: | |||
2168 | void ocfs2_super_unlock(struct ocfs2_super *osb, | 2167 | void ocfs2_super_unlock(struct ocfs2_super *osb, |
2169 | int ex) | 2168 | int ex) |
2170 | { | 2169 | { |
2171 | int level = ex ? LKM_EXMODE : LKM_PRMODE; | 2170 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; |
2172 | struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; | 2171 | struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; |
2173 | 2172 | ||
2174 | if (!ocfs2_mount_local(osb)) | 2173 | if (!ocfs2_mount_local(osb)) |
@@ -2186,7 +2185,7 @@ int ocfs2_rename_lock(struct ocfs2_super *osb) | |||
2186 | if (ocfs2_mount_local(osb)) | 2185 | if (ocfs2_mount_local(osb)) |
2187 | return 0; | 2186 | return 0; |
2188 | 2187 | ||
2189 | status = ocfs2_cluster_lock(osb, lockres, LKM_EXMODE, 0, 0); | 2188 | status = ocfs2_cluster_lock(osb, lockres, DLM_LOCK_EX, 0, 0); |
2190 | if (status < 0) | 2189 | if (status < 0) |
2191 | mlog_errno(status); | 2190 | mlog_errno(status); |
2192 | 2191 | ||
@@ -2198,13 +2197,13 @@ void ocfs2_rename_unlock(struct ocfs2_super *osb) | |||
2198 | struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres; | 2197 | struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres; |
2199 | 2198 | ||
2200 | if (!ocfs2_mount_local(osb)) | 2199 | if (!ocfs2_mount_local(osb)) |
2201 | ocfs2_cluster_unlock(osb, lockres, LKM_EXMODE); | 2200 | ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_EX); |
2202 | } | 2201 | } |
2203 | 2202 | ||
2204 | int ocfs2_dentry_lock(struct dentry *dentry, int ex) | 2203 | int ocfs2_dentry_lock(struct dentry *dentry, int ex) |
2205 | { | 2204 | { |
2206 | int ret; | 2205 | int ret; |
2207 | int level = ex ? LKM_EXMODE : LKM_PRMODE; | 2206 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; |
2208 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; | 2207 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; |
2209 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); | 2208 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); |
2210 | 2209 | ||
@@ -2225,7 +2224,7 @@ int ocfs2_dentry_lock(struct dentry *dentry, int ex) | |||
2225 | 2224 | ||
2226 | void ocfs2_dentry_unlock(struct dentry *dentry, int ex) | 2225 | void ocfs2_dentry_unlock(struct dentry *dentry, int ex) |
2227 | { | 2226 | { |
2228 | int level = ex ? LKM_EXMODE : LKM_PRMODE; | 2227 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; |
2229 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; | 2228 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; |
2230 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); | 2229 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); |
2231 | 2230 | ||
@@ -2614,7 +2613,7 @@ static void ocfs2_unlock_ast(void *opaque, enum dlm_status status) | |||
2614 | lockres->l_action = OCFS2_AST_INVALID; | 2613 | lockres->l_action = OCFS2_AST_INVALID; |
2615 | break; | 2614 | break; |
2616 | case OCFS2_UNLOCK_DROP_LOCK: | 2615 | case OCFS2_UNLOCK_DROP_LOCK: |
2617 | lockres->l_level = LKM_IVMODE; | 2616 | lockres->l_level = DLM_LOCK_IV; |
2618 | break; | 2617 | break; |
2619 | default: | 2618 | default: |
2620 | BUG(); | 2619 | BUG(); |
@@ -2635,14 +2634,14 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb, | |||
2635 | { | 2634 | { |
2636 | enum dlm_status status; | 2635 | enum dlm_status status; |
2637 | unsigned long flags; | 2636 | unsigned long flags; |
2638 | int lkm_flags = 0; | 2637 | u32 lkm_flags = 0; |
2639 | 2638 | ||
2640 | /* We didn't get anywhere near actually using this lockres. */ | 2639 | /* We didn't get anywhere near actually using this lockres. */ |
2641 | if (!(lockres->l_flags & OCFS2_LOCK_INITIALIZED)) | 2640 | if (!(lockres->l_flags & OCFS2_LOCK_INITIALIZED)) |
2642 | goto out; | 2641 | goto out; |
2643 | 2642 | ||
2644 | if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) | 2643 | if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) |
2645 | lkm_flags |= LKM_VALBLK; | 2644 | lkm_flags |= DLM_LKF_VALBLK; |
2646 | 2645 | ||
2647 | spin_lock_irqsave(&lockres->l_lock, flags); | 2646 | spin_lock_irqsave(&lockres->l_lock, flags); |
2648 | 2647 | ||
@@ -2668,7 +2667,7 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb, | |||
2668 | 2667 | ||
2669 | if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) { | 2668 | if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) { |
2670 | if (lockres->l_flags & OCFS2_LOCK_ATTACHED && | 2669 | if (lockres->l_flags & OCFS2_LOCK_ATTACHED && |
2671 | lockres->l_level == LKM_EXMODE && | 2670 | lockres->l_level == DLM_LOCK_EX && |
2672 | !(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH)) | 2671 | !(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH)) |
2673 | lockres->l_ops->set_lvb(lockres); | 2672 | lockres->l_ops->set_lvb(lockres); |
2674 | } | 2673 | } |
@@ -2801,10 +2800,10 @@ static void ocfs2_prepare_downconvert(struct ocfs2_lock_res *lockres, | |||
2801 | { | 2800 | { |
2802 | assert_spin_locked(&lockres->l_lock); | 2801 | assert_spin_locked(&lockres->l_lock); |
2803 | 2802 | ||
2804 | BUG_ON(lockres->l_blocking <= LKM_NLMODE); | 2803 | BUG_ON(lockres->l_blocking <= DLM_LOCK_NL); |
2805 | 2804 | ||
2806 | if (lockres->l_level <= new_level) { | 2805 | if (lockres->l_level <= new_level) { |
2807 | mlog(ML_ERROR, "lockres->l_level (%u) <= new_level (%u)\n", | 2806 | mlog(ML_ERROR, "lockres->l_level (%d) <= new_level (%d)\n", |
2808 | lockres->l_level, new_level); | 2807 | lockres->l_level, new_level); |
2809 | BUG(); | 2808 | BUG(); |
2810 | } | 2809 | } |
@@ -2822,13 +2821,14 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb, | |||
2822 | int new_level, | 2821 | int new_level, |
2823 | int lvb) | 2822 | int lvb) |
2824 | { | 2823 | { |
2825 | int ret, dlm_flags = LKM_CONVERT; | 2824 | int ret; |
2825 | u32 dlm_flags = DLM_LKF_CONVERT; | ||
2826 | enum dlm_status status; | 2826 | enum dlm_status status; |
2827 | 2827 | ||
2828 | mlog_entry_void(); | 2828 | mlog_entry_void(); |
2829 | 2829 | ||
2830 | if (lvb) | 2830 | if (lvb) |
2831 | dlm_flags |= LKM_VALBLK; | 2831 | dlm_flags |= DLM_LKF_VALBLK; |
2832 | 2832 | ||
2833 | status = ocfs2_dlm_lock(osb->dlm, | 2833 | status = ocfs2_dlm_lock(osb->dlm, |
2834 | new_level, | 2834 | new_level, |
@@ -2894,7 +2894,7 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb, | |||
2894 | ret = 0; | 2894 | ret = 0; |
2895 | status = ocfs2_dlm_unlock(osb->dlm, | 2895 | status = ocfs2_dlm_unlock(osb->dlm, |
2896 | &lockres->l_lksb, | 2896 | &lockres->l_lksb, |
2897 | LKM_CANCEL, | 2897 | DLM_LKF_CANCEL, |
2898 | lockres); | 2898 | lockres); |
2899 | if (status != DLM_NORMAL) { | 2899 | if (status != DLM_NORMAL) { |
2900 | ocfs2_log_dlm_error("ocfs2_dlm_unlock", status, lockres); | 2900 | ocfs2_log_dlm_error("ocfs2_dlm_unlock", status, lockres); |
@@ -2939,13 +2939,13 @@ recheck: | |||
2939 | 2939 | ||
2940 | /* if we're blocking an exclusive and we have *any* holders, | 2940 | /* if we're blocking an exclusive and we have *any* holders, |
2941 | * then requeue. */ | 2941 | * then requeue. */ |
2942 | if ((lockres->l_blocking == LKM_EXMODE) | 2942 | if ((lockres->l_blocking == DLM_LOCK_EX) |
2943 | && (lockres->l_ex_holders || lockres->l_ro_holders)) | 2943 | && (lockres->l_ex_holders || lockres->l_ro_holders)) |
2944 | goto leave_requeue; | 2944 | goto leave_requeue; |
2945 | 2945 | ||
2946 | /* If it's a PR we're blocking, then only | 2946 | /* If it's a PR we're blocking, then only |
2947 | * requeue if we've got any EX holders */ | 2947 | * requeue if we've got any EX holders */ |
2948 | if (lockres->l_blocking == LKM_PRMODE && | 2948 | if (lockres->l_blocking == DLM_LOCK_PR && |
2949 | lockres->l_ex_holders) | 2949 | lockres->l_ex_holders) |
2950 | goto leave_requeue; | 2950 | goto leave_requeue; |
2951 | 2951 | ||
@@ -2992,7 +2992,7 @@ downconvert: | |||
2992 | ctl->requeue = 0; | 2992 | ctl->requeue = 0; |
2993 | 2993 | ||
2994 | if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) { | 2994 | if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) { |
2995 | if (lockres->l_level == LKM_EXMODE) | 2995 | if (lockres->l_level == DLM_LOCK_EX) |
2996 | set_lvb = 1; | 2996 | set_lvb = 1; |
2997 | 2997 | ||
2998 | /* | 2998 | /* |
@@ -3046,7 +3046,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, | |||
3046 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 3046 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
3047 | } | 3047 | } |
3048 | sync_mapping_buffers(mapping); | 3048 | sync_mapping_buffers(mapping); |
3049 | if (blocking == LKM_EXMODE) { | 3049 | if (blocking == DLM_LOCK_EX) { |
3050 | truncate_inode_pages(mapping, 0); | 3050 | truncate_inode_pages(mapping, 0); |
3051 | } else { | 3051 | } else { |
3052 | /* We only need to wait on the I/O if we're not also | 3052 | /* We only need to wait on the I/O if we're not also |
@@ -3067,8 +3067,8 @@ static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres, | |||
3067 | struct inode *inode = ocfs2_lock_res_inode(lockres); | 3067 | struct inode *inode = ocfs2_lock_res_inode(lockres); |
3068 | int checkpointed = ocfs2_inode_fully_checkpointed(inode); | 3068 | int checkpointed = ocfs2_inode_fully_checkpointed(inode); |
3069 | 3069 | ||
3070 | BUG_ON(new_level != LKM_NLMODE && new_level != LKM_PRMODE); | 3070 | BUG_ON(new_level != DLM_LOCK_NL && new_level != DLM_LOCK_PR); |
3071 | BUG_ON(lockres->l_level != LKM_EXMODE && !checkpointed); | 3071 | BUG_ON(lockres->l_level != DLM_LOCK_EX && !checkpointed); |
3072 | 3072 | ||
3073 | if (checkpointed) | 3073 | if (checkpointed) |
3074 | return 1; | 3074 | return 1; |
@@ -3132,7 +3132,7 @@ static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres, | |||
3132 | * valid. The downconvert code will retain a PR for this node, | 3132 | * valid. The downconvert code will retain a PR for this node, |
3133 | * so there's no further work to do. | 3133 | * so there's no further work to do. |
3134 | */ | 3134 | */ |
3135 | if (blocking == LKM_PRMODE) | 3135 | if (blocking == DLM_LOCK_PR) |
3136 | return UNBLOCK_CONTINUE; | 3136 | return UNBLOCK_CONTINUE; |
3137 | 3137 | ||
3138 | /* | 3138 | /* |