diff mbox series

[12/20] btrfs-progs: mark reloc roots as used

Message ID 1da6c61af04c10b8a7e682676121e1031753fe69.1636143924.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: extent tree v2 global root support prep work | expand

Commit Message

Josef Bacik Nov. 5, 2021, 8:28 p.m. UTC
btrfs_mark_used_tree_blocks skips the reloc roots for some reason, which
causes problems because these blocks are in use, and we use this helper
to determine if the block accounting is correct with extent tree v2.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 common/repair.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Qu Wenruo Nov. 6, 2021, 12:39 a.m. UTC | #1
On 2021/11/6 04:28, Josef Bacik wrote:
> btrfs_mark_used_tree_blocks skips the reloc roots for some reason, which
> causes problems because these blocks are in use, and we use this helper
> to determine if the block accounting is correct with extent tree v2.

Any idea on why it's skipped in the first place?

Thanks,
Qu

>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>   common/repair.c | 4 ----
>   1 file changed, 4 deletions(-)
>
> diff --git a/common/repair.c b/common/repair.c
> index 79519140..413c3e86 100644
> --- a/common/repair.c
> +++ b/common/repair.c
> @@ -87,10 +87,6 @@ static int traverse_tree_blocks(struct btrfs_fs_info *fs_info,
>   			btrfs_item_key_to_cpu(eb, &key, i);
>   			if (key.type != BTRFS_ROOT_ITEM_KEY)
>   				continue;
> -			/* Skip the extent root and reloc roots */
> -			if (key.objectid == BTRFS_TREE_RELOC_OBJECTID ||
> -			    key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID)
> -				continue;
>   			is_extent_root =
>   				key.objectid == BTRFS_EXTENT_TREE_OBJECTID;
>   			/* If pin, skip the extent root */
>
Josef Bacik Nov. 8, 2021, 7:14 p.m. UTC | #2
On Sat, Nov 06, 2021 at 08:39:23AM +0800, Qu Wenruo wrote:
> 
> 
> On 2021/11/6 04:28, Josef Bacik wrote:
> > btrfs_mark_used_tree_blocks skips the reloc roots for some reason, which
> > causes problems because these blocks are in use, and we use this helper
> > to determine if the block accounting is correct with extent tree v2.
> 
> Any idea on why it's skipped in the first place?
> 

Yeah I added it apparently in

439ce45e ("Btrfs-progs: add --init-extent-tree to btrfsck")

because at the time we didn't deal with the reloc tree properly and I was trying
to unfuck a users file system.  I'm going to say that isn't the case anymore.
Thanks,

Josef
Qu Wenruo Nov. 9, 2021, 12:57 a.m. UTC | #3
On 2021/11/9 03:14, Josef Bacik wrote:
> On Sat, Nov 06, 2021 at 08:39:23AM +0800, Qu Wenruo wrote:
>>
>>
>> On 2021/11/6 04:28, Josef Bacik wrote:
>>> btrfs_mark_used_tree_blocks skips the reloc roots for some reason, which
>>> causes problems because these blocks are in use, and we use this helper
>>> to determine if the block accounting is correct with extent tree v2.
>>
>> Any idea on why it's skipped in the first place?
>>
> 
> Yeah I added it apparently in
> 
> 439ce45e ("Btrfs-progs: add --init-extent-tree to btrfsck")
> 
> because at the time we didn't deal with the reloc tree properly and I was trying
> to unfuck a users file system.  I'm going to say that isn't the case anymore.
> Thanks,
> 
> Josef
> 
Then the patch looks fine to me.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
diff mbox series

Patch

diff --git a/common/repair.c b/common/repair.c
index 79519140..413c3e86 100644
--- a/common/repair.c
+++ b/common/repair.c
@@ -87,10 +87,6 @@  static int traverse_tree_blocks(struct btrfs_fs_info *fs_info,
 			btrfs_item_key_to_cpu(eb, &key, i);
 			if (key.type != BTRFS_ROOT_ITEM_KEY)
 				continue;
-			/* Skip the extent root and reloc roots */
-			if (key.objectid == BTRFS_TREE_RELOC_OBJECTID ||
-			    key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID)
-				continue;
 			is_extent_root =
 				key.objectid == BTRFS_EXTENT_TREE_OBJECTID;
 			/* If pin, skip the extent root */