diff options
Diffstat (limited to 'disk-io.c')
-rw-r--r-- | disk-io.c | 31 |
1 files changed, 19 insertions, 12 deletions
@@ -312,9 +312,9 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr, return NULL; } -static int write_tree_block(struct btrfs_trans_handle *trans, - struct btrfs_root *root, - struct extent_buffer *eb) +int write_and_map_eb(struct btrfs_trans_handle *trans, + struct btrfs_root *root, + struct extent_buffer *eb) { int ret; int dev_nr; @@ -322,15 +322,6 @@ static int write_tree_block(struct btrfs_trans_handle *trans, u64 *raid_map = NULL; struct btrfs_multi_bio *multi = NULL; - if (check_tree_block(root, eb)) - BUG(); - - if (!btrfs_buffer_uptodate(eb, trans->transid)) - BUG(); - - btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN); - csum_tree_block(root, eb, 0); - dev_nr = 0; length = eb->len; ret = btrfs_map_block(&root->fs_info->mapping_tree, WRITE, @@ -353,6 +344,22 @@ static int write_tree_block(struct btrfs_trans_handle *trans, return 0; } +int write_tree_block(struct btrfs_trans_handle *trans, + struct btrfs_root *root, + struct extent_buffer *eb) +{ + if (check_tree_block(root, eb)) + BUG(); + + if (!btrfs_buffer_uptodate(eb, trans->transid)) + BUG(); + + btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN); + csum_tree_block(root, eb, 0); + + return write_and_map_eb(trans, root, eb); +} + int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize, u32 stripesize, struct btrfs_root *root, struct btrfs_fs_info *fs_info, u64 objectid) |