]> git.ipfire.org Git - thirdparty/kernel/stable.git/blame - fs/bcachefs/recovery.h
Merge tag 'kvm-x86-generic-6.8' of https://github.com/kvm-x86/linux into HEAD
[thirdparty/kernel/stable.git] / fs / bcachefs / recovery.h
CommitLineData
1c6fdbd8
KO
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _BCACHEFS_RECOVERY_H
3#define _BCACHEFS_RECOVERY_H
4
ad52bac2
KO
5extern const char * const bch2_recovery_passes[];
6
7/*
8 * For when we need to rewind recovery passes and run a pass we skipped:
9 */
10static inline int bch2_run_explicit_recovery_pass(struct bch_fs *c,
11 enum bch_recovery_pass pass)
12{
e8c76927
KO
13 if (c->recovery_passes_explicit & BIT_ULL(pass))
14 return 0;
15
ad52bac2
KO
16 bch_info(c, "running explicit recovery pass %s (%u), currently at %s (%u)",
17 bch2_recovery_passes[pass], pass,
18 bch2_recovery_passes[c->curr_recovery_pass], c->curr_recovery_pass);
19
20 c->recovery_passes_explicit |= BIT_ULL(pass);
21
22 if (c->curr_recovery_pass >= pass) {
23 c->curr_recovery_pass = pass;
0ed4ca14 24 c->recovery_passes_complete &= (1ULL << pass) >> 1;
ad52bac2
KO
25 return -BCH_ERR_restart_recovery;
26 } else {
27 return 0;
28 }
29}
30
065bd335
KO
31u64 bch2_fsck_recovery_passes(void);
32
1c6fdbd8
KO
33int bch2_fs_recovery(struct bch_fs *);
34int bch2_fs_initialize(struct bch_fs *);
35
36#endif /* _BCACHEFS_RECOVERY_H */