Commit ff929515 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Trust btree alloc info at runtime

This lets us avoid a cache miss in the write path.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent c4e065c2
...@@ -499,6 +499,7 @@ enum { ...@@ -499,6 +499,7 @@ enum {
/* misc: */ /* misc: */
BCH_FS_BDEV_MOUNTED, BCH_FS_BDEV_MOUNTED,
BCH_FS_FIXED_GENS, BCH_FS_FIXED_GENS,
BCH_FS_ALLOC_WRITTEN,
BCH_FS_REBUILD_REPLICAS, BCH_FS_REBUILD_REPLICAS,
BCH_FS_HOLD_BTREE_WRITES, BCH_FS_HOLD_BTREE_WRITES,
}; };
......
...@@ -1456,7 +1456,7 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans, ...@@ -1456,7 +1456,7 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans,
if (ret < 0) if (ret < 0)
return ret; return ret;
if (!ret) { if (!ret && unlikely(!test_bit(BCH_FS_ALLOC_WRITTEN, &c->flags))) {
/* /*
* During journal replay, and if gc repairs alloc info at * During journal replay, and if gc repairs alloc info at
* runtime, the alloc info in the btree might not be up to date * runtime, the alloc info in the btree might not be up to date
......
...@@ -864,6 +864,8 @@ int bch2_fs_recovery(struct bch_fs *c) ...@@ -864,6 +864,8 @@ int bch2_fs_recovery(struct bch_fs *c)
goto err; goto err;
} }
bch_verbose(c, "alloc write done"); bch_verbose(c, "alloc write done");
set_bit(BCH_FS_ALLOC_WRITTEN, &c->flags);
} }
if (!c->sb.clean) { if (!c->sb.clean) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment