@@ -371,7 +371,7 @@ int write_and_map_eb(struct btrfs_trans_handle *trans,
return 0;
}
-static int write_tree_block(struct btrfs_trans_handle *trans,
+int write_tree_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct extent_buffer *eb)
{
@@ -380,7 +380,7 @@ static int write_tree_block(struct btrfs_trans_handle *trans,
BUG();
}
- if (!btrfs_buffer_uptodate(eb, trans->transid))
+ if (trans && !btrfs_buffer_uptodate(eb, trans->transid))
BUG();
btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
@@ -59,6 +59,9 @@ 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);
+int write_tree_block(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ struct extent_buffer *eb);
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,
Export write_tree_block() function, and allow it to write data to disk without transaction. This is useful for resetting tree block csum, where the reset is done level by level, so btrfs_search_slot() is doing lowest_level search and can't do cow (cow with lowest_level will screw up extent backref). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> --- disk-io.c | 4 ++-- disk-io.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-)