summaryrefslogtreecommitdiff
path: root/fs/bcachefs/bcachefs.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-07-17 06:21:17 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:10:08 +0300
commitae2e13d7809d79ea4d7c0cd8ee060b7911012e37 (patch)
treee12ed129dcec1d25552431f3658d1f8469daa55c /fs/bcachefs/bcachefs.h
parentef1634f0f19d676483888c2a05d7e406b366d2db (diff)
downloadlinux-ae2e13d7809d79ea4d7c0cd8ee060b7911012e37.tar.xz
bcachefs: bch2_run_explicit_recovery_pass()
This introduces bch2_run_explicit_recovery_pass() and uses it for when fsck detects that we need to re-run dead snaphots cleanup, and makes dead snapshot cleanup more like a normal recovery pass. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bcachefs.h')
-rw-r--r--fs/bcachefs/bcachefs.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 6e8dc25d41db..d9e36f16af2e 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -680,7 +680,7 @@ enum bch_write_ref {
x(check_snapshot_trees, PASS_FSCK) \
x(check_snapshots, PASS_FSCK) \
x(check_subvols, PASS_FSCK) \
- x(delete_dead_snapshots, PASS_FSCK|PASS_UNCLEAN|PASS_SILENT) \
+ x(delete_dead_snapshots, PASS_FSCK|PASS_UNCLEAN) \
x(fs_upgrade_for_subvolumes, 0) \
x(check_inodes, PASS_FSCK|PASS_UNCLEAN) \
x(check_extents, PASS_FSCK) \
@@ -1179,6 +1179,19 @@ static inline bool bch2_dev_exists2(const struct bch_fs *c, unsigned dev)
return dev < c->sb.nr_devices && c->devs[dev];
}
+/*
+ * For when we need to rewind recovery passes and run a pass we skipped:
+ */
+static inline int bch2_run_explicit_recovery_pass(struct bch_fs *c,
+ enum bch_recovery_pass pass)
+{
+ BUG_ON(c->curr_recovery_pass < pass);
+
+ c->recovery_passes_explicit |= BIT_ULL(pass);
+ c->curr_recovery_pass = pass;
+ return -BCH_ERR_restart_recovery;
+}
+
#define BKEY_PADDED_ONSTACK(key, pad) \
struct { struct bkey_i key; __u64 key ## _pad[pad]; }