mbox series

[0/3] btrfs-progs: add the ability to enable fst for btrfstune

Message ID cover.1682988988.git.wqu@suse.com (mailing list archive)
Headers show
Series btrfs-progs: add the ability to enable fst for btrfstune | expand

Message

Qu Wenruo May 2, 2023, 1:01 a.m. UTC
At the beginning of free space tree feature, it's enabled by
"space_cache=v2" mount option.

However this introduced some problems:

- Lack of proper v1 cache clearing in the past
  In the past we didn't properly clear v1 cache before enabling v2.

- More and more complex v2 cache dependency
  Extent tree v2 and bgt all depend on v2 cache, but we have some
  mount options like clear_cache can screw this up.

Instead introducing some mount options to tinkering the filesystem
features (either compat_ro or incompat), we should always go through
btrfstune to enable new features (just like what we did in bgt).

This allows us to move the heavy lifting and proper checks into
btrfs-progs.

Although it's already late, it's still better than never, thus this
patchset introduce the --convert-to-free-space-tree feature to
btrfstune.

Unlike bgt, v1 cache is going to fade out soon, thus no rollback
functionality provided.

I hope we can deprecate the "space_cache=" mount option soon.

Qu Wenruo (3):
  btrfs-progs: make check/clear-cache.c to be separate from check/main.c
  btrfs-progs: tune: add --convert-to-free-space-tree option
  btrfs-progs: misc-tests: add test case to verify btrfstune
    --convert-to-free-space-tree option

 Documentation/btrfstune.rst                   |  5 ++
 Makefile                                      |  2 +-
 check/clear-cache.c                           | 84 ++++++++++---------
 check/clear-cache.h                           |  9 +-
 check/main.c                                  |  6 +-
 .../057-btrfstune-free-space-tree/test.sh     | 21 +++++
 tune/main.c                                   | 57 ++++++++++++-
 7 files changed, 135 insertions(+), 49 deletions(-)
 create mode 100755 tests/misc-tests/057-btrfstune-free-space-tree/test.sh

Comments

David Sterba May 2, 2023, 6:25 p.m. UTC | #1
On Tue, May 02, 2023 at 09:01:43AM +0800, Qu Wenruo wrote:
> At the beginning of free space tree feature, it's enabled by
> "space_cache=v2" mount option.
> 
> However this introduced some problems:
> 
> - Lack of proper v1 cache clearing in the past
>   In the past we didn't properly clear v1 cache before enabling v2.
> 
> - More and more complex v2 cache dependency
>   Extent tree v2 and bgt all depend on v2 cache, but we have some
>   mount options like clear_cache can screw this up.
> 
> Instead introducing some mount options to tinkering the filesystem
> features (either compat_ro or incompat), we should always go through
> btrfstune to enable new features (just like what we did in bgt).
> 
> This allows us to move the heavy lifting and proper checks into
> btrfs-progs.
> 
> Although it's already late, it's still better than never, thus this
> patchset introduce the --convert-to-free-space-tree feature to
> btrfstune.
> 
> Unlike bgt, v1 cache is going to fade out soon, thus no rollback
> functionality provided.

Agreed.

> I hope we can deprecate the "space_cache=" mount option soon.

Yes, that would be desirable as the mount option wouldn't make much
sense and it's a mkfs-feature so we don't need to reflect that in mount
options that should be for the run time.

We can drop the space_cache from showing among options once we get rid
of the v1 code. There's no scheduled version for that but it could be
done if somebody wants. We have the conversion working and with the
btrfstune also available it should be complete.

> 
> Qu Wenruo (3):
>   btrfs-progs: make check/clear-cache.c to be separate from check/main.c

Right now we have the --clear-space-cache as an option for 'btrfs check'
but it will also make less sense over time. For such one-shot options
it's better to move it to the 'rescue' group. With a separate
clear-cache.c it's going to be easier.  The existing 'check' option need
to stay for compatibility.

>   btrfs-progs: tune: add --convert-to-free-space-tree option
>   btrfs-progs: misc-tests: add test case to verify btrfstune
>     --convert-to-free-space-tree option

Added to devel, thanks.