Commit f2f61f41 authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: bch2_btree_root_alloc() -> bch2_btree_root_alloc_fake()

parent ca1e02f7
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2466,7 +2466,7 @@ void bch2_btree_set_root_for_read(struct bch_fs *c, struct btree *b)
	bch2_btree_set_root_inmem(c, b);
}

static int __bch2_btree_root_alloc(struct btree_trans *trans, enum btree_id id)
static int __bch2_btree_root_alloc_fake(struct btree_trans *trans, enum btree_id id, unsigned level)
{
	struct bch_fs *c = trans->c;
	struct closure cl;
@@ -2485,7 +2485,7 @@ static int __bch2_btree_root_alloc(struct btree_trans *trans, enum btree_id id)

	set_btree_node_fake(b);
	set_btree_node_need_rewrite(b);
	b->c.level	= 0;
	b->c.level	= level;
	b->c.btree_id	= id;

	bkey_btree_ptr_init(&b->key);
@@ -2512,9 +2512,9 @@ static int __bch2_btree_root_alloc(struct btree_trans *trans, enum btree_id id)
	return 0;
}

void bch2_btree_root_alloc(struct bch_fs *c, enum btree_id id)
void bch2_btree_root_alloc_fake(struct bch_fs *c, enum btree_id id, unsigned level)
{
	bch2_trans_run(c, __bch2_btree_root_alloc(trans, id));
	bch2_trans_run(c, __bch2_btree_root_alloc_fake(trans, id, level));
}

static void bch2_btree_update_to_text(struct printbuf *out, struct btree_update *as)
+1 −1
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ int bch2_btree_node_update_key_get_iter(struct btree_trans *, struct btree *,
					struct bkey_i *, unsigned, bool);

void bch2_btree_set_root_for_read(struct bch_fs *, struct btree *);
void bch2_btree_root_alloc(struct bch_fs *, enum btree_id);
void bch2_btree_root_alloc_fake(struct bch_fs *, enum btree_id, unsigned);

static inline unsigned btree_update_reserve_required(struct bch_fs *c,
						     struct btree *b)
+2 −2
Original line number Diff line number Diff line
@@ -476,7 +476,7 @@ static int read_btree_roots(struct bch_fs *c)
		if (!r->b) {
			r->alive = false;
			r->level = 0;
			bch2_btree_root_alloc(c, i);
			bch2_btree_root_alloc_fake(c, i, 0);
		}
	}
fsck_err:
@@ -929,7 +929,7 @@ int bch2_fs_initialize(struct bch_fs *c)
	set_bit(BCH_FS_may_go_rw, &c->flags);

	for (unsigned i = 0; i < BTREE_ID_NR; i++)
		bch2_btree_root_alloc(c, i);
		bch2_btree_root_alloc_fake(c, i, 0);

	for_each_member_device(c, ca)
		bch2_dev_usage_init(ca);