bcachefs: recovery_passes_types.h -> recovery_passes_format.h
PATCH 1/2 bcachefs: recovery_passes_types.h -> recovery_passes_format.h
Signed-off-by Kent Overstreet <[email protected]>
---
fs/bcachefs/bcachefs.h | 1 -
fs/bcachefs/bcachefs_format.h | 1 +
.../{recovery_passes_types.h => recovery_passes_format.h} | 6 +++---
3 files changed, 4 insertions(+), 4 deletions(-)
rename fs/bcachefs/{recovery_passes_types.h => recovery_passes_format.h} (95%)fs/bcachefs/bcachefs.h +0 -1
@@ -213,7 +213,6 @@#include "fifo.h" #include "nocow_locking_types.h" #include "opts.h" -#include "recovery_passes_types.h" #include "sb-errors_types.h" #include "seqmutex.h" #include "snapshot_types.h"
fs/bcachefs/bcachefs_format.h +1 -0
@@ -510,6 +510,7 @@ struct bch_sb_field {#include "logged_ops_format.h" #include "lru_format.h" #include "quota_format.h" +#include "recovery_passes_format.h" #include "reflink_format.h" #include "replicas_format.h" #include "snapshot_format.h"
fs/bcachefs/recovery_passes_format.h renamed from fs/bcachefs/recovery_passes_types.h +3 -3
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _BCACHEFS_RECOVERY_PASSES_TYPES_H -#define _BCACHEFS_RECOVERY_PASSES_TYPES_H +#ifndef _BCACHEFS_RECOVERY_PASSES_FORMAT_H +#define _BCACHEFS_RECOVERY_PASSES_FORMAT_H#define PASS_SILENT BIT(0)#define PASS_FSCK BIT(1)
@@ -81,4 +81,4 @@ enum bch_recovery_pass_stable {#undef x }; -#endif /* _BCACHEFS_RECOVERY_PASSES_TYPES_H */ +#endif /* _BCACHEFS_RECOVERY_PASSES_FORMAT_H */
Signature · 1 line
2.49.0
PATCH 2/2 bcachefs: bch_sb_field_recovery_passes
New superblock section for statistics on recovery passes - last time ran (successfully), last runtime.
This will be used by self healing code to determine when to kick off potentially expensive recovery passes.
Signed-off-by Kent Overstreet <[email protected]>
--- fs/bcachefs/backpointers.c | 7 ++ fs/bcachefs/bcachefs_format.h | 3 +- fs/bcachefs/recovery_passes.c | 181 +++++++++++++++++++-------- fs/bcachefs/recovery_passes.h | 2 + fs/bcachefs/recovery_passes_format.h | 20 +++ fs/bcachefs/sb-members.c | 14 +-- 6 files changed, 161 insertions(+), 66 deletions(-)
fs/bcachefs/backpointers.c +7 -0
@@ -1228,6 +1228,13 @@ int bch2_check_bucket_backpointer_mismatch(struct btree_trans *trans,if (nr > allowed)bch2_check_extents_to_backpointers_async (trans->c); +/* +* Track duration of last check_extents_to_backpointers (all recovery +* passes?) +* +* Track when we last ran check_extents_to_backpointers +*/ +return ret; }
fs/bcachefs/bcachefs_format.h +2 -1
@@ -497,7 +497,8 @@ struct bch_sb_field { x(members_v2, 11) \ x(errors, 12) \ x(ext, 13) \ - x(downgrade, 14) + x(downgrade, 14) \ + x(recovery_passes, 15)#include "alloc_background_format.h" #include "dirent_format.h"
fs/bcachefs/recovery_passes.c +126 -55
217 lines not on this page · raw message
fs/bcachefs/recovery_passes.h +2 -0
@@ -3,6 +3,8 @@extern const char *const bch2_recovery_passes[]; +extern const struct bch_sb_field_ops bch_sb_field_ops_recovery_passes; +u64 bch2_recovery_passes_to_stable (u64 v);u64 bch2_recovery_passes_from_stable (u64 v);
fs/bcachefs/recovery_passes_format.h +20 -0
@@ -81,4 +81,24 @@ enum bch_recovery_pass_stable {#undef x }; +struct recovery_pass_entry { +__le64 last_run; +__le32 last_runtime; +__le32 flags; +}; + +struct bch_sb_field_recovery_passes { +struct bch_sb_field field; +struct recovery_pass_entry start[]; +}; + +static inline unsigned +recovery_passes_nr_entries (struct bch_sb_field_recovery_passes *r) +{ +return r + ? ((vstruct_end (&r->field) - (void *) &r->start[0 ]) / +sizeof (struct recovery_pass_entry )) + :0 ; +} +#endif /* _BCACHEFS_RECOVERY_PASSES_FORMAT_H */
fs/bcachefs/sb-members.c +4 -10
@@ -222,17 +222,11 @@ static void member_to_text(struct printbuf *out,printbuf_indent_add (out,2 );prt_printf (out,"Label:\t" ); -if (BCH_MEMBER_GROUP (&m)) { -unsigned idx =BCH_MEMBER_GROUP (&m) -1 ; - -if (idx <disk_groups_nr (gi)) -prt_printf (out,"%s (%u)" , - gi->entries[idx].label, idx); -else -prt_printf (out,"(bad disk labels section)" ); - }else { +if (BCH_MEMBER_GROUP (&m)) +bch2_disk_path_to_text_sb (out, sb, +BCH_MEMBER_GROUP (&m) -1 ); +else prt_printf (out,"(none)" ); - }prt_newline (out);prt_printf (out,"UUID:\t" );
Signature · 1 line
2.49.0