Skip to content

btrfs: rescue= mount options enhancement to support interrupted csum conversion

Qu Wenruo linux-btrfs lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyIn review
  2. v14 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- 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

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4btrfs: remove unused Opt enumsfs/btrfs/super.c+0 -30 replies
2/4btrfs: output the unrecognized super flags as hexfs/btrfs/disk-io.c+1 -10 replies
3/4btrfs: introduce new "rescue=ignoremetacsums" mount optionfs/btrfs/bio.c fs/btrfs/disk-io.c fs/btrfs/file-item.c +5 more+34 -120 replies
4/4btrfs: introduce new "rescue=ignoresuperflags" mount optionfs/btrfs/disk-io.c fs/btrfs/fs.h fs/btrfs/super.c +1 more+26 -51 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchJosef Bacik
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

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

[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(-)
Signature · 1 line
2.45.2