Skip to contentSkip to conversation

btrfs-progs: check: allow force v1 space cache cleanup even the fs has v2 space cache enabled

PATCH In review Qu Wenruo 3 participants 3 messages Dec 29, 2020 – Jan 14, 2021 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 btrfs-progs: check: allow force v1 space cache cleanup even the fs has v2 space cache enabled

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.

---
 check/main.c | 6 ------
 1 file changed, 6 deletions(-)
check/main.c +0 -6
index 8ad7f5886f06..f4755d260bfe 100644
@@ -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");
Signature · 1 line
2.29.2
#1 lore raw
Quoted 33 lines · Qu Wenruo

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.

---
check/main.c | 6 ------

1 file changed, 6 deletions(-)
check/main.c +0 -6
index 8ad7f5886f06..f4755d260bfe 100644
@@ -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");
Signature · 1 line
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.

#2 lore raw
Quoted 33 lines · Stéphane Lesimple
Quoted 31 lines · Qu Wenruo

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.

---
check/main.c | 6 ------

1 file changed, 6 deletions(-)
check/main.c +0 -6
index 8ad7f5886f06..f4755d260bfe 100644
@@ -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");
Quoted 8 lines
Quoted 2 lines
Signature · 1 line
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.