summaryrefslogtreecommitdiff
path: root/libbcachefs/error.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-02-09 21:30:46 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-02-09 21:32:46 -0500
commit7a716b76b5963dc2d158883f4497bab221932412 (patch)
treee326c5280a0c43b080f520a3bd19ba9a77b556be /libbcachefs/error.c
parent9e6d9560d070bc14e1498a24ef6634d2b99f7e84 (diff)
Update bcachefs sources to bee7b5a4fa21 bcachefs: Pin btree cache in ram for random access in fsck
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/error.c')
-rw-r--r--libbcachefs/error.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libbcachefs/error.c b/libbcachefs/error.c
index 70a12539..8ae95b21 100644
--- a/libbcachefs/error.c
+++ b/libbcachefs/error.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "bcachefs.h"
#include "error.h"
+#include "recovery.h"
#include "super.h"
#include <linux/thread_with_file.h>
@@ -25,11 +26,16 @@ bool bch2_inconsistent_error(struct bch_fs *c)
}
}
-void bch2_topology_error(struct bch_fs *c)
+int bch2_topology_error(struct bch_fs *c)
{
set_bit(BCH_FS_topology_error, &c->flags);
- if (!test_bit(BCH_FS_fsck_running, &c->flags))
+ if (!test_bit(BCH_FS_fsck_running, &c->flags)) {
bch2_inconsistent_error(c);
+ return -BCH_ERR_btree_need_topology_repair;
+ } else {
+ return bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_check_topology) ?:
+ -BCH_ERR_btree_node_read_validate_error;
+ }
}
void bch2_fatal_error(struct bch_fs *c)