Lines Matching full:ls

257 	struct lm_lockstruct *ls = &gl->gl_name.ln_sbd->sd_lockstruct;  in gdlm_lock()  local
279 return dlm_lock(ls->ls_dlm, req, &gl->gl_lksb, lkf, strname, in gdlm_lock()
286 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_put_lock() local
311 error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK, in gdlm_put_lock()
323 struct lm_lockstruct *ls = &gl->gl_name.ln_sbd->sd_lockstruct; in gdlm_cancel() local
324 dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_CANCEL, NULL, gl); in gdlm_cancel()
470 static void control_lvb_read(struct lm_lockstruct *ls, uint32_t *lvb_gen, in control_lvb_read() argument
474 memcpy(lvb_bits, ls->ls_control_lvb, GDLM_LVB_SIZE); in control_lvb_read()
479 static void control_lvb_write(struct lm_lockstruct *ls, uint32_t lvb_gen, in control_lvb_write() argument
483 memcpy(ls->ls_control_lvb, lvb_bits, GDLM_LVB_SIZE); in control_lvb_write()
485 memcpy(ls->ls_control_lvb, &gen, sizeof(__le32)); in control_lvb_write()
496 struct lm_lockstruct *ls = arg; in sync_wait_cb() local
497 complete(&ls->ls_sync_wait); in sync_wait_cb()
502 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in sync_unlock() local
505 error = dlm_unlock(ls->ls_dlm, lksb->sb_lkid, 0, lksb, ls); in sync_unlock()
512 wait_for_completion(&ls->ls_sync_wait); in sync_unlock()
525 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in sync_lock() local
532 error = dlm_lock(ls->ls_dlm, mode, lksb, flags, in sync_lock()
534 0, sync_wait_cb, ls, NULL); in sync_lock()
541 wait_for_completion(&ls->ls_sync_wait); in sync_lock()
555 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in mounted_unlock() local
556 return sync_unlock(sdp, &ls->ls_mounted_lksb, "mounted_lock"); in mounted_unlock()
561 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in mounted_lock() local
563 &ls->ls_mounted_lksb, "mounted_lock"); in mounted_lock()
568 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in control_unlock() local
569 return sync_unlock(sdp, &ls->ls_control_lksb, "control_lock"); in control_unlock()
574 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in control_lock() local
576 &ls->ls_control_lksb, "control_lock"); in control_lock()
604 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gfs2_control_func() local
618 spin_lock(&ls->ls_recover_spin); in gfs2_control_func()
628 if (!test_bit(DFL_MOUNT_DONE, &ls->ls_recover_flags) || in gfs2_control_func()
629 test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags)) { in gfs2_control_func()
630 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
633 block_gen = ls->ls_recover_block; in gfs2_control_func()
634 start_gen = ls->ls_recover_start; in gfs2_control_func()
635 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
665 control_lvb_read(ls, &lvb_gen, ls->ls_lvb_bits); in gfs2_control_func()
667 spin_lock(&ls->ls_recover_spin); in gfs2_control_func()
668 if (block_gen != ls->ls_recover_block || in gfs2_control_func()
669 start_gen != ls->ls_recover_start) { in gfs2_control_func()
671 start_gen, block_gen, ls->ls_recover_block); in gfs2_control_func()
672 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
677 recover_size = ls->ls_recover_size; in gfs2_control_func()
690 if (ls->ls_recover_result[i] != LM_RD_SUCCESS) in gfs2_control_func()
693 ls->ls_recover_result[i] = 0; in gfs2_control_func()
695 if (!test_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET)) in gfs2_control_func()
698 __clear_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET); in gfs2_control_func()
708 if (!ls->ls_recover_submit[i]) in gfs2_control_func()
710 if (ls->ls_recover_submit[i] < lvb_gen) in gfs2_control_func()
711 ls->ls_recover_submit[i] = 0; in gfs2_control_func()
718 if (!ls->ls_recover_submit[i]) in gfs2_control_func()
720 if (ls->ls_recover_submit[i] < start_gen) { in gfs2_control_func()
721 ls->ls_recover_submit[i] = 0; in gfs2_control_func()
722 __set_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET); in gfs2_control_func()
733 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
736 control_lvb_write(ls, start_gen, ls->ls_lvb_bits); in gfs2_control_func()
756 if (test_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET)) { in gfs2_control_func()
772 spin_lock(&ls->ls_recover_spin); in gfs2_control_func()
773 if (ls->ls_recover_block == block_gen && in gfs2_control_func()
774 ls->ls_recover_start == start_gen) { in gfs2_control_func()
775 clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in gfs2_control_func()
776 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
781 start_gen, block_gen, ls->ls_recover_block); in gfs2_control_func()
782 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
788 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in control_mount() local
794 memset(&ls->ls_mounted_lksb, 0, sizeof(struct dlm_lksb)); in control_mount()
795 memset(&ls->ls_control_lksb, 0, sizeof(struct dlm_lksb)); in control_mount()
796 memset(&ls->ls_control_lvb, 0, GDLM_LVB_SIZE); in control_mount()
797 ls->ls_control_lksb.sb_lvbptr = ls->ls_control_lvb; in control_mount()
798 init_completion(&ls->ls_sync_wait); in control_mount()
800 set_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in control_mount()
894 control_lvb_read(ls, &lvb_gen, ls->ls_lvb_bits); in control_mount()
905 spin_lock(&ls->ls_recover_spin); in control_mount()
906 clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in control_mount()
907 set_bit(DFL_MOUNT_DONE, &ls->ls_recover_flags); in control_mount()
908 set_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags); in control_mount()
909 spin_unlock(&ls->ls_recover_spin); in control_mount()
924 if (!all_jid_bits_clear(ls->ls_lvb_bits)) { in control_mount()
930 spin_lock(&ls->ls_recover_spin); in control_mount()
931 block_gen = ls->ls_recover_block; in control_mount()
932 start_gen = ls->ls_recover_start; in control_mount()
933 mount_gen = ls->ls_recover_mount; in control_mount()
946 ls->ls_recover_flags); in control_mount()
948 spin_unlock(&ls->ls_recover_spin); in control_mount()
957 lvb_gen, ls->ls_recover_flags); in control_mount()
958 spin_unlock(&ls->ls_recover_spin); in control_mount()
966 lvb_gen, ls->ls_recover_flags); in control_mount()
967 spin_unlock(&ls->ls_recover_spin); in control_mount()
971 clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in control_mount()
972 set_bit(DFL_MOUNT_DONE, &ls->ls_recover_flags); in control_mount()
973 memset(ls->ls_recover_submit, 0, ls->ls_recover_size*sizeof(uint32_t)); in control_mount()
974 memset(ls->ls_recover_result, 0, ls->ls_recover_size*sizeof(uint32_t)); in control_mount()
975 spin_unlock(&ls->ls_recover_spin); in control_mount()
986 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in control_first_done() local
991 spin_lock(&ls->ls_recover_spin); in control_first_done()
992 start_gen = ls->ls_recover_start; in control_first_done()
993 block_gen = ls->ls_recover_block; in control_first_done()
995 if (test_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags) || in control_first_done()
996 !test_bit(DFL_MOUNT_DONE, &ls->ls_recover_flags) || in control_first_done()
997 !test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags)) { in control_first_done()
1000 start_gen, block_gen, ls->ls_recover_flags); in control_first_done()
1001 spin_unlock(&ls->ls_recover_spin); in control_first_done()
1014 spin_unlock(&ls->ls_recover_spin); in control_first_done()
1017 wait_on_bit(&ls->ls_recover_flags, DFL_DLM_RECOVERY, in control_first_done()
1022 clear_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags); in control_first_done()
1023 set_bit(DFL_FIRST_MOUNT_DONE, &ls->ls_recover_flags); in control_first_done()
1024 memset(ls->ls_recover_submit, 0, ls->ls_recover_size*sizeof(uint32_t)); in control_first_done()
1025 memset(ls->ls_recover_result, 0, ls->ls_recover_size*sizeof(uint32_t)); in control_first_done()
1026 spin_unlock(&ls->ls_recover_spin); in control_first_done()
1028 memset(ls->ls_lvb_bits, 0, GDLM_LVB_SIZE); in control_first_done()
1029 control_lvb_write(ls, start_gen, ls->ls_lvb_bits); in control_first_done()
1053 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in set_recover_size() local
1059 if (!ls->ls_lvb_bits) { in set_recover_size()
1060 ls->ls_lvb_bits = kzalloc(GDLM_LVB_SIZE, GFP_NOFS); in set_recover_size()
1061 if (!ls->ls_lvb_bits) in set_recover_size()
1071 old_size = ls->ls_recover_size; in set_recover_size()
1086 spin_lock(&ls->ls_recover_spin); in set_recover_size()
1087 memcpy(submit, ls->ls_recover_submit, old_size * sizeof(uint32_t)); in set_recover_size()
1088 memcpy(result, ls->ls_recover_result, old_size * sizeof(uint32_t)); in set_recover_size()
1089 kfree(ls->ls_recover_submit); in set_recover_size()
1090 kfree(ls->ls_recover_result); in set_recover_size()
1091 ls->ls_recover_submit = submit; in set_recover_size()
1092 ls->ls_recover_result = result; in set_recover_size()
1093 ls->ls_recover_size = new_size; in set_recover_size()
1094 spin_unlock(&ls->ls_recover_spin); in set_recover_size()
1098 static void free_recover_size(struct lm_lockstruct *ls) in free_recover_size() argument
1100 kfree(ls->ls_lvb_bits); in free_recover_size()
1101 kfree(ls->ls_recover_submit); in free_recover_size()
1102 kfree(ls->ls_recover_result); in free_recover_size()
1103 ls->ls_recover_submit = NULL; in free_recover_size()
1104 ls->ls_recover_result = NULL; in free_recover_size()
1105 ls->ls_recover_size = 0; in free_recover_size()
1106 ls->ls_lvb_bits = NULL; in free_recover_size()
1114 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_recover_prep() local
1120 spin_lock(&ls->ls_recover_spin); in gdlm_recover_prep()
1121 ls->ls_recover_block = ls->ls_recover_start; in gdlm_recover_prep()
1122 set_bit(DFL_DLM_RECOVERY, &ls->ls_recover_flags); in gdlm_recover_prep()
1124 if (!test_bit(DFL_MOUNT_DONE, &ls->ls_recover_flags) || in gdlm_recover_prep()
1125 test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags)) { in gdlm_recover_prep()
1126 spin_unlock(&ls->ls_recover_spin); in gdlm_recover_prep()
1129 set_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in gdlm_recover_prep()
1130 spin_unlock(&ls->ls_recover_spin); in gdlm_recover_prep()
1139 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_recover_slot() local
1147 spin_lock(&ls->ls_recover_spin); in gdlm_recover_slot()
1148 if (ls->ls_recover_size < jid + 1) { in gdlm_recover_slot()
1150 jid, ls->ls_recover_block, ls->ls_recover_size); in gdlm_recover_slot()
1151 spin_unlock(&ls->ls_recover_spin); in gdlm_recover_slot()
1155 if (ls->ls_recover_submit[jid]) { in gdlm_recover_slot()
1157 jid, ls->ls_recover_block, ls->ls_recover_submit[jid]); in gdlm_recover_slot()
1159 ls->ls_recover_submit[jid] = ls->ls_recover_block; in gdlm_recover_slot()
1160 spin_unlock(&ls->ls_recover_spin); in gdlm_recover_slot()
1169 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_recover_done() local
1175 /* ensure the ls jid arrays are large enough */ in gdlm_recover_done()
1178 spin_lock(&ls->ls_recover_spin); in gdlm_recover_done()
1179 ls->ls_recover_start = generation; in gdlm_recover_done()
1181 if (!ls->ls_recover_mount) { in gdlm_recover_done()
1182 ls->ls_recover_mount = generation; in gdlm_recover_done()
1183 ls->ls_jid = our_slot - 1; in gdlm_recover_done()
1186 if (!test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) in gdlm_recover_done()
1189 clear_bit(DFL_DLM_RECOVERY, &ls->ls_recover_flags); in gdlm_recover_done()
1191 wake_up_bit(&ls->ls_recover_flags, DFL_DLM_RECOVERY); in gdlm_recover_done()
1192 spin_unlock(&ls->ls_recover_spin); in gdlm_recover_done()
1200 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_recovery_result() local
1207 if (test_bit(DFL_NO_DLM_OPS, &ls->ls_recover_flags)) in gdlm_recovery_result()
1211 if (jid == ls->ls_jid) in gdlm_recovery_result()
1214 spin_lock(&ls->ls_recover_spin); in gdlm_recovery_result()
1215 if (test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags)) { in gdlm_recovery_result()
1216 spin_unlock(&ls->ls_recover_spin); in gdlm_recovery_result()
1219 if (ls->ls_recover_size < jid + 1) { in gdlm_recovery_result()
1221 jid, ls->ls_recover_size); in gdlm_recovery_result()
1222 spin_unlock(&ls->ls_recover_spin); in gdlm_recovery_result()
1229 ls->ls_recover_result[jid] = result; in gdlm_recovery_result()
1235 if (!test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) in gdlm_recovery_result()
1238 spin_unlock(&ls->ls_recover_spin); in gdlm_recovery_result()
1249 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_mount() local
1260 spin_lock_init(&ls->ls_recover_spin); in gdlm_mount()
1261 ls->ls_recover_flags = 0; in gdlm_mount()
1262 ls->ls_recover_mount = 0; in gdlm_mount()
1263 ls->ls_recover_start = 0; in gdlm_mount()
1264 ls->ls_recover_block = 0; in gdlm_mount()
1265 ls->ls_recover_size = 0; in gdlm_mount()
1266 ls->ls_recover_submit = NULL; in gdlm_mount()
1267 ls->ls_recover_result = NULL; in gdlm_mount()
1268 ls->ls_lvb_bits = NULL; in gdlm_mount()
1296 &ls->ls_dlm); in gdlm_mount()
1308 free_recover_size(ls); in gdlm_mount()
1309 set_bit(DFL_NO_DLM_OPS, &ls->ls_recover_flags); in gdlm_mount()
1330 ls->ls_first = !!test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags); in gdlm_mount()
1337 dlm_release_lockspace(ls->ls_dlm, 2); in gdlm_mount()
1339 free_recover_size(ls); in gdlm_mount()
1346 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_first_done() local
1349 if (test_bit(DFL_NO_DLM_OPS, &ls->ls_recover_flags)) in gdlm_first_done()
1359 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_unmount() local
1361 if (test_bit(DFL_NO_DLM_OPS, &ls->ls_recover_flags)) in gdlm_unmount()
1366 spin_lock(&ls->ls_recover_spin); in gdlm_unmount()
1367 set_bit(DFL_UNMOUNT, &ls->ls_recover_flags); in gdlm_unmount()
1368 spin_unlock(&ls->ls_recover_spin); in gdlm_unmount()
1373 if (ls->ls_dlm) { in gdlm_unmount()
1374 dlm_release_lockspace(ls->ls_dlm, 2); in gdlm_unmount()
1375 ls->ls_dlm = NULL; in gdlm_unmount()
1378 free_recover_size(ls); in gdlm_unmount()