From 9db13dca2f00b8a7cfd31fb737cfd0e73ad48abf Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Mon, 22 Feb 2016 14:59:55 +0800 Subject: btrfs-progs: Add support for tree block operations on fs_info without roots Since open_ctree_fs_info() now may return a fs_info even without any roots, modify functions like read_tree_block() to operate with such fs_info. This provides the basis for btrfs-find-root to operate on chunk tree with corrupted fs. Signed-off-by: Qu Wenruo [ coding style adjustments, unified declarations ] Signed-off-by: David Sterba --- disk-io.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'disk-io.h') diff --git a/disk-io.h b/disk-io.h index c2eb1d6e..30ccb2bd 100644 --- a/disk-io.h +++ b/disk-io.h @@ -75,14 +75,23 @@ static inline u64 btrfs_sb_offset(int mirror) struct btrfs_device; int read_whole_eb(struct btrfs_fs_info *info, struct extent_buffer *eb, int mirror); -struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr, - u32 blocksize, u64 parent_transid); +struct extent_buffer* read_tree_block_fs_info( + struct btrfs_fs_info *fs_info, u64 bytenr, u32 blocksize, + u64 parent_transid); +static inline struct extent_buffer* read_tree_block( + struct btrfs_root *root, u64 bytenr, u32 blocksize, + u64 parent_transid) +{ + return read_tree_block_fs_info(root->fs_info, bytenr, blocksize, + parent_transid); +} + int read_extent_data(struct btrfs_root *root, char *data, u64 logical, u64 *len, int mirror); void readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize, u64 parent_transid); -struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, - u64 bytenr, u32 blocksize); +struct extent_buffer* btrfs_find_create_tree_block( + struct btrfs_fs_info *fs_info, u64 bytenr, u32 blocksize); int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize, u32 stripesize, struct btrfs_root *root, -- cgit v1.2.3