All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: check: allow force v1 space cache cleanup even the fs has v2 space cache enabled
@ 2020-12-29  0:30 Qu Wenruo
  2020-12-29  9:34 ` Stéphane Lesimple
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2020-12-29  0:30 UTC (permalink / raw)
  To: linux-btrfs

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 remove the v2 check if we're cleaning up v1 cache,
allowing us to cleanup the leftover.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 check/main.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/check/main.c b/check/main.c
index 8ad7f5886f06..f4755d260bfe 100644
--- a/check/main.c
+++ b/check/main.c
@@ -9917,12 +9917,6 @@ 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;
-		}
 		ret = clear_free_space_cache();
 		if (ret) {
 			error("failed to clear free space cache");
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs-progs: check: allow force v1 space cache cleanup even the fs has v2 space cache enabled
  2020-12-29  0:30 [PATCH] btrfs-progs: check: allow force v1 space cache cleanup even the fs has v2 space cache enabled Qu Wenruo
@ 2020-12-29  9:34 ` Stéphane Lesimple
  2021-01-14 18:49   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Stéphane Lesimple @ 2020-12-29  9:34 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs

December 29, 2020 1:32 AM, "Qu Wenruo" <wqu@suse.com> wrote:

> 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 remove the v2 check if we're cleaning up v1 cache,
> allowing us to cleanup the leftover.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> check/main.c | 6 ------
> 1 file changed, 6 deletions(-)
> 
> diff --git a/check/main.c b/check/main.c
> index 8ad7f5886f06..f4755d260bfe 100644
> --- a/check/main.c
> +++ b/check/main.c
> @@ -9917,12 +9917,6 @@ 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;
> - }
> ret = clear_free_space_cache();
> if (ret) {
> error("failed to clear free space cache");
> -- 
> 2.29.2


Maybe we should keep the message but make it not fatal?
Something like "free space cache v2 detected, use --clear-space-cache v2 to clear it. Proceeding in clearing potential v1 leftovers as asked..."?

Regards,

Stéphane.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs-progs: check: allow force v1 space cache cleanup even the fs has v2 space cache enabled
  2020-12-29  9:34 ` Stéphane Lesimple
@ 2021-01-14 18:49   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2021-01-14 18:49 UTC (permalink / raw)
  To: Stéphane Lesimple; +Cc: Qu Wenruo, linux-btrfs

On Tue, Dec 29, 2020 at 09:34:51AM +0000, Stéphane Lesimple wrote:
> December 29, 2020 1:32 AM, "Qu Wenruo" <wqu@suse.com> wrote:
> 
> > 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 remove the v2 check if we're cleaning up v1 cache,
> > allowing us to cleanup the leftover.
> > 
> > Signed-off-by: Qu Wenruo <wqu@suse.com>
> > ---
> > check/main.c | 6 ------
> > 1 file changed, 6 deletions(-)
> > 
> > diff --git a/check/main.c b/check/main.c
> > index 8ad7f5886f06..f4755d260bfe 100644
> > --- a/check/main.c
> > +++ b/check/main.c
> > @@ -9917,12 +9917,6 @@ 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;
> > - }
> > ret = clear_free_space_cache();
> > if (ret) {
> > error("failed to clear free space cache");
> > -- 
> > 2.29.2
> 
> 
> Maybe we should keep the message but make it not fatal?
> Something like "free space cache v2 detected, use --clear-space-cache
> v2 to clear it. Proceeding in clearing potential v1 leftovers as
> asked..."?

This sounds like a good option, thanks. I'll update the patch when I
commit it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-14 18:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29  0:30 [PATCH] btrfs-progs: check: allow force v1 space cache cleanup even the fs has v2 space cache enabled Qu Wenruo
2020-12-29  9:34 ` Stéphane Lesimple
2021-01-14 18:49   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.