btrfs-progs: Refactor csum_tree_block to use btrfs_fs_info

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
master
Qu Wenruo 2017-06-13 17:19:20 +08:00 committed by David Sterba
parent 824a300ec8
commit 5c8d747cc6
2 changed files with 6 additions and 12 deletions

View File

@ -164,8 +164,8 @@ int verify_tree_block_csum_silent(struct extent_buffer *buf, u16 csum_size)
return __csum_tree_block_size(buf, csum_size, 1, 1);
}
static int csum_tree_block_fs_info(struct btrfs_fs_info *fs_info,
struct extent_buffer *buf, int verify)
int csum_tree_block(struct btrfs_fs_info *fs_info,
struct extent_buffer *buf, int verify)
{
u16 csum_size =
btrfs_super_csum_size(fs_info->super_copy);
@ -174,12 +174,6 @@ static int csum_tree_block_fs_info(struct btrfs_fs_info *fs_info,
return csum_tree_block_size(buf, csum_size, verify);
}
int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
int verify)
{
return csum_tree_block_fs_info(root->fs_info, buf, verify);
}
struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root,
u64 bytenr, u32 blocksize)
{
@ -345,7 +339,7 @@ struct extent_buffer* read_tree_block(
while (1) {
ret = read_whole_eb(fs_info, eb, mirror_num);
if (ret == 0 && csum_tree_block_fs_info(fs_info, eb, 1) == 0 &&
if (ret == 0 && csum_tree_block(fs_info, eb, 1) == 0 &&
check_tree_block(fs_info, eb) == 0 &&
verify_parent_transid(eb->tree, eb, parent_transid, ignore)
== 0) {
@ -468,7 +462,7 @@ int write_tree_block(struct btrfs_trans_handle *trans,
BUG();
btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
csum_tree_block(root, eb, 0);
csum_tree_block(root->fs_info, eb, 0);
return write_and_map_eb(root, eb);
}

View File

@ -115,8 +115,8 @@ u64 btrfs_device_size(int fd, struct stat *st);
int get_label_mounted(const char *mount_path, char *labelp);
int get_label_unmounted(const char *dev, char *label);
int group_profile_max_safe_loss(u64 flags);
int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
int verify);
int csum_tree_block(struct btrfs_fs_info *root, struct extent_buffer *buf,
int verify);
int ask_user(const char *question);
int lookup_path_rootid(int fd, u64 *rootid);
int btrfs_scan_devices(void);