path: root/btrfsck.h
diff options
authorQu Wenruo <>2014-10-30 10:54:03 +0800
committerDavid Sterba <>2014-12-04 16:48:13 +0100
commit0ffacad2906cdb8f62fb56565632160a1a82ad14 (patch)
tree7534854b9e8a2b820b1591c26e41410cb8b1e28e /btrfsck.h
parente7c4e700ffa656af4b221a2068b02b391b0ed817 (diff)
btrfs-progs: rebuild missing block group during chunk recovery if possible
Before the patch, chunk will be considered bad if the corresponding block group is missing, even the only uncertain data is the 'used' member of the block group. This patch will try to recalculate the 'used' value of the block group and rebuild it. So even only chunk item and dev extent item is found, the chunk can be recovered. Although if extent tree is damanged and needed extent item can't be read, the block group's 'used' value will be the block group length, to prevent any later write/block reserve damaging the block group. In that case, we will prompt user and recommend them to use '--init-extent-tree' to rebuild extent tree if possible. Signed-off-by: Qu Wenruo <> Signed-off-by: David Sterba <>
Diffstat (limited to 'btrfsck.h')
1 files changed, 2 insertions, 1 deletions
diff --git a/btrfsck.h b/btrfsck.h
index 356c7673..7a506480 100644
--- a/btrfsck.h
+++ b/btrfsck.h
@@ -179,5 +179,6 @@ btrfs_new_device_extent_record(struct extent_buffer *leaf,
int check_chunks(struct cache_tree *chunk_cache,
struct block_group_tree *block_group_cache,
struct device_extent_tree *dev_extent_cache,
- struct list_head *good, struct list_head *bad, int silent);
+ struct list_head *good, struct list_head *bad,
+ struct list_head *rebuild, int silent);