Lines Matching refs:osb

49 static int ocfs2_recover_node(struct ocfs2_super *osb,
52 static int ocfs2_commit_cache(struct ocfs2_super *osb);
53 static int __ocfs2_wait_on_mount(struct ocfs2_super *osb, int quota);
54 static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
56 static int ocfs2_trylock_journal(struct ocfs2_super *osb,
58 static int ocfs2_recover_orphans(struct ocfs2_super *osb,
69 static inline int ocfs2_wait_on_mount(struct ocfs2_super *osb) in ocfs2_wait_on_mount() argument
71 return __ocfs2_wait_on_mount(osb, 0); in ocfs2_wait_on_mount()
74 static inline int ocfs2_wait_on_quotas(struct ocfs2_super *osb) in ocfs2_wait_on_quotas() argument
76 return __ocfs2_wait_on_mount(osb, 1); in ocfs2_wait_on_quotas()
96 static void ocfs2_replay_map_set_state(struct ocfs2_super *osb, int state) in ocfs2_replay_map_set_state() argument
98 if (!osb->replay_map) in ocfs2_replay_map_set_state()
102 if (osb->replay_map->rm_state == REPLAY_DONE) in ocfs2_replay_map_set_state()
105 osb->replay_map->rm_state = state; in ocfs2_replay_map_set_state()
108 int ocfs2_compute_replay_slots(struct ocfs2_super *osb) in ocfs2_compute_replay_slots() argument
114 if (osb->replay_map) in ocfs2_compute_replay_slots()
118 osb->max_slots), in ocfs2_compute_replay_slots()
125 spin_lock(&osb->osb_lock); in ocfs2_compute_replay_slots()
127 replay_map->rm_slots = osb->max_slots; in ocfs2_compute_replay_slots()
132 if (ocfs2_slot_to_node_num_locked(osb, i, &node_num) == -ENOENT) in ocfs2_compute_replay_slots()
136 osb->replay_map = replay_map; in ocfs2_compute_replay_slots()
137 spin_unlock(&osb->osb_lock); in ocfs2_compute_replay_slots()
141 static void ocfs2_queue_replay_slots(struct ocfs2_super *osb, in ocfs2_queue_replay_slots() argument
144 struct ocfs2_replay_map *replay_map = osb->replay_map; in ocfs2_queue_replay_slots()
155 ocfs2_queue_recovery_completion(osb->journal, i, NULL, in ocfs2_queue_replay_slots()
161 void ocfs2_free_replay_slots(struct ocfs2_super *osb) in ocfs2_free_replay_slots() argument
163 struct ocfs2_replay_map *replay_map = osb->replay_map; in ocfs2_free_replay_slots()
165 if (!osb->replay_map) in ocfs2_free_replay_slots()
169 osb->replay_map = NULL; in ocfs2_free_replay_slots()
172 int ocfs2_recovery_init(struct ocfs2_super *osb) in ocfs2_recovery_init() argument
176 mutex_init(&osb->recovery_lock); in ocfs2_recovery_init()
177 osb->disable_recovery = 0; in ocfs2_recovery_init()
178 osb->recovery_thread_task = NULL; in ocfs2_recovery_init()
179 init_waitqueue_head(&osb->recovery_event); in ocfs2_recovery_init()
181 rm = kzalloc(struct_size(rm, rm_entries, osb->max_slots), in ocfs2_recovery_init()
188 osb->recovery_map = rm; in ocfs2_recovery_init()
196 static int ocfs2_recovery_thread_running(struct ocfs2_super *osb) in ocfs2_recovery_thread_running() argument
199 return osb->recovery_thread_task != NULL; in ocfs2_recovery_thread_running()
202 void ocfs2_recovery_exit(struct ocfs2_super *osb) in ocfs2_recovery_exit() argument
208 mutex_lock(&osb->recovery_lock); in ocfs2_recovery_exit()
209 osb->disable_recovery = 1; in ocfs2_recovery_exit()
210 mutex_unlock(&osb->recovery_lock); in ocfs2_recovery_exit()
211 wait_event(osb->recovery_event, !ocfs2_recovery_thread_running(osb)); in ocfs2_recovery_exit()
216 if (osb->ocfs2_wq) in ocfs2_recovery_exit()
217 flush_workqueue(osb->ocfs2_wq); in ocfs2_recovery_exit()
223 rm = osb->recovery_map; in ocfs2_recovery_exit()
229 static int __ocfs2_recovery_map_test(struct ocfs2_super *osb, in __ocfs2_recovery_map_test() argument
233 struct ocfs2_recovery_map *rm = osb->recovery_map; in __ocfs2_recovery_map_test()
235 assert_spin_locked(&osb->osb_lock); in __ocfs2_recovery_map_test()
246 static int ocfs2_recovery_map_set(struct ocfs2_super *osb, in ocfs2_recovery_map_set() argument
249 struct ocfs2_recovery_map *rm = osb->recovery_map; in ocfs2_recovery_map_set()
251 spin_lock(&osb->osb_lock); in ocfs2_recovery_map_set()
252 if (__ocfs2_recovery_map_test(osb, node_num)) { in ocfs2_recovery_map_set()
253 spin_unlock(&osb->osb_lock); in ocfs2_recovery_map_set()
258 BUG_ON(rm->rm_used >= osb->max_slots); in ocfs2_recovery_map_set()
262 spin_unlock(&osb->osb_lock); in ocfs2_recovery_map_set()
267 static void ocfs2_recovery_map_clear(struct ocfs2_super *osb, in ocfs2_recovery_map_clear() argument
271 struct ocfs2_recovery_map *rm = osb->recovery_map; in ocfs2_recovery_map_clear()
273 spin_lock(&osb->osb_lock); in ocfs2_recovery_map_clear()
287 spin_unlock(&osb->osb_lock); in ocfs2_recovery_map_clear()
290 static int ocfs2_commit_cache(struct ocfs2_super *osb) in ocfs2_commit_cache() argument
296 journal = osb->journal; in ocfs2_commit_cache()
325 ocfs2_wake_downconvert_thread(osb); in ocfs2_commit_cache()
331 handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs) in ocfs2_start_trans() argument
333 journal_t *journal = osb->journal->j_journal; in ocfs2_start_trans()
336 BUG_ON(!osb || !osb->journal->j_journal); in ocfs2_start_trans()
338 if (ocfs2_is_hard_readonly(osb)) in ocfs2_start_trans()
341 BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE); in ocfs2_start_trans()
348 sb_start_intwrite(osb->sb); in ocfs2_start_trans()
350 down_read(&osb->journal->j_trans_barrier); in ocfs2_start_trans()
354 up_read(&osb->journal->j_trans_barrier); in ocfs2_start_trans()
355 sb_end_intwrite(osb->sb); in ocfs2_start_trans()
360 ocfs2_abort(osb->sb, "Detected aborted journal\n"); in ocfs2_start_trans()
364 if (!ocfs2_mount_local(osb)) in ocfs2_start_trans()
365 atomic_inc(&(osb->journal->j_num_trans)); in ocfs2_start_trans()
371 int ocfs2_commit_trans(struct ocfs2_super *osb, in ocfs2_commit_trans() argument
375 struct ocfs2_journal *journal = osb->journal; in ocfs2_commit_trans()
386 sb_end_intwrite(osb->sb); in ocfs2_commit_trans()
640 struct ocfs2_super *osb = in __ocfs2_journal_access() local
670 return ocfs2_error(osb->sb, "A previous attempt to " in __ocfs2_journal_access()
682 ocfs2_set_ci_lock_trans(osb->journal, ci); in __ocfs2_journal_access()
699 if (!status && ocfs2_meta_ecc(osb) && triggers) in __ocfs2_journal_access()
713 struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); in ocfs2_journal_access_di() local
716 &osb->s_journal_triggers[OCFS2_JTR_DI], in ocfs2_journal_access_di()
723 struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); in ocfs2_journal_access_eb() local
726 &osb->s_journal_triggers[OCFS2_JTR_EB], in ocfs2_journal_access_eb()
733 struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); in ocfs2_journal_access_rb() local
736 &osb->s_journal_triggers[OCFS2_JTR_RB], in ocfs2_journal_access_rb()
743 struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); in ocfs2_journal_access_gd() local
746 &osb->s_journal_triggers[OCFS2_JTR_GD], in ocfs2_journal_access_gd()
753 struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); in ocfs2_journal_access_db() local
756 &osb->s_journal_triggers[OCFS2_JTR_DB], in ocfs2_journal_access_db()
763 struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); in ocfs2_journal_access_xb() local
766 &osb->s_journal_triggers[OCFS2_JTR_XB], in ocfs2_journal_access_xb()
773 struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); in ocfs2_journal_access_dq() local
776 &osb->s_journal_triggers[OCFS2_JTR_DQ], in ocfs2_journal_access_dq()
783 struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); in ocfs2_journal_access_dr() local
786 &osb->s_journal_triggers[OCFS2_JTR_DR], in ocfs2_journal_access_dr()
793 struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); in ocfs2_journal_access_dl() local
796 &osb->s_journal_triggers[OCFS2_JTR_DL], in ocfs2_journal_access_dl()
833 void ocfs2_set_journal_params(struct ocfs2_super *osb) in ocfs2_set_journal_params() argument
835 journal_t *journal = osb->journal->j_journal; in ocfs2_set_journal_params()
838 if (osb->osb_commit_interval) in ocfs2_set_journal_params()
839 commit_interval = osb->osb_commit_interval; in ocfs2_set_journal_params()
843 if (osb->s_mount_opt & OCFS2_MOUNT_BARRIER) in ocfs2_set_journal_params()
854 int ocfs2_journal_alloc(struct ocfs2_super *osb) in ocfs2_journal_alloc() argument
865 osb->journal = journal; in ocfs2_journal_alloc()
866 journal->j_osb = osb; in ocfs2_journal_alloc()
894 int ocfs2_journal_init(struct ocfs2_super *osb, int *dirty) in ocfs2_journal_init() argument
899 struct ocfs2_journal *journal = osb->journal; in ocfs2_journal_init()
906 inode = ocfs2_get_system_file_inode(osb, JOURNAL_SYSTEM_INODE, in ocfs2_journal_init()
907 osb->slot_num); in ocfs2_journal_init()
969 ocfs2_set_journal_params(osb); in ocfs2_journal_init()
998 static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, in ocfs2_journal_toggle_dirty() argument
1003 struct ocfs2_journal *journal = osb->journal; in ocfs2_journal_toggle_dirty()
1024 ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &fe->i_check); in ocfs2_journal_toggle_dirty()
1025 status = ocfs2_write_block(osb, bh, INODE_CACHE(journal->j_inode)); in ocfs2_journal_toggle_dirty()
1036 void ocfs2_journal_shutdown(struct ocfs2_super *osb) in ocfs2_journal_shutdown() argument
1043 BUG_ON(!osb); in ocfs2_journal_shutdown()
1045 journal = osb->journal; in ocfs2_journal_shutdown()
1070 if (osb->commit_task) { in ocfs2_journal_shutdown()
1072 trace_ocfs2_journal_shutdown_wait(osb->commit_task); in ocfs2_journal_shutdown()
1073 kthread_stop(osb->commit_task); in ocfs2_journal_shutdown()
1074 osb->commit_task = NULL; in ocfs2_journal_shutdown()
1079 if (ocfs2_mount_local(osb) && in ocfs2_journal_shutdown()
1094 status = ocfs2_journal_toggle_dirty(osb, 0, 0); in ocfs2_journal_shutdown()
1113 osb->journal = NULL; in ocfs2_journal_shutdown()
1137 struct ocfs2_super *osb; in ocfs2_journal_load() local
1141 osb = journal->j_osb; in ocfs2_journal_load()
1149 ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num); in ocfs2_journal_load()
1159 status = ocfs2_journal_toggle_dirty(osb, 1, replayed); in ocfs2_journal_load()
1167 osb->commit_task = kthread_run(ocfs2_commit_thread, osb, in ocfs2_journal_load()
1168 "ocfs2cmt-%s", osb->uuid_str); in ocfs2_journal_load()
1169 if (IS_ERR(osb->commit_task)) { in ocfs2_journal_load()
1170 status = PTR_ERR(osb->commit_task); in ocfs2_journal_load()
1171 osb->commit_task = NULL; in ocfs2_journal_load()
1177 osb->commit_task = NULL; in ocfs2_journal_load()
1206 static int ocfs2_recovery_completed(struct ocfs2_super *osb) in ocfs2_recovery_completed() argument
1209 struct ocfs2_recovery_map *rm = osb->recovery_map; in ocfs2_recovery_completed()
1211 spin_lock(&osb->osb_lock); in ocfs2_recovery_completed()
1213 spin_unlock(&osb->osb_lock); in ocfs2_recovery_completed()
1218 void ocfs2_wait_for_recovery(struct ocfs2_super *osb) in ocfs2_wait_for_recovery() argument
1220 wait_event(osb->recovery_event, ocfs2_recovery_completed(osb)); in ocfs2_wait_for_recovery()
1239 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_force_read_journal() local
1252 bh = __find_get_block(osb->sb->s_bdev, p_blkno, in ocfs2_force_read_journal()
1253 osb->sb->s_blocksize); in ocfs2_force_read_journal()
1263 status = ocfs2_read_blocks_sync(osb, p_blkno, 1, &bh); in ocfs2_force_read_journal()
1304 struct ocfs2_super *osb = journal->j_osb; in ocfs2_complete_recovery() local
1321 ocfs2_wait_on_quotas(osb); in ocfs2_complete_recovery()
1334 ret = ocfs2_complete_local_alloc_recovery(osb, in ocfs2_complete_recovery()
1343 ret = ocfs2_complete_truncate_log_recovery(osb, in ocfs2_complete_recovery()
1351 ret = ocfs2_recover_orphans(osb, item->lri_slot, in ocfs2_complete_recovery()
1357 ret = ocfs2_finish_quota_recovery(osb, qrec, in ocfs2_complete_recovery()
1412 void ocfs2_complete_mount_recovery(struct ocfs2_super *osb) in ocfs2_complete_mount_recovery() argument
1414 struct ocfs2_journal *journal = osb->journal; in ocfs2_complete_mount_recovery()
1416 if (ocfs2_is_hard_readonly(osb)) in ocfs2_complete_mount_recovery()
1421 ocfs2_queue_recovery_completion(journal, osb->slot_num, in ocfs2_complete_mount_recovery()
1422 osb->local_alloc_copy, NULL, NULL, in ocfs2_complete_mount_recovery()
1424 ocfs2_schedule_truncate_log_flush(osb, 0); in ocfs2_complete_mount_recovery()
1426 osb->local_alloc_copy = NULL; in ocfs2_complete_mount_recovery()
1429 ocfs2_replay_map_set_state(osb, REPLAY_NEEDED); in ocfs2_complete_mount_recovery()
1430 ocfs2_queue_replay_slots(osb, ORPHAN_NEED_TRUNCATE); in ocfs2_complete_mount_recovery()
1431 ocfs2_free_replay_slots(osb); in ocfs2_complete_mount_recovery()
1434 void ocfs2_complete_quota_recovery(struct ocfs2_super *osb) in ocfs2_complete_quota_recovery() argument
1436 if (osb->quota_rec) { in ocfs2_complete_quota_recovery()
1437 ocfs2_queue_recovery_completion(osb->journal, in ocfs2_complete_quota_recovery()
1438 osb->slot_num, in ocfs2_complete_quota_recovery()
1441 osb->quota_rec, in ocfs2_complete_quota_recovery()
1443 osb->quota_rec = NULL; in ocfs2_complete_quota_recovery()
1450 struct ocfs2_super *osb = arg; in __ocfs2_recovery_thread() local
1451 struct ocfs2_recovery_map *rm = osb->recovery_map; in __ocfs2_recovery_thread()
1457 int quota_enabled = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, in __ocfs2_recovery_thread()
1459 || OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, in __ocfs2_recovery_thread()
1462 status = ocfs2_wait_on_mount(osb); in __ocfs2_recovery_thread()
1468 rm_quota = kcalloc(osb->max_slots, sizeof(int), GFP_NOFS); in __ocfs2_recovery_thread()
1475 status = ocfs2_super_lock(osb, 1); in __ocfs2_recovery_thread()
1481 status = ocfs2_compute_replay_slots(osb); in __ocfs2_recovery_thread()
1486 ocfs2_queue_recovery_completion(osb->journal, osb->slot_num, NULL, in __ocfs2_recovery_thread()
1489 spin_lock(&osb->osb_lock); in __ocfs2_recovery_thread()
1494 spin_unlock(&osb->osb_lock); in __ocfs2_recovery_thread()
1495 slot_num = ocfs2_node_num_to_slot(osb, node_num); in __ocfs2_recovery_thread()
1517 status = ocfs2_recover_node(osb, node_num, slot_num); in __ocfs2_recovery_thread()
1520 ocfs2_recovery_map_clear(osb, node_num); in __ocfs2_recovery_thread()
1525 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); in __ocfs2_recovery_thread()
1529 spin_lock(&osb->osb_lock); in __ocfs2_recovery_thread()
1531 spin_unlock(&osb->osb_lock); in __ocfs2_recovery_thread()
1535 status = ocfs2_check_journals_nolocks(osb); in __ocfs2_recovery_thread()
1545 qrec = ocfs2_begin_quota_recovery(osb, rm_quota[i]); in __ocfs2_recovery_thread()
1551 ocfs2_queue_recovery_completion(osb->journal, in __ocfs2_recovery_thread()
1558 ocfs2_super_unlock(osb, 1); in __ocfs2_recovery_thread()
1561 ocfs2_queue_replay_slots(osb, ORPHAN_NEED_TRUNCATE); in __ocfs2_recovery_thread()
1564 mutex_lock(&osb->recovery_lock); in __ocfs2_recovery_thread()
1565 if (!status && !ocfs2_recovery_completed(osb)) { in __ocfs2_recovery_thread()
1566 mutex_unlock(&osb->recovery_lock); in __ocfs2_recovery_thread()
1570 ocfs2_free_replay_slots(osb); in __ocfs2_recovery_thread()
1571 osb->recovery_thread_task = NULL; in __ocfs2_recovery_thread()
1573 wake_up(&osb->recovery_event); in __ocfs2_recovery_thread()
1575 mutex_unlock(&osb->recovery_lock); in __ocfs2_recovery_thread()
1583 void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num) in ocfs2_recovery_thread() argument
1585 mutex_lock(&osb->recovery_lock); in ocfs2_recovery_thread()
1587 trace_ocfs2_recovery_thread(node_num, osb->node_num, in ocfs2_recovery_thread()
1588 osb->disable_recovery, osb->recovery_thread_task, in ocfs2_recovery_thread()
1589 osb->disable_recovery ? in ocfs2_recovery_thread()
1590 -1 : ocfs2_recovery_map_set(osb, node_num)); in ocfs2_recovery_thread()
1592 if (osb->disable_recovery) in ocfs2_recovery_thread()
1595 if (osb->recovery_thread_task) in ocfs2_recovery_thread()
1598 osb->recovery_thread_task = kthread_run(__ocfs2_recovery_thread, osb, in ocfs2_recovery_thread()
1599 "ocfs2rec-%s", osb->uuid_str); in ocfs2_recovery_thread()
1600 if (IS_ERR(osb->recovery_thread_task)) { in ocfs2_recovery_thread()
1601 mlog_errno((int)PTR_ERR(osb->recovery_thread_task)); in ocfs2_recovery_thread()
1602 osb->recovery_thread_task = NULL; in ocfs2_recovery_thread()
1606 mutex_unlock(&osb->recovery_lock); in ocfs2_recovery_thread()
1607 wake_up(&osb->recovery_event); in ocfs2_recovery_thread()
1610 static int ocfs2_read_journal_inode(struct ocfs2_super *osb, in ocfs2_read_journal_inode() argument
1618 BUG_ON(slot_num >= osb->max_slots); in ocfs2_read_journal_inode()
1620 inode = ocfs2_get_system_file_inode(osb, JOURNAL_SYSTEM_INODE, in ocfs2_read_journal_inode()
1648 static int ocfs2_replay_journal(struct ocfs2_super *osb, in ocfs2_replay_journal() argument
1661 status = ocfs2_read_journal_inode(osb, slot_num, &bh, &inode); in ocfs2_replay_journal()
1680 if (osb->slot_recovery_generations[slot_num] != slot_reco_gen) { in ocfs2_replay_journal()
1682 osb->slot_recovery_generations[slot_num], slot_reco_gen); in ocfs2_replay_journal()
1683 osb->slot_recovery_generations[slot_num] = slot_reco_gen; in ocfs2_replay_journal()
1707 osb->slot_recovery_generations[slot_num] = slot_reco_gen; in ocfs2_replay_journal()
1712 ocfs2_replay_map_set_state(osb, REPLAY_NEEDED); in ocfs2_replay_journal()
1715 "device (%u,%u)\n", node_num, slot_num, MAJOR(osb->sb->s_dev), in ocfs2_replay_journal()
1716 MINOR(osb->sb->s_dev)); in ocfs2_replay_journal()
1741 ocfs2_clear_journal_error(osb->sb, journal, slot_num); in ocfs2_replay_journal()
1757 osb->slot_recovery_generations[slot_num] = in ocfs2_replay_journal()
1760 ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &fe->i_check); in ocfs2_replay_journal()
1761 status = ocfs2_write_block(osb, bh, INODE_CACHE(inode)); in ocfs2_replay_journal()
1770 "device (%u,%u)\n", node_num, slot_num, MAJOR(osb->sb->s_dev), in ocfs2_replay_journal()
1771 MINOR(osb->sb->s_dev)); in ocfs2_replay_journal()
1795 static int ocfs2_recover_node(struct ocfs2_super *osb, in ocfs2_recover_node() argument
1802 trace_ocfs2_recover_node(node_num, slot_num, osb->node_num); in ocfs2_recover_node()
1806 BUG_ON(osb->node_num == node_num); in ocfs2_recover_node()
1808 status = ocfs2_replay_journal(osb, node_num, slot_num); in ocfs2_recover_node()
1820 status = ocfs2_begin_local_alloc_recovery(osb, slot_num, &la_copy); in ocfs2_recover_node()
1829 status = ocfs2_begin_truncate_log_recovery(osb, slot_num, &tl_copy); in ocfs2_recover_node()
1835 status = ocfs2_clear_slot(osb, slot_num); in ocfs2_recover_node()
1840 ocfs2_queue_recovery_completion(osb->journal, slot_num, la_copy, in ocfs2_recover_node()
1852 static int ocfs2_trylock_journal(struct ocfs2_super *osb, in ocfs2_trylock_journal() argument
1858 inode = ocfs2_get_system_file_inode(osb, JOURNAL_SYSTEM_INODE, in ocfs2_trylock_journal()
1891 int ocfs2_mark_dead_nodes(struct ocfs2_super *osb) in ocfs2_mark_dead_nodes() argument
1902 for (i = 0; i < osb->max_slots; i++) { in ocfs2_mark_dead_nodes()
1904 status = ocfs2_read_journal_inode(osb, i, &bh, NULL); in ocfs2_mark_dead_nodes()
1914 spin_lock(&osb->osb_lock); in ocfs2_mark_dead_nodes()
1915 osb->slot_recovery_generations[i] = gen; in ocfs2_mark_dead_nodes()
1918 osb->slot_recovery_generations[i]); in ocfs2_mark_dead_nodes()
1920 if (i == osb->slot_num) { in ocfs2_mark_dead_nodes()
1921 spin_unlock(&osb->osb_lock); in ocfs2_mark_dead_nodes()
1925 status = ocfs2_slot_to_node_num_locked(osb, i, &node_num); in ocfs2_mark_dead_nodes()
1927 spin_unlock(&osb->osb_lock); in ocfs2_mark_dead_nodes()
1931 if (__ocfs2_recovery_map_test(osb, node_num)) { in ocfs2_mark_dead_nodes()
1932 spin_unlock(&osb->osb_lock); in ocfs2_mark_dead_nodes()
1935 spin_unlock(&osb->osb_lock); in ocfs2_mark_dead_nodes()
1940 status = ocfs2_trylock_journal(osb, i); in ocfs2_mark_dead_nodes()
1945 ocfs2_recovery_thread(osb, node_num); in ocfs2_mark_dead_nodes()
1998 static void ocfs2_queue_orphan_scan(struct ocfs2_super *osb) in ocfs2_queue_orphan_scan() argument
2004 os = &osb->osb_orphan_scan; in ocfs2_queue_orphan_scan()
2012 status = ocfs2_orphan_scan_lock(osb, &seqno); in ocfs2_queue_orphan_scan()
2028 for (i = 0; i < osb->max_slots; i++) in ocfs2_queue_orphan_scan()
2029 ocfs2_queue_recovery_completion(osb->journal, i, NULL, NULL, in ocfs2_queue_orphan_scan()
2039 ocfs2_orphan_scan_unlock(osb, seqno); in ocfs2_queue_orphan_scan()
2050 struct ocfs2_super *osb; in ocfs2_orphan_scan_work() local
2054 osb = os->os_osb; in ocfs2_orphan_scan_work()
2057 ocfs2_queue_orphan_scan(osb); in ocfs2_orphan_scan_work()
2059 queue_delayed_work(osb->ocfs2_wq, &os->os_orphan_scan_work, in ocfs2_orphan_scan_work()
2064 void ocfs2_orphan_scan_stop(struct ocfs2_super *osb) in ocfs2_orphan_scan_stop() argument
2068 os = &osb->osb_orphan_scan; in ocfs2_orphan_scan_stop()
2077 void ocfs2_orphan_scan_init(struct ocfs2_super *osb) in ocfs2_orphan_scan_init() argument
2081 os = &osb->osb_orphan_scan; in ocfs2_orphan_scan_init()
2082 os->os_osb = osb; in ocfs2_orphan_scan_init()
2089 void ocfs2_orphan_scan_start(struct ocfs2_super *osb) in ocfs2_orphan_scan_start() argument
2093 os = &osb->osb_orphan_scan; in ocfs2_orphan_scan_start()
2095 if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb)) in ocfs2_orphan_scan_start()
2099 queue_delayed_work(osb->ocfs2_wq, &os->os_orphan_scan_work, in ocfs2_orphan_scan_start()
2107 struct ocfs2_super *osb; member
2131 iter = ocfs2_iget(p->osb, ino, in ocfs2_orphan_filldir()
2156 static int ocfs2_queue_orphans(struct ocfs2_super *osb, in ocfs2_queue_orphans() argument
2165 .osb = osb, in ocfs2_queue_orphans()
2170 orphan_dir_inode = ocfs2_get_system_file_inode(osb, in ocfs2_queue_orphans()
2202 static int ocfs2_orphan_recovery_can_continue(struct ocfs2_super *osb, in ocfs2_orphan_recovery_can_continue() argument
2207 spin_lock(&osb->osb_lock); in ocfs2_orphan_recovery_can_continue()
2208 ret = !osb->osb_orphan_wipes[slot]; in ocfs2_orphan_recovery_can_continue()
2209 spin_unlock(&osb->osb_lock); in ocfs2_orphan_recovery_can_continue()
2213 static void ocfs2_mark_recovering_orphan_dir(struct ocfs2_super *osb, in ocfs2_mark_recovering_orphan_dir() argument
2216 spin_lock(&osb->osb_lock); in ocfs2_mark_recovering_orphan_dir()
2219 ocfs2_node_map_set_bit(osb, &osb->osb_recovering_orphan_dirs, slot); in ocfs2_mark_recovering_orphan_dir()
2220 while (osb->osb_orphan_wipes[slot]) { in ocfs2_mark_recovering_orphan_dir()
2224 spin_unlock(&osb->osb_lock); in ocfs2_mark_recovering_orphan_dir()
2225 wait_event_interruptible(osb->osb_wipe_event, in ocfs2_mark_recovering_orphan_dir()
2226 ocfs2_orphan_recovery_can_continue(osb, slot)); in ocfs2_mark_recovering_orphan_dir()
2227 spin_lock(&osb->osb_lock); in ocfs2_mark_recovering_orphan_dir()
2229 spin_unlock(&osb->osb_lock); in ocfs2_mark_recovering_orphan_dir()
2232 static void ocfs2_clear_recovering_orphan_dir(struct ocfs2_super *osb, in ocfs2_clear_recovering_orphan_dir() argument
2235 ocfs2_node_map_clear_bit(osb, &osb->osb_recovering_orphan_dirs, slot); in ocfs2_clear_recovering_orphan_dir()
2256 static int ocfs2_recover_orphans(struct ocfs2_super *osb, in ocfs2_recover_orphans() argument
2269 ocfs2_mark_recovering_orphan_dir(osb, slot); in ocfs2_recover_orphans()
2270 ret = ocfs2_queue_orphans(osb, slot, &inode, orphan_reco_type); in ocfs2_recover_orphans()
2271 ocfs2_clear_recovering_orphan_dir(osb, slot); in ocfs2_recover_orphans()
2314 ret = ocfs2_del_inode_from_orphan(osb, inode, in ocfs2_recover_orphans()
2345 static int __ocfs2_wait_on_mount(struct ocfs2_super *osb, int quota) in __ocfs2_wait_on_mount() argument
2350 wait_event(osb->osb_mount_event, in __ocfs2_wait_on_mount()
2351 (!quota && atomic_read(&osb->vol_state) == VOLUME_MOUNTED) || in __ocfs2_wait_on_mount()
2352 atomic_read(&osb->vol_state) == VOLUME_MOUNTED_QUOTAS || in __ocfs2_wait_on_mount()
2353 atomic_read(&osb->vol_state) == VOLUME_DISABLED); in __ocfs2_wait_on_mount()
2358 if (atomic_read(&osb->vol_state) == VOLUME_DISABLED) { in __ocfs2_wait_on_mount()
2370 struct ocfs2_super *osb = arg; in ocfs2_commit_thread() local
2371 struct ocfs2_journal *journal = osb->journal; in ocfs2_commit_thread()
2380 wait_event_interruptible(osb->checkpoint_event, in ocfs2_commit_thread()
2384 status = ocfs2_commit_cache(osb); in ocfs2_commit_thread()
2416 int ocfs2_check_journals_nolocks(struct ocfs2_super *osb) in ocfs2_check_journals_nolocks() argument
2424 for(slot = 0; slot < osb->max_slots; slot++) { in ocfs2_check_journals_nolocks()
2425 ret = ocfs2_read_journal_inode(osb, slot, &di_bh, NULL); in ocfs2_check_journals_nolocks()
2433 osb->slot_recovery_generations[slot] = in ocfs2_check_journals_nolocks()