btrfs-progs: Refactor write_and_map_eb to use btrfs_fs_info
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5c8d747cc6
commit
790b5950f3
|
@ -370,7 +370,7 @@ static int migrate_one_reserved_range(struct btrfs_trans_handle *trans,
|
|||
eb->len = key.offset;
|
||||
|
||||
/* Write the data */
|
||||
ret = write_and_map_eb(root, eb);
|
||||
ret = write_and_map_eb(root->fs_info, eb);
|
||||
free(eb);
|
||||
if (ret < 0)
|
||||
break;
|
||||
|
|
|
@ -417,7 +417,7 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int write_and_map_eb(struct btrfs_root *root, struct extent_buffer *eb)
|
||||
int write_and_map_eb(struct btrfs_fs_info *fs_info, struct extent_buffer *eb)
|
||||
{
|
||||
int ret;
|
||||
int dev_nr;
|
||||
|
@ -427,11 +427,11 @@ int write_and_map_eb(struct btrfs_root *root, struct extent_buffer *eb)
|
|||
|
||||
dev_nr = 0;
|
||||
length = eb->len;
|
||||
ret = btrfs_map_block(root->fs_info, WRITE, eb->start, &length,
|
||||
ret = btrfs_map_block(fs_info, WRITE, eb->start, &length,
|
||||
&multi, 0, &raid_map);
|
||||
|
||||
if (raid_map) {
|
||||
ret = write_raid56_with_parity(root->fs_info, eb, multi,
|
||||
ret = write_raid56_with_parity(fs_info, eb, multi,
|
||||
length, raid_map);
|
||||
BUG_ON(ret);
|
||||
} else while (dev_nr < multi->num_stripes) {
|
||||
|
@ -464,7 +464,7 @@ int write_tree_block(struct btrfs_trans_handle *trans,
|
|||
btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
|
||||
csum_tree_block(root->fs_info, eb, 0);
|
||||
|
||||
return write_and_map_eb(root, eb);
|
||||
return write_and_map_eb(root->fs_info, eb);
|
||||
}
|
||||
|
||||
void btrfs_setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
|
||||
|
|
|
@ -191,6 +191,6 @@ int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid);
|
|||
int write_tree_block(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root,
|
||||
struct extent_buffer *eb);
|
||||
int write_and_map_eb(struct btrfs_root *root, struct extent_buffer *eb);
|
||||
int write_and_map_eb(struct btrfs_fs_info *fs_info, struct extent_buffer *eb);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -753,7 +753,7 @@ again:
|
|||
if (ret)
|
||||
goto end;
|
||||
|
||||
ret = write_and_map_eb(root, eb);
|
||||
ret = write_and_map_eb(root->fs_info, eb);
|
||||
if (ret) {
|
||||
error("failed to write %s", path_name);
|
||||
goto end;
|
||||
|
|
Loading…
Reference in New Issue