diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-10-28 19:33:59 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2019-11-04 12:23:23 -0500 |
commit | 6a1793a63eaeb1bcb0dec74f8558aa8ced1f3932 (patch) | |
tree | 13dd359bd38a3251ed7f134fb903f473fe28ca3f | |
parent | 16c2661572042125b7ba318e19c864207da66c21 (diff) |
bcachefs: Trust btree alloc info at runtime
This lets us avoid a cache miss in the write path.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/bcachefs.h | 1 | ||||
-rw-r--r-- | fs/bcachefs/buckets.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/recovery.c | 2 |
3 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 498d46f1a5a0..323b663da278 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -497,6 +497,7 @@ enum { /* misc: */ BCH_FS_BDEV_MOUNTED, BCH_FS_FIXED_GENS, + BCH_FS_ALLOC_WRITTEN, BCH_FS_REBUILD_REPLICAS, BCH_FS_HOLD_BTREE_WRITES, }; diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index e3c3846a6085..740272bf6488 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -1456,7 +1456,7 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans, if (ret < 0) 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 * runtime, the alloc info in the btree might not be up to date diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 23f3ed54fadd..2c441a278044 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -864,6 +864,8 @@ int bch2_fs_recovery(struct bch_fs *c) goto err; } bch_verbose(c, "alloc write done"); + + set_bit(BCH_FS_ALLOC_WRITTEN, &c->flags); } if (!c->sb.clean) { |