diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-04-05 06:01:54 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:20 +0300 |
commit | 4881fdb7566dcc52aaf05f9b8f044a5ecfeff81b (patch) | |
tree | e991b426c1ee217a3333b6ce62373cc9e1c32f36 | |
parent | 1dd7f9d98de0740b42f1ac3f0b1d8af9c76801de (diff) | |
download | linux-4881fdb7566dcc52aaf05f9b8f044a5ecfeff81b.tar.xz |
bcachefs: initial gc no longer needs to touch every node
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-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 c572391c4dad..84a0bb9202c4 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -210,7 +210,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; @@ -218,17 +221,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, |