1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _BCACHEFS_RECOVERY_PASSES_TYPES_H 3 #define _BCACHEFS_RECOVERY_PASSES_TYPES_H 4 5 #define PASS_SILENT BIT(0) 6 #define PASS_FSCK BIT(1) 7 #define PASS_UNCLEAN BIT(2) 8 #define PASS_ALWAYS BIT(3) 9 #define PASS_ONLINE BIT(4) 10 11 #ifdef CONFIG_BCACHEFS_DEBUG 12 #define PASS_FSCK_DEBUG BIT(1) 13 #else 14 #define PASS_FSCK_DEBUG 0 15 #endif 16 17 /* 18 * Passes may be reordered, but the second field is a persistent identifier and 19 * must never change: 20 */ 21 #define BCH_RECOVERY_PASSES() \ 22 x(recovery_pass_empty, 41, PASS_SILENT) \ 23 x(scan_for_btree_nodes, 37, 0) \ 24 x(check_topology, 4, 0) \ 25 x(accounting_read, 39, PASS_ALWAYS) \ 26 x(alloc_read, 0, PASS_ALWAYS) \ 27 x(stripes_read, 1, PASS_ALWAYS) \ 28 x(initialize_subvolumes, 2, 0) \ 29 x(snapshots_read, 3, PASS_ALWAYS) \ 30 x(check_allocations, 5, PASS_FSCK) \ 31 x(trans_mark_dev_sbs, 6, PASS_ALWAYS|PASS_SILENT) \ 32 x(fs_journal_alloc, 7, PASS_ALWAYS|PASS_SILENT) \ 33 x(set_may_go_rw, 8, PASS_ALWAYS|PASS_SILENT) \ 34 x(journal_replay, 9, PASS_ALWAYS) \ 35 x(check_alloc_info, 10, PASS_ONLINE|PASS_FSCK) \ 36 x(check_lrus, 11, PASS_ONLINE|PASS_FSCK) \ 37 x(check_btree_backpointers, 12, PASS_ONLINE|PASS_FSCK) \ 38 x(check_backpointers_to_extents, 13, PASS_ONLINE|PASS_FSCK_DEBUG) \ 39 x(check_extents_to_backpointers, 14, PASS_ONLINE|PASS_FSCK) \ 40 x(check_alloc_to_lru_refs, 15, PASS_ONLINE|PASS_FSCK) \ 41 x(fs_freespace_init, 16, PASS_ALWAYS|PASS_SILENT) \ 42 x(bucket_gens_init, 17, 0) \ 43 x(reconstruct_snapshots, 38, 0) \ 44 x(check_snapshot_trees, 18, PASS_ONLINE|PASS_FSCK) \ 45 x(check_snapshots, 19, PASS_ONLINE|PASS_FSCK) \ 46 x(check_subvols, 20, PASS_ONLINE|PASS_FSCK) \ 47 x(check_subvol_children, 35, PASS_ONLINE|PASS_FSCK) \ 48 x(delete_dead_snapshots, 21, PASS_ONLINE|PASS_FSCK) \ 49 x(fs_upgrade_for_subvolumes, 22, 0) \ 50 x(check_inodes, 24, PASS_FSCK) \ 51 x(check_extents, 25, PASS_FSCK) \ 52 x(check_indirect_extents, 26, PASS_ONLINE|PASS_FSCK) \ 53 x(check_dirents, 27, PASS_FSCK) \ 54 x(check_xattrs, 28, PASS_FSCK) \ 55 x(check_root, 29, PASS_ONLINE|PASS_FSCK) \ 56 x(check_unreachable_inodes, 40, PASS_FSCK) \ 57 x(check_subvolume_structure, 36, PASS_ONLINE|PASS_FSCK) \ 58 x(check_directory_structure, 30, PASS_ONLINE|PASS_FSCK) \ 59 x(check_nlinks, 31, PASS_FSCK) \ 60 x(resume_logged_ops, 23, PASS_ALWAYS) \ 61 x(delete_dead_inodes, 32, PASS_ALWAYS) \ 62 x(fix_reflink_p, 33, 0) \ 63 x(set_fs_needs_rebalance, 34, 0) 64 65 /* We normally enumerate recovery passes in the order we run them: */ 66 enum bch_recovery_pass { 67 #define x(n, id, when) BCH_RECOVERY_PASS_##n, 68 BCH_RECOVERY_PASSES() 69 #undef x 70 BCH_RECOVERY_PASS_NR 71 }; 72 73 /* But we also need stable identifiers that can be used in the superblock */ 74 enum bch_recovery_pass_stable { 75 #define x(n, id, when) BCH_RECOVERY_PASS_STABLE_##n = id, 76 BCH_RECOVERY_PASSES() 77 #undef x 78 }; 79 80 #endif /* _BCACHEFS_RECOVERY_PASSES_TYPES_H */ 81