summaryrefslogtreecommitdiff
path: root/find-root.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2016-02-22 14:59:56 +0800
committerDavid Sterba <dsterba@suse.com>2016-02-26 17:27:58 +0100
commitc8c3715969a1e9d3af39863583cfbe4025db11d5 (patch)
treeed610203b2668861d064b60275c57c1a039d0e9b /find-root.c
parent9db13dca2f00b8a7cfd31fb737cfd0e73ad48abf (diff)
btrfs-progs: find-root: Allow btrfs-find-root to search chunk root even chunk root is corrupted
Since now open_ctree_fs_info() can even return a valid fs_info with only system chunk mapping from super block, use this ability to do chunk root search for heavily damanged fs. As an fast alternative for time consuming and buggy chunk-recovery. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'find-root.c')
-rw-r--r--find-root.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/find-root.c b/find-root.c
index f0204c80..823db6ad 100644
--- a/find-root.c
+++ b/find-root.c
@@ -101,17 +101,16 @@ static int add_eb_to_result(struct extent_buffer *eb,
* Return 1 if found root with given gen/level and set *match to it.
* Return <0 if error happens
*/
-int btrfs_find_root_search(struct btrfs_root *chunk_root,
+int btrfs_find_root_search(struct btrfs_fs_info *fs_info,
struct btrfs_find_root_filter *filter,
struct cache_tree *result,
struct cache_extent **match)
{
- struct btrfs_fs_info *fs_info = chunk_root->fs_info;
struct extent_buffer *eb;
u64 chunk_offset = 0;
u64 chunk_size = 0;
u64 offset = 0;
- u32 leafsize = chunk_root->leafsize;
+ u32 leafsize = btrfs_super_leafsize(fs_info->super_copy);
int suppress_errors = 0;
int ret = 0;
@@ -133,8 +132,9 @@ int btrfs_find_root_search(struct btrfs_root *chunk_root,
}
for (offset = chunk_offset;
offset < chunk_offset + chunk_size;
- offset += chunk_root->leafsize) {
- eb = read_tree_block(chunk_root, offset, leafsize, 0);
+ offset += leafsize) {
+ eb = read_tree_block_fs_info(fs_info, offset, leafsize,
+ 0);
if (!eb || IS_ERR(eb))
continue;
ret = add_eb_to_result(eb, result, leafsize, filter,