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

bcachefs: bch2_btree_root_alloc_fake_trans()



We're starting to be more strict about transaction locked state, and
multiple transactions in a task.

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent ca563dcc
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -540,9 +540,9 @@ int bch2_check_topology(struct bch_fs *c)
			if (!bch2_btree_has_scanned_nodes(c, i)) {
				mustfix_fsck_err(c, btree_root_unreadable_and_scan_found_nothing,
						 "no nodes found for btree %s, continue?", bch2_btree_id_str(i));
				bch2_btree_root_alloc_fake(c, i, 0);
				bch2_btree_root_alloc_fake_trans(trans, i, 0);
			} else {
				bch2_btree_root_alloc_fake(c, i, 1);
				bch2_btree_root_alloc_fake_trans(trans, i, 1);
				bch2_shoot_down_journal_keys(c, i, 1, BTREE_MAX_DEPTH, POS_MIN, SPOS_MAX);
				ret = bch2_get_scanned_nodes(c, i, 0, POS_MIN, SPOS_MAX);
				if (ret)
@@ -570,7 +570,7 @@ int bch2_check_topology(struct bch_fs *c)
				goto reconstruct_root;

			bch_err(c, "empty btree root %s", bch2_btree_id_str(i));
			bch2_btree_root_alloc_fake(c, i, 0);
			bch2_btree_root_alloc_fake_trans(trans, i, 0);
			r->alive = false;
			ret = 0;
		}
+2 −2
Original line number Diff line number Diff line
@@ -2513,7 +2513,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_fake(struct btree_trans *trans, enum btree_id id, unsigned level)
int bch2_btree_root_alloc_fake_trans(struct btree_trans *trans, enum btree_id id, unsigned level)
{
	struct bch_fs *c = trans->c;
	struct closure cl;
@@ -2561,7 +2561,7 @@ static int __bch2_btree_root_alloc_fake(struct btree_trans *trans, enum btree_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_fake(trans, id, level));
	bch2_trans_run(c, bch2_btree_root_alloc_fake_trans(trans, id, level));
}

static void bch2_btree_update_to_text(struct printbuf *out, struct btree_update *as)
+2 −0
Original line number Diff line number Diff line
@@ -175,6 +175,8 @@ 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 *);

int bch2_btree_root_alloc_fake_trans(struct btree_trans *, enum btree_id, unsigned);
void bch2_btree_root_alloc_fake(struct bch_fs *, enum btree_id, unsigned);

static inline unsigned btree_update_reserve_required(struct bch_fs *c,