mbox series

[0/3] btrfs-progs: tune: run "btrfs check" before and after full fs conversion

Message ID cover.1701672971.git.wqu@suse.com (mailing list archive)
Headers show
Series btrfs-progs: tune: run "btrfs check" before and after full fs conversion | expand

Message

Qu Wenruo Dec. 4, 2023, 6:56 a.m. UTC
There are already two reports about some filesystem corruption after
converting to block group tree.

So far we don't have any concrete evidence that block group tree
conversion is the cause yet, but there are some possible cases like a
unhealthy fs in the first place which can screw up such full fs
conversion.

To rule out the possibility, let's run "btrfs check" both before and
after a full fs conversion run (*), so that we make sure the fs is fine
and stays fine during the conversion.

*: For now this includes the following operations:
   - convert to block group tree
   - convert to extent tree
   - convert checksum type

   For UUID change (not the metadata uuid one), although we're rewriting
   the whole fs, we are doing it in-place, thus not much can go wrong,
   unlike the above 3, which relies one full transactional protection.
   Other operations are just changing a super block flag.

The first patch is removing inode cache clearing from btrfs check, as
we're exporting btrfs-check now, those deprecated functionality is no
longer worthy maintaining in "btrfs check". (And it's still maintained,
although only through "btrfs rescue").

The second patch would export the full "btrfs check" functionality
through btrfs_check() function, with btrfs_check_options structure to
toggle all the options.

Finally the last patch is doing all the extra checks for btrfstune.

Qu Wenruo (3):
  btrfs-progs: check: remove inode cache clearing functionality
  btrfs-progs: check: export a dedicated btrfs_check() function
  btrfs-progs: tune: add fsck runs before and after a full conversion

 Makefile                                      |   3 +-
 check/main.c                                  | 999 +++++++++---------
 common/utils.c                                |  18 +
 common/utils.h                                |  41 +
 .../ino-cache-enabled.raw.xz                  | Bin
 .../060-ino-cache-clean}/test.sh              |   2 +-
 tune/main.c                                   |  55 +
 7 files changed, 614 insertions(+), 504 deletions(-)
 rename tests/{fsck-tests/046-ino-cache-clean => misc-tests/060-ino-cache-clean}/ino-cache-enabled.raw.xz (100%)
 rename tests/{fsck-tests/046-ino-cache-clean => misc-tests/060-ino-cache-clean}/test.sh (97%)

--
2.43.0