diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-03-21 19:03:57 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2019-03-21 19:03:57 -0400 |
commit | 8c0fe88ca2ca8dae7f5723ffb89a069743974279 (patch) | |
tree | 182fbd76025be48d50367ee4ab0075e5a46b8beb | |
parent | 82c87eb5e4de0696bffab1b6dbe5985272c4fbca (diff) |
bcachefs: More debug params for testing of recovery paths
-rw-r--r-- | fs/bcachefs/bcachefs.h | 6 | ||||
-rw-r--r-- | fs/bcachefs/btree_gc.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/recovery.c | 4 |
3 files changed, 12 insertions, 2 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 4492a9276fd2..0928ee7e4968 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -275,7 +275,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() diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index 5d6f63646d9f..634b69a4dcb0 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -747,7 +747,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 */ diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 193c7015530a..682952719304 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -276,6 +276,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) { |