bcachefs: Improve -o norecovery; opts.recovery_pass_limit
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 29 Mar 2024 01:34:14 +0000 (21:34 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 1 Apr 2024 00:36:12 +0000 (20:36 -0400)
commit13c1e583f9179ad7953dc71ebb2f12e613b9d052
treea76d2d7df5caac4cbb063c02b66084e6a44f0044
parent060ff30a8596b649a80c19935758000dde7855fe
bcachefs: Improve -o norecovery; opts.recovery_pass_limit

This adds opts.recovery_pass_limit, and redoes -o norecovery to make use
of it; this fixes some issues with -o norecovery so it can be safely
used for data recovery.

Norecovery means "don't do journal replay"; it's an important data
recovery tool when we're getting stuck in journal replay.

When using it this way we need to make sure we don't free journal keys
after startup, so we continue to overlay them: thus it needs to imply
retain_recovery_info, as well as nochanges.

recovery_pass_limit is an explicit option for telling recovery to exit
after a specific recovery pass; this is a much cleaner way of
implementing -o norecovery, as well as being a useful debug feature in
its own right.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/opts.c
fs/bcachefs/opts.h
fs/bcachefs/recovery.c
fs/bcachefs/recovery_passes.c
fs/bcachefs/snapshot.c
fs/bcachefs/super.c