bcachefs: More debug params for testing of recovery paths

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2019-03-21 19:03:57 -04:00 committed by Kent Overstreet
parent 05235e9928
commit 6122ab639c
3 changed files with 12 additions and 2 deletions

View File

@ -278,7 +278,11 @@ do { \
"cached data") \
BCH_DEBUG_PARAM(force_reconstruct_read, \
"Force reads to use the reconstruct path, when reading" \
"from erasure coded extents")
"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")
#define BCH_DEBUG_PARAMS_ALL() BCH_DEBUG_PARAMS_ALWAYS() BCH_DEBUG_PARAMS_DEBUG()

View File

@ -750,7 +750,9 @@ again:
c->gc_count++;
out:
if (!ret && test_bit(BCH_FS_FIXED_GENS, &c->flags)) {
if (!ret &&
(test_bit(BCH_FS_FIXED_GENS, &c->flags) ||
(!iter && test_restart_gc(c)))) {
/*
* XXX: make sure gens we fixed got saved
*/

View File

@ -277,6 +277,10 @@ int bch2_fs_recovery(struct bch_fs *c)
if (r->error)
goto err;
if (i == BTREE_ID_ALLOC &&
test_reconstruct_alloc(c))
continue;
err = "error reading btree root";
ret = bch2_btree_root_read(c, i, &r->key, r->level);
if (ret) {