summaryrefslogtreecommitdiff
path: root/btrfs-corrupt-block.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2017-05-18 10:51:08 +0800
committerDavid Sterba <dsterba@suse.com>2017-07-03 13:35:11 +0200
commit8690c887d1dcad384d44ca21bf950a4ec2fbffdb (patch)
treebf736b51824e4e834c4d0e8ea79169bf40849d04 /btrfs-corrupt-block.c
parent060c7b3a1a40d2e9cacbdb37a02791bacae32491 (diff)
btrfs-progs: Refactor read_tree_block to get rid of btrfs_root
The only reasom read_tree_block() needs a btrfs_root parameter is to get its node/sector size. And long ago, I have already introduced a compactible interface, read_tree_block_fs_info() to pass btrfs_fs_info instead of btrfs_root. Since we have cleaned up all root->sector/node/stripesize users, we should be OK to refactor read_tree_block() function. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Diffstat (limited to 'btrfs-corrupt-block.c')
-rw-r--r--btrfs-corrupt-block.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c
index 5649a00e..f29f22d2 100644
--- a/btrfs-corrupt-block.c
+++ b/btrfs-corrupt-block.c
@@ -169,7 +169,7 @@ static int corrupt_keys_in_block(struct btrfs_fs_info *fs_info, u64 bytenr)
{
struct extent_buffer *eb;
- eb = read_tree_block_fs_info(fs_info, bytenr, fs_info->nodesize, 0);
+ eb = read_tree_block(fs_info, bytenr, fs_info->nodesize, 0);
if (!extent_buffer_uptodate(eb))
return -EIO;;
@@ -278,6 +278,7 @@ static void btrfs_corrupt_extent_tree(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct extent_buffer *eb)
{
+ struct btrfs_fs_info *fs_info = root->fs_info;
int i;
if (!eb)
@@ -296,8 +297,8 @@ static void btrfs_corrupt_extent_tree(struct btrfs_trans_handle *trans,
for (i = 0; i < btrfs_header_nritems(eb); i++) {
struct extent_buffer *next;
- next = read_tree_block(root, btrfs_node_blockptr(eb, i),
- root->fs_info->nodesize,
+ next = read_tree_block(fs_info, btrfs_node_blockptr(eb, i),
+ fs_info->nodesize,
btrfs_node_ptr_generation(eb, i));
if (!extent_buffer_uptodate(next))
continue;
@@ -765,7 +766,7 @@ static int corrupt_metadata_block(struct btrfs_fs_info *fs_info, u64 block,
return -EINVAL;
}
- eb = read_tree_block_fs_info(fs_info, block, fs_info->nodesize, 0);
+ eb = read_tree_block(fs_info, block, fs_info->nodesize, 0);
if (!extent_buffer_uptodate(eb)) {
fprintf(stderr, "Couldn't read in tree block %s\n", field);
return -EINVAL;