summaryrefslogtreecommitdiff
path: root/libbcachefs/recovery.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-06-27 15:58:48 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-06-27 15:58:48 -0400
commitbad0c8c50758b4447d529f61017c1a8c85976a3e (patch)
treec27806cdcab52e6697163daeca7b9e903fcd6f64 /libbcachefs/recovery.c
parent64ddfc9fc5628f27cdc1399a283452196a7e2dcc (diff)
Update bcachefs sources to 95ff72a6c1 fixup! mm: Centralize & improve oom reporting in show_mem.c
Diffstat (limited to 'libbcachefs/recovery.c')
-rw-r--r--libbcachefs/recovery.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libbcachefs/recovery.c b/libbcachefs/recovery.c
index 63e8c1c3..eea025a8 100644
--- a/libbcachefs/recovery.c
+++ b/libbcachefs/recovery.c
@@ -919,6 +919,19 @@ fsck_err:
return ERR_PTR(ret);
}
+static bool btree_id_is_alloc(enum btree_id id)
+{
+ switch (id) {
+ case BTREE_ID_alloc:
+ case BTREE_ID_backpointers:
+ case BTREE_ID_need_discard:
+ case BTREE_ID_freespace:
+ return true;
+ default:
+ return false;
+ }
+}
+
static int read_btree_roots(struct bch_fs *c)
{
unsigned i;
@@ -930,14 +943,14 @@ static int read_btree_roots(struct bch_fs *c)
if (!r->alive)
continue;
- if (i == BTREE_ID_alloc &&
+ if (btree_id_is_alloc(i) &&
c->opts.reconstruct_alloc) {
c->sb.compat &= ~(1ULL << BCH_COMPAT_alloc_info);
continue;
}
if (r->error) {
- __fsck_err(c, i == BTREE_ID_alloc
+ __fsck_err(c, btree_id_is_alloc(i)
? FSCK_CAN_IGNORE : 0,
"invalid btree root %s",
bch2_btree_ids[i]);
@@ -947,7 +960,8 @@ static int read_btree_roots(struct bch_fs *c)
ret = bch2_btree_root_read(c, i, &r->key, r->level);
if (ret) {
- __fsck_err(c, i == BTREE_ID_alloc
+ __fsck_err(c,
+ btree_id_is_alloc(i)
? FSCK_CAN_IGNORE : 0,
"error reading btree root %s",
bch2_btree_ids[i]);