Skip to content

Conversation

@maharmstone
Copy link
Contributor

Add support for remap tree to btrfs check, as well as a couple of things to make it so it works with btrfs inspect-internal dump-tree.

This is fairly comprehensive, but it's still missing checking of the remap tree itself (make sure it doesn't contain any unexpected items, make sure there's no overlaps, make sure each remap has a corresponding remap backref). I've also got some code for btrfstune --convert-to-remap-tree that still needs to be cleaned up.

Add btrfs_translate_remap() from the kernel, so that we can read
metadata from block groups that have been remapped.

Signed-off-by: Mark Harmstone <[email protected]>
Port the changes made in the kernel version of btrfs_check_chunk_valid()
back to progs, so that it no longer fails when encountering a block
group that has been remapped.

Signed-off-by: Mark Harmstone <[email protected]>
The remap tree does not have backrefs in the extent tree. Fix btrfs check so
that it doesn't throw an error because these aren't present, but does
throw an error if they unexpectedly found.

Signed-off-by: Mark Harmstone <[email protected]>
Add a check in check_extent_type() that the remap tree is in the correct
block group type.

Signed-off-by: Mark Harmstone <[email protected]>
Fix check_extent_refs() so that it no longer gives a "ref mismatch"
error when processing the remap tree, due to missing backrefs.

Signed-off-by: Mark Harmstone <[email protected]>
…ock groups

The remap tree doesn't have backrefs, so we can't use these to calculate
the expected `used` value for the block group like we normally do.
Instead, keep a running total when we're walking through its nodes.

Signed-off-by: Mark Harmstone <[email protected]>
Remapped block groups don't have any entries in the free-space tree, as
no new allocations can be made from them. Instead of walking the
free-space tree, walk the remap tree and treat the holes between the
remap or identity remaps as free space.

Signed-off-by: Mark Harmstone <[email protected]>
We can't find the used blocks in the remap tree from the extent root, so
instead visit each of the internal ndoes in the remap tree.

Signed-off-by: Mark Harmstone <[email protected]>
Fully remapped chunks have zero stripes. Fix a couple of instances where
we're assuming that num_stripes will be at least 1.

Signed-off-by: Mark Harmstone <[email protected]>
Add some miscelleaneous string identifiers for the remap tree, the items
within it, and its incompat flag.

Signed-off-by: Mark Harmstone <[email protected]>
@maharmstone
Copy link
Contributor Author

GitHub is having trouble at the moment, I think that's why the CI failed

…ump-tree`

Add print_remap_key(), so that remap items and remap backref items get
dumped correctly when running `btrfs inspect-internal dump-tree`.

Signed-off-by: Mark Harmstone <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant