summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-08-28 13:20:31 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:26 -0400
commitad7e137ebc3dcadbaa37d2f464728c915e039e1d (patch)
tree0a904acd36d11585cff549c27130940dd422276a /fs
parent05cf02b5a10ae9b60aad4b1fe4049eb4e7603b4f (diff)
downloadlwn-ad7e137ebc3dcadbaa37d2f464728c915e039e1d.tar.gz
lwn-ad7e137ebc3dcadbaa37d2f464728c915e039e1d.zip
bcachefs: Switch reconstruct_alloc to a mount option
Right now this is the only way of repairing bucket gens in the future Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/bcachefs.h4
-rw-r--r--fs/bcachefs/opts.h5
-rw-r--r--fs/bcachefs/recovery.c2
3 files changed, 7 insertions, 4 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index eb4079e57178..c5c98aae8bdb 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -285,9 +285,7 @@ do { \
"Force reads to use the reconstruct path, when reading" \
"from erasure coded extents") \
BCH_DEBUG_PARAM(test_restart_gc, \
- "Test restarting mark and sweep gc when bucket gens change")\
- BCH_DEBUG_PARAM(test_reconstruct_alloc, \
- "Test reconstructing the alloc btree")
+ "Test restarting mark and sweep gc when bucket gens change")
#define BCH_DEBUG_PARAMS_ALL() BCH_DEBUG_PARAMS_ALWAYS() BCH_DEBUG_PARAMS_DEBUG()
diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h
index d2493d4111c6..d44bfe90c0d5 100644
--- a/fs/bcachefs/opts.h
+++ b/fs/bcachefs/opts.h
@@ -258,6 +258,11 @@ enum opt_type {
OPT_BOOL(), \
NO_SB_OPT, false, \
NULL, "Don\'t start filesystem, only open devices") \
+ x(reconstruct_alloc, u8, \
+ OPT_MOUNT, \
+ OPT_BOOL(), \
+ NO_SB_OPT, false, \
+ NULL, "Reconstruct alloc btree") \
x(version_upgrade, u8, \
OPT_MOUNT, \
OPT_BOOL(), \
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 2aa63cc75f50..c9558ccb9a26 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -659,7 +659,7 @@ static int read_btree_roots(struct bch_fs *c)
continue;
if (i == BTREE_ID_ALLOC &&
- test_reconstruct_alloc(c)) {
+ c->opts.reconstruct_alloc) {
c->sb.compat &= ~(1ULL << BCH_COMPAT_FEAT_ALLOC_INFO);
continue;
}