summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/recovery.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-01-01 01:41:45 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-06 05:24:20 +0100
commitd55ddf6e7a81e1e72b2f73c3cca836a6961c68af (patch)
tree64236e2119de36ca0d778ac2870f4994621ccfbb /fs/bcachefs/recovery.c
parentbcachefs: bch2_trigger_pointer() (diff)
downloadlinux-d55ddf6e7a81e1e72b2f73c3cca836a6961c68af.tar.xz
linux-d55ddf6e7a81e1e72b2f73c3cca836a6961c68af.zip
bcachefs: Online fsck can now fix errors
BCH_FS_fsck_done -> BCH_FS_fsck_running; set when we might be fixing fsck errors. Also; set fix_errors to ask by default when fsck is running. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r--fs/bcachefs/recovery.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 066aef6f3c74..6c0af6502ce9 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -832,6 +832,9 @@ int bch2_fs_recovery(struct bch_fs *c)
if (c->opts.fsck && IS_ENABLED(CONFIG_BCACHEFS_DEBUG))
c->recovery_passes_explicit |= BIT_ULL(BCH_RECOVERY_PASS_check_topology);
+ if (c->opts.fsck)
+ set_bit(BCH_FS_fsck_running, &c->flags);
+
ret = bch2_blacklist_table_initialize(c);
if (ret) {
bch_err(c, "error initializing blacklist table");
@@ -972,6 +975,8 @@ use_clean:
if (ret)
goto err;
+ clear_bit(BCH_FS_fsck_running, &c->flags);
+
/* If we fixed errors, verify that fs is actually clean now: */
if (IS_ENABLED(CONFIG_BCACHEFS_DEBUG) &&
test_bit(BCH_FS_errors_fixed, &c->flags) &&
@@ -1066,7 +1071,6 @@ use_clean:
ret = 0;
out:
- set_bit(BCH_FS_fsck_done, &c->flags);
bch2_flush_fsck_errs(c);
if (!c->opts.keep_journal &&
@@ -1113,7 +1117,6 @@ int bch2_fs_initialize(struct bch_fs *c)
c->curr_recovery_pass = ARRAY_SIZE(recovery_pass_fns);
set_bit(BCH_FS_may_go_rw, &c->flags);
- set_bit(BCH_FS_fsck_done, &c->flags);
for (unsigned i = 0; i < BTREE_ID_NR; i++)
bch2_btree_root_alloc(c, i);