summaryrefslogtreecommitdiff
path: root/free-space-tree.c
Commit message (Collapse)AuthorAge
* btrfs-progs: treewide: Fix missing declarationsRosen Penev2018-11-13
| | | | | | | | | | | | Found using -Wmissing-prototypes in GCC. This should improve LTO behavior. Note that set_free_space_tree_thresholds is an unused function. Adding inline seems to remove the unused function warning. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Pull free space tree related code from kernelNikolay Borisov2018-10-25
| | | | | | | | | | | | To help implement free space tree checker in user space some kernel function are necessary, namely iterating/deleting/adding freespace items, some internal search functions. Functions to populate a block group based on the extent tree. The code is largely copy/paste from the kernel with locking eliminated (i.e free_space_lock). It supports reading/writing of both bitmap and extent based FST trees. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Fix wrong error message in case of corrupted extentNikolay Borisov2018-08-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* btrfs-progs: Remove unused argument from clean_tree_blockNikolay Borisov2018-06-07
| | | | | | | | | | 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>
* btrfs-progs: Refactor sectorsize users in free-space-tree.cQu Wenruo2017-07-03
| | | | Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
* btrfs-progs: add btrfs_clear_free_space_tree() from the kernelOmar Sandoval2016-11-23
| | | | | | Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: free-space-tree: minor message adjustmentsDavid Sterba2016-01-12
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check the free space tree in btrfsckOmar Sandoval2016-01-12
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>