Skip to content

Conversation

@adam900710
Copy link
Collaborator

Since v6.16.1 btrfs check adds the ability to detect orphan free space entries, and older mkfs.btrfs forgot to delete free space entries of temporary chunks.

Although we're already pushing for a kernel auto fix, the kernel fix will take some time to reach upstream, and more time to reach distros.

So there is still some value to have the repair ability in btrfs-check.

Furthermore, the new repair ability is more flex than the kernel one, which can handle orphan free space info key, not only before the first bg but any one without a bg.

And also output the logical and length for the orphan space info key.

Now the new reports will looks like this:

 [4/8] checking free space tree
 Space key logical 1048576 length 4194304 has no corresponding block group
 Space key logical 5242880 length 8388608 has no corresponding block group

This shouldn't affect end users that much, but provide much better debug
info for developers who want to fix those bad free space tree entries.

Signed-off-by: Qu Wenruo <[email protected]>
Although we're pushing for the kernel auto fix, it may still take some
time.
Meanwhile having a proper way to fix it in progs will never hurt.

The repair itself is a little more complex than the kernel one, which
only needs to bother the entries before the first block group.

This progs version in theory is able to handle orphan entries at any
location, but for now it's only for the entries before the first bg.

Signed-off-by: Qu Wenruo <[email protected]>
entries

The image is created by creating an empty btrfs with older v6.16 btrfs-progs.
Which has free space tree entries for two temporary block groups.

And the test itself is going through the common repair test procedure.

Signed-off-by: Qu Wenruo <[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