bcachefs: Switch reconstruct_alloc to a mount option
authorKent Overstreet <kent.overstreet@gmail.com>
Wed, 28 Aug 2019 17:20:31 +0000 (13:20 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:26 +0000 (17:08 -0400)
Right now this is the only way of repairing bucket gens in the future

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/bcachefs.h
fs/bcachefs/opts.h
fs/bcachefs/recovery.c

index eb4079e5717866dd451862ea130e28c78507f081..c5c98aae8bdb40b8b8006450052912ff3473538a 100644 (file)
@@ -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()
 
index d2493d4111c65e4f8d8e785f05a8937e357294d9..d44bfe90c0d51b75a9590d158087ec5504512c77 100644 (file)
@@ -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(),                                                   \
index 2aa63cc75f50e58cfe1db40b08e9efd3cb1fc588..c9558ccb9a262001f3c0118c7fecdccbf7c5d619 100644 (file)
@@ -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;
                }