Commit Graph

6 Commits

Author SHA1 Message Date
Nikolay Borisov e444c7bfa6 btrfs-progs: check: Fix wrong error message in case of corrupted extent
When btrfs check detects a freespace tree extent which ends beyond the
blockgroup containing it a misleading error messages is printed. For
example if we have the following extent in the freespace tree:

    item 5 key (30408704 FREE_SPACE_INFO 1073741824) itemoff 16259 itemsize 8
            free space info extent count 3 flags 0
    item 6 key (30425088 FREE_SPACE_EXTENT 49152) itemoff 16259 itemsize 0
            free space extent
    item 7 key (30507008 FREE_SPACE_EXTENT 65536) itemoff 16259 itemsize 0
            free space extent
    item 8 key (30654464 FREE_SPACE_EXTENT 14524648038063310901) itemoff 16259 itemsize 0

Clearly the last extent is corrupted so we should print something
along the lines of:

free space extent ends at 14524648038063310901, beyond end of block group 30408704-1104150528

Instead currently this is printed:

free space extent ends at 30654464, beyond end of block group 30408704-1104150528

So instead of printing the actual erroneous end, we print the beginning
of the extent. Fix this by printing the actual corrupted end.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2018-08-06 15:01:32 +02:00
Nikolay Borisov a93d51ede7 btrfs-progs: Remove unused argument from clean_tree_block
This function actually uses only the extent_buffer arg but takes 3
arguments. Furthermore, it's current interface doesn't even mirror
the kernel counterpart. Just remove the extra arguments.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2018-06-07 16:37:37 +02:00
Qu Wenruo caf9c18f66 btrfs-progs: Refactor sectorsize users in free-space-tree.c
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
2017-07-03 13:35:10 +02:00
Omar Sandoval 9814411021 btrfs-progs: add btrfs_clear_free_space_tree() from the kernel
Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 11:07:05 +01:00
David Sterba 374d67fdef btrfs-progs: free-space-tree: minor message adjustments
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-12 15:02:55 +01:00
Omar Sandoval e4797df6a9 btrfs-progs: check the free space tree in btrfsck
This reuses the existing code for checking the free space cache, we just
need to load the free space tree. While we do that, we check a couple of
invariants on the free space tree itself. This requires pulling in some
code from the kernel to exclude the super stripes.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-12 15:02:54 +01:00