From 501dc44c7f64058d19c452506c30dcf951286655 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Tue, 29 Dec 2020 08:30:35 +0800 Subject: [PATCH] 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 Signed-off-by: David Sterba --- check/main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/check/main.c b/check/main.c index 8ad7f588..c7c5408b 100644 --- a/check/main.c +++ b/check/main.c @@ -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");