|
47 | 47 | #define DROP_PREV_NODE 11
|
48 | 48 | #define DID_FILL_FROM_SCAN 12
|
49 | 49 |
|
| 50 | +/* |
| 51 | + * Returns true if it's a btree we can easily reconstruct, or otherwise won't |
| 52 | + * cause data loss if it's missing: |
| 53 | + */ |
| 54 | +static bool btree_id_important(enum btree_id btree) |
| 55 | +{ |
| 56 | + if (btree_id_is_alloc(btree)) |
| 57 | + return false; |
| 58 | + |
| 59 | + switch (btree) { |
| 60 | + case BTREE_ID_quotas: |
| 61 | + case BTREE_ID_snapshot_trees: |
| 62 | + case BTREE_ID_logged_ops: |
| 63 | + case BTREE_ID_rebalance_work: |
| 64 | + case BTREE_ID_subvolume_children: |
| 65 | + return false; |
| 66 | + default: |
| 67 | + return true; |
| 68 | + } |
| 69 | +} |
| 70 | + |
50 | 71 | static const char * const bch2_gc_phase_strs[] = {
|
51 | 72 | #define x(n) #n,
|
52 | 73 | GC_PHASES()
|
@@ -534,8 +555,10 @@ int bch2_check_topology(struct bch_fs *c)
|
534 | 555 | r->error = 0;
|
535 | 556 |
|
536 | 557 | if (!bch2_btree_has_scanned_nodes(c, i)) {
|
537 |
| - mustfix_fsck_err(trans, btree_root_unreadable_and_scan_found_nothing, |
538 |
| - "no nodes found for btree %s, continue?", buf.buf); |
| 558 | + __fsck_err(trans, |
| 559 | + FSCK_CAN_FIX|(!btree_id_important(i) ? FSCK_AUTOFIX : 0), |
| 560 | + btree_root_unreadable_and_scan_found_nothing, |
| 561 | + "no nodes found for btree %s, continue?", buf.buf); |
539 | 562 | bch2_btree_root_alloc_fake_trans(trans, i, 0);
|
540 | 563 | } else {
|
541 | 564 | bch2_btree_root_alloc_fake_trans(trans, i, 1);
|
|
0 commit comments