btrfs-progs: check: only warn if clearing v1 cache and v2 found

There are cases where v1 free space cache is still left while user has
already enabled v2 cache.  In that case, we still want to force v1 space
cache cleanup in btrfs-check.

This patch will only warn and not exit if v2 is detected while the user
asked to clear v1.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2020-12-29 08:30:35 +08:00 committed by David Sterba
parent 9870d504d8
commit 501dc44c7f
1 changed files with 4 additions and 6 deletions

View File

@ -9917,12 +9917,10 @@ static int do_clear_free_space_cache(int clear_version)
int ret = 0;
if (clear_version == 1) {
if (btrfs_fs_compat_ro(gfs_info, FREE_SPACE_TREE)) {
error(
"free space cache v2 detected, use --clear-space-cache v2");
ret = 1;
goto close_out;
}
if (btrfs_fs_compat_ro(gfs_info, FREE_SPACE_TREE))
warning(
"free space cache v2 detected, use --clear-space-cache v2, proceeding with clearing v1");
ret = clear_free_space_cache();
if (ret) {
error("failed to clear free space cache");