diff options
Diffstat (limited to 'libbcachefs/btree_gc.c')
-rw-r--r-- | libbcachefs/btree_gc.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libbcachefs/btree_gc.c b/libbcachefs/btree_gc.c index 146f2428..65b01e86 100644 --- a/libbcachefs/btree_gc.c +++ b/libbcachefs/btree_gc.c @@ -464,6 +464,7 @@ static void bch2_mark_superblocks(struct bch_fs *c) mutex_unlock(&c->sb_lock); } +#if 0 /* Also see bch2_pending_btree_node_free_insert_done() */ static void bch2_mark_pending_btree_node_frees(struct bch_fs *c) { @@ -481,6 +482,7 @@ static void bch2_mark_pending_btree_node_frees(struct bch_fs *c) mutex_unlock(&c->btree_interior_update_lock); } +#endif static void bch2_mark_allocator_buckets(struct bch_fs *c) { @@ -579,8 +581,10 @@ static int bch2_gc_done(struct bch_fs *c, #define copy_bucket_field(_f) \ if (dst->b[b].mark._f != src->b[b].mark._f) { \ if (verify) \ - fsck_err(c, "dev %u bucket %zu has wrong " #_f \ + fsck_err(c, "bucket %u:%zu gen %u data type %s has wrong " #_f \ ": got %u, should be %u", i, b, \ + dst->b[b].mark.gen, \ + bch2_data_types[dst->b[b].mark.data_type],\ dst->b[b].mark._f, src->b[b].mark._f); \ dst->b[b]._mark._f = src->b[b].mark._f; \ } @@ -797,6 +801,10 @@ int bch2_gc(struct bch_fs *c, struct journal_keys *journal_keys, trace_gc_start(c); down_write(&c->gc_lock); + + /* flush interior btree updates: */ + closure_wait_event(&c->btree_interior_update_wait, + !bch2_btree_interior_updates_nr_pending(c)); again: ret = bch2_gc_start(c, metadata_only); if (ret) @@ -808,7 +816,9 @@ again: if (ret) goto out; +#if 0 bch2_mark_pending_btree_node_frees(c); +#endif bch2_mark_allocator_buckets(c); c->gc_count++; @@ -1033,6 +1043,8 @@ static void bch2_coalesce_nodes(struct bch_fs *c, struct btree_iter *iter, btree_node_reset_sib_u64s(n); bch2_btree_build_aux_trees(n); + + bch2_btree_update_add_new_node(as, n); six_unlock_write(&n->lock); bch2_btree_node_write(c, n, SIX_LOCK_intent); @@ -1081,7 +1093,7 @@ next: bch2_btree_iter_node_replace(iter, new_nodes[0]); for (i = 0; i < nr_new_nodes; i++) - bch2_open_buckets_put(c, &new_nodes[i]->ob); + bch2_btree_update_get_open_buckets(as, new_nodes[i]); /* Free the old nodes and update our sliding window */ for (i = 0; i < nr_old_nodes; i++) { |