diff options
-rw-r--r-- | fs/bcachefs/btree_gc.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index 3feea91e6aab..524207ee1c4c 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -207,7 +207,10 @@ static int bch2_gc_btree(struct bch_fs *c, enum btree_id btree_id, struct btree_iter *iter; struct btree *b; struct range_checks r; - unsigned depth = btree_node_type_needs_gc(btree_id) ? 0 : 1; + unsigned depth = metadata_only ? 1 + : expensive_debug_checks(c) ? 0 + : !btree_node_type_needs_gc(btree_id) ? 1 + : 0; u8 max_stale; int ret = 0; @@ -215,17 +218,6 @@ static int bch2_gc_btree(struct bch_fs *c, enum btree_id btree_id, gc_pos_set(c, gc_pos_btree(btree_id, POS_MIN, 0)); - /* - * if expensive_debug_checks is on, run range_checks on all leaf nodes: - * - * and on startup, we have to read every btree node (XXX: only if it was - * an unclean shutdown) - */ - if (metadata_only) - depth = 1; - else if (initial || expensive_debug_checks(c)) - depth = 0; - btree_node_range_checks_init(&r, depth); __for_each_btree_node(&trans, iter, btree_id, POS_MIN, |