mbox series

[v2,0/4] btrfs: rescue= mount options enhancement to support interrupted csum conversion

Message ID cover.1718338860.git.wqu@suse.com (mailing list archive)
Headers show
Series btrfs: rescue= mount options enhancement to support interrupted csum conversion | expand

Message

Qu Wenruo June 14, 2024, 4:22 a.m. UTC
[CHANGELOG]
v2:
- Add the new rescue options to supported rescue options sysfs interface
- Add the state char 'S' for skipping metadata csum
- Add an info line of unsupported super flags if rescue=ignoresuperflags
  is specified
- Add const prefix for one-time btrfs_test_opt() result

[REPO]
https://github.com/adam900710/linux/tree/rescue_changes

[BACKGROUND]
There is an adventurous user using btrfstune to convert a 32T btrfs
from crc32c to xxhash.

However for such huge fs, it takes too long time and the reporter
canceled the conversion.

This makes the reporter unable to mount the fs at all.

[CAUSE]
First of all, for a half converted fs, we will never allow RW mount, so
everything must be done in rescue mode.

There are several different stages of csum conversion, and at different
stage it requires different handling from kernel:

- Generationg new data csums
  At this stage only the super flags (CHANGING_DATA_CSUM flag) is
  preventing the kernel from mounting.

  Intrdoce "rescue=ignoresuperflags" to address this.

- Deleting old data cums
  The same super flags problem, with possible missing data csums.

  Despite the new "rescue=ignoresuperflags", end users will also need
  the existing "rescue=ignoredatacsums" mount option.

- Renaming the objectid of new data cums
  The new csums' objectid will be changed to the regular one.

  During this we can hit data csum mismatch.
  So the same "rescue=ignoresuperflags:ignoredatacsums" can handle it
  already.

- Rewriting metadata csums
  This part is done in-place (no COW), with a new super flags
  (CHANGING_META_CSUM).

  So here introduce a new "rescue=ignoremetacsums" to ignore the
  metadata checksum verification (and rely on the remaining sanity
  checks like tree-checkers).

The first 2 patches are just small cleanups, meanwhile the last two are
the new "rescue=" mount options to handle interrupted csum change.

Qu Wenruo (4):
  btrfs: remove unused Opt enums
  btrfs: output the unrecognized super flags as hex
  btrfs: introduce new "rescue=ignoremetacsums" mount option
  btrfs: introduce new "rescue=ignoresuperflags" mount option

 fs/btrfs/bio.c       |  2 +-
 fs/btrfs/disk-io.c   | 35 +++++++++++++++++++++++++----------
 fs/btrfs/file-item.c |  2 +-
 fs/btrfs/fs.h        |  5 ++++-
 fs/btrfs/messages.c  |  3 ++-
 fs/btrfs/super.c     | 27 +++++++++++++++++++++++----
 fs/btrfs/sysfs.c     |  2 ++
 fs/btrfs/zoned.c     |  2 +-
 8 files changed, 59 insertions(+), 19 deletions(-)