Commit d884cf18 authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: Only run check_backpointers_to_extents in debug mode



The backpointers passes, check_backpointers_to_extents() and
check_extents_to_backpointers() are the most expensive fsck passes.

Now that we're running the same check and repair code when using a
backpointer at runtime (via bch2_backpointer_get_key()) that fsck does,
there's no reason fsck needs to - except to verify that the filesystem
really has no errors in debug mode.

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 7611d6b5
Loading
Loading
Loading
Loading
+49 −43
Original line number Diff line number Diff line
@@ -8,6 +8,12 @@
#define PASS_ALWAYS		BIT(3)
#define PASS_ONLINE		BIT(4)

#ifdef CONFIG_BCACHEFS_DEBUG
#define PASS_FSCK_DEBUG		BIT(1)
#else
#define PASS_FSCK_DEBUG		0
#endif

/*
 * Passes may be reordered, but the second field is a persistent identifier and
 * must never change:
@@ -29,7 +35,7 @@
	x(check_alloc_info,			10, PASS_ONLINE|PASS_FSCK)		\
	x(check_lrus,				11, PASS_ONLINE|PASS_FSCK)		\
	x(check_btree_backpointers,		12, PASS_ONLINE|PASS_FSCK)		\
	x(check_backpointers_to_extents,	13, PASS_ONLINE|PASS_FSCK)	\
	x(check_backpointers_to_extents,	13, PASS_ONLINE|PASS_FSCK_DEBUG)	\
	x(check_extents_to_backpointers,	14, PASS_ONLINE|PASS_FSCK)		\
	x(check_alloc_to_lru_refs,		15, PASS_ONLINE|PASS_FSCK)		\
	x(fs_freespace_init,			16, PASS_ALWAYS|PASS_SILENT)		\
@@ -54,7 +60,7 @@
	x(resume_logged_ops,			23, PASS_ALWAYS)			\
	x(delete_dead_inodes,			32, PASS_ALWAYS)			\
	x(fix_reflink_p,			33, 0)					\
	x(set_fs_needs_rebalance,		34, 0)				\
	x(set_fs_needs_rebalance,		34, 0)

/* We normally enumerate recovery passes in the order we run them: */
enum bch_recovery_pass {
+2 −2
Original line number Diff line number Diff line
@@ -140,8 +140,8 @@ enum bch_fsck_flags {
	x(backpointer_bucket_offset_wrong,			125,	0)		\
	x(backpointer_level_bad,				294,	0)		\
	x(backpointer_dev_bad,					297,	0)		\
	x(backpointer_to_missing_device,			126,	0)		\
	x(backpointer_to_missing_alloc,				127,	0)		\
	x(backpointer_to_missing_device,			126,	FSCK_AUTOFIX)	\
	x(backpointer_to_missing_alloc,				127,	FSCK_AUTOFIX)	\
	x(backpointer_to_missing_ptr,				128,	FSCK_AUTOFIX)	\
	x(lru_entry_at_time_0,					129,	FSCK_AUTOFIX)	\
	x(lru_entry_to_invalid_bucket,				130,	FSCK_AUTOFIX)	\