diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2015-11-13 10:53:41 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2015-11-16 14:23:45 +0100 |
commit | 214308422933601138ee484e81dade47edcb442c (patch) | |
tree | 5dbdc5138a81dd7f1067d57180bae246ff762bbf /find-root.c | |
parent | 0ca4cd99a50cfe942701fa915f34b6543a89bc98 (diff) |
btrfs-progs: find-root: Add support to search chunk root
Add support to search chunk root, as we only need to search tree roots
in system chunk, which should be very easy to add, just iterate in
system chunks.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ renamed to btrfs_next_bg_* ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'find-root.c')
-rw-r--r-- | find-root.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/find-root.c b/find-root.c index 55e79423..f0204c80 100644 --- a/find-root.c +++ b/find-root.c @@ -108,8 +108,8 @@ int btrfs_find_root_search(struct btrfs_root *chunk_root, { struct btrfs_fs_info *fs_info = chunk_root->fs_info; struct extent_buffer *eb; - u64 metadata_offset = 0; - u64 metadata_size = 0; + u64 chunk_offset = 0; + u64 chunk_size = 0; u64 offset = 0; u32 leafsize = chunk_root->leafsize; int suppress_errors = 0; @@ -118,15 +118,21 @@ int btrfs_find_root_search(struct btrfs_root *chunk_root, suppress_errors = fs_info->suppress_check_block_errors; fs_info->suppress_check_block_errors = 1; while (1) { - ret = btrfs_next_metadata(&fs_info->mapping_tree, - &metadata_offset, &metadata_size); + if (filter->objectid != BTRFS_CHUNK_TREE_OBJECTID) + ret = btrfs_next_bg_metadata(&fs_info->mapping_tree, + &chunk_offset, + &chunk_size); + else + ret = btrfs_next_bg_system(&fs_info->mapping_tree, + &chunk_offset, + &chunk_size); if (ret) { if (ret == -ENOENT) ret = 0; break; } - for (offset = metadata_offset; - offset < metadata_offset + metadata_size; + for (offset = chunk_offset; + offset < chunk_offset + chunk_size; offset += chunk_root->leafsize) { eb = read_tree_block(chunk_root, offset, leafsize, 0); if (!eb || IS_ERR(eb)) |