btrfs-progs: Export write_tree_block
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Mon, 11 May 2015 08:08:46 +0000 (16:08 +0800)
committerDavid Sterba <dsterba@suse.cz>
Thu, 14 May 2015 13:41:07 +0000 (15:41 +0200)
Export write_tree_block() function and allow it write extent without
transaction.

This provides the basis for later uuid change function.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
disk-io.c
disk-io.h

index 3daed3b..2a7feb0 100644 (file)
--- a/disk-io.c
+++ b/disk-io.c
@@ -372,7 +372,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)
 {
@@ -381,7 +381,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);
index 19f333e..62eb566 100644 (file)
--- a/disk-io.h
+++ b/disk-io.h
@@ -126,6 +126,9 @@ int csum_tree_block_size(struct extent_buffer *buf, u16 csum_sectorsize,
                         int verify);
 int verify_tree_block_csum_silent(struct extent_buffer *buf, u16 csum_size);
 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_trans_handle *trans, struct btrfs_root *root,
                     struct extent_buffer *eb);