Lines Matching refs:mres
71 static void dlm_init_migratable_lockres(struct dlm_migratable_lockres *mres,
76 struct dlm_migratable_lockres *mres,
82 struct dlm_migratable_lockres *mres);
867 struct dlm_migratable_lockres *mres; in dlm_request_all_locks_worker() local
878 mres = (struct dlm_migratable_lockres *)data; in dlm_request_all_locks_worker()
915 ret = dlm_send_one_lockres(dlm, res, mres, reco_master, in dlm_request_all_locks_worker()
1095 struct dlm_migratable_lockres *mres, in dlm_send_mig_lockres_msg() argument
1100 u64 mig_cookie = be64_to_cpu(mres->mig_cookie); in dlm_send_mig_lockres_msg()
1101 int mres_total_locks = be32_to_cpu(mres->total_locks); in dlm_send_mig_lockres_msg()
1103 u8 orig_flags = mres->flags, in dlm_send_mig_lockres_msg()
1104 orig_master = mres->master; in dlm_send_mig_lockres_msg()
1106 BUG_ON(mres->num_locks > DLM_MAX_MIGRATABLE_LOCKS); in dlm_send_mig_lockres_msg()
1107 if (!mres->num_locks) in dlm_send_mig_lockres_msg()
1111 (mres->num_locks * sizeof(struct dlm_migratable_lock)); in dlm_send_mig_lockres_msg()
1114 orig_flags = mres->flags; in dlm_send_mig_lockres_msg()
1117 mres->flags |= DLM_MRES_ALL_DONE; in dlm_send_mig_lockres_msg()
1125 ret = o2net_send_message(DLM_MIG_LOCKRES_MSG, dlm->key, mres, in dlm_send_mig_lockres_msg()
1148 dlm_init_migratable_lockres(mres, res->lockname.name, in dlm_send_mig_lockres_msg()
1154 static void dlm_init_migratable_lockres(struct dlm_migratable_lockres *mres, in dlm_init_migratable_lockres() argument
1160 clear_page(mres); in dlm_init_migratable_lockres()
1161 mres->lockname_len = namelen; in dlm_init_migratable_lockres()
1162 memcpy(mres->lockname, lockname, namelen); in dlm_init_migratable_lockres()
1163 mres->num_locks = 0; in dlm_init_migratable_lockres()
1164 mres->total_locks = cpu_to_be32(total_locks); in dlm_init_migratable_lockres()
1165 mres->mig_cookie = cpu_to_be64(cookie); in dlm_init_migratable_lockres()
1166 mres->flags = flags; in dlm_init_migratable_lockres()
1167 mres->master = master; in dlm_init_migratable_lockres()
1171 struct dlm_migratable_lockres *mres, in dlm_prepare_lvb_for_migration() argument
1185 if (dlm_lvb_is_empty(mres->lvb)) { in dlm_prepare_lvb_for_migration()
1186 memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN); in dlm_prepare_lvb_for_migration()
1191 if (!memcmp(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN)) in dlm_prepare_lvb_for_migration()
1207 struct dlm_migratable_lockres *mres, int queue) in dlm_add_lock_to_array() argument
1210 int lock_num = mres->num_locks; in dlm_add_lock_to_array()
1212 ml = &(mres->ml[lock_num]); in dlm_add_lock_to_array()
1220 dlm_prepare_lvb_for_migration(lock, mres, queue); in dlm_add_lock_to_array()
1223 mres->num_locks++; in dlm_add_lock_to_array()
1225 if (mres->num_locks == DLM_MAX_MIGRATABLE_LOCKS) in dlm_add_lock_to_array()
1231 struct dlm_migratable_lockres *mres) in dlm_add_dummy_lock() argument
1241 dlm_add_lock_to_array(&dummy, mres, DLM_BLOCKED_LIST); in dlm_add_dummy_lock()
1260 struct dlm_migratable_lockres *mres, in dlm_send_one_lockres() argument
1282 dlm_init_migratable_lockres(mres, res->lockname.name, in dlm_send_one_lockres()
1292 if (!dlm_add_lock_to_array(lock, mres, i)) in dlm_send_one_lockres()
1297 ret = dlm_send_mig_lockres_msg(dlm, mres, send_to, in dlm_send_one_lockres()
1309 dlm_add_dummy_lock(dlm, mres); in dlm_send_one_lockres()
1312 ret = dlm_send_mig_lockres_msg(dlm, mres, send_to, res, total_locks); in dlm_send_one_lockres()
1348 struct dlm_migratable_lockres *mres = in dlm_mig_lockres_handler() local
1360 BUG_ON(!(mres->flags & (DLM_MRES_RECOVERY|DLM_MRES_MIGRATION))); in dlm_mig_lockres_handler()
1362 real_master = mres->master; in dlm_mig_lockres_handler()
1365 BUG_ON(!(mres->flags & DLM_MRES_RECOVERY)); in dlm_mig_lockres_handler()
1369 (mres->flags & DLM_MRES_RECOVERY) ? in dlm_mig_lockres_handler()
1370 "recovery" : "migration", mres->master); in dlm_mig_lockres_handler()
1371 if (mres->flags & DLM_MRES_ALL_DONE) in dlm_mig_lockres_handler()
1383 res = dlm_lookup_lockres(dlm, mres->lockname, mres->lockname_len); in dlm_mig_lockres_handler()
1388 if (mres->flags & DLM_MRES_RECOVERY) { in dlm_mig_lockres_handler()
1395 mres->lockname_len, in dlm_mig_lockres_handler()
1396 mres->lockname); in dlm_mig_lockres_handler()
1401 mres->lockname_len, mres->lockname); in dlm_mig_lockres_handler()
1412 res = dlm_new_lockres(dlm, mres->lockname, mres->lockname_len); in dlm_mig_lockres_handler()
1421 if (mres->flags & DLM_MRES_RECOVERY) in dlm_mig_lockres_handler()
1462 if (mres->master == DLM_LOCK_RES_OWNER_UNKNOWN) { in dlm_mig_lockres_handler()
1464 BUG_ON(!(mres->flags & DLM_MRES_RECOVERY)); in dlm_mig_lockres_handler()
1467 "%.*s\n", mres->lockname_len, mres->lockname); in dlm_mig_lockres_handler()
1508 struct dlm_migratable_lockres *mres; in dlm_mig_lockres_worker() local
1515 mres = (struct dlm_migratable_lockres *)data; in dlm_mig_lockres_worker()
1548 ret = dlm_process_recovery_data(dlm, res, mres); in dlm_mig_lockres_worker()
1554 if ((mres->flags & (DLM_MRES_MIGRATION|DLM_MRES_ALL_DONE)) == in dlm_mig_lockres_worker()
1556 ret = dlm_finish_migration(dlm, res, mres->master); in dlm_mig_lockres_worker()
1745 struct dlm_migratable_lockres *mres) in dlm_process_recovery_data() argument
1759 mlog(0, "running %d locks for this lockres\n", mres->num_locks); in dlm_process_recovery_data()
1760 for (i=0; i<mres->num_locks; i++) { in dlm_process_recovery_data()
1761 ml = &(mres->ml[i]); in dlm_process_recovery_data()
1765 BUG_ON(mres->num_locks != 1); in dlm_process_recovery_data()
1767 dlm->name, mres->lockname_len, mres->lockname, in dlm_process_recovery_data()
1787 BUG_ON(!(mres->flags & DLM_MRES_MIGRATION)); in dlm_process_recovery_data()
1884 if (!dlm_lvb_is_empty(mres->lvb)) { in dlm_process_recovery_data()
1889 memcpy(lksb->lvb, mres->lvb, DLM_LVB_LEN); in dlm_process_recovery_data()
1894 memcpy(res->lvb, mres->lvb, DLM_LVB_LEN); in dlm_process_recovery_data()
1902 memcmp(res->lvb, mres->lvb, DLM_LVB_LEN))) { in dlm_process_recovery_data()
1913 printk("%02x", mres->lvb[i]); in dlm_process_recovery_data()
1918 memcpy(res->lvb, mres->lvb, DLM_LVB_LEN); in dlm_process_recovery_data()