aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorAlexander Block <ablock84@googlemail.com>2012-06-05 15:07:48 -0400
committerAlexander Block <ablock84@googlemail.com>2012-07-25 17:30:14 -0400
commit7069830a9e381e33d44ded45095f764844c71d24 (patch)
tree128cdd4c868bdaa436383e20930fbcc3b269de7e /fs/btrfs/ctree.h
parent8ea05e3a4262b9e6871c349fa3486bcfc72ffd1a (diff)
Btrfs: add btrfs_compare_trees function
This function is used to find the differences between two trees. The tree compare skips whole subtrees if it detects shared tree blocks and thus is pretty fast. Signed-off-by: Alexander Block <ablock84@googlemail.com> Reviewed-by: David Sterba <dave@jikos.cz> Reviewed-by: Arne Jansen <sensille@gmx.net> Reviewed-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Reviewed-by: Alex Lyakas <alex.bolshoy.btrfs@gmail.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index d5f6d7458676..2fbbe738caed 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2722,6 +2722,21 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
2722 struct btrfs_key *max_key, 2722 struct btrfs_key *max_key,
2723 struct btrfs_path *path, int cache_only, 2723 struct btrfs_path *path, int cache_only,
2724 u64 min_trans); 2724 u64 min_trans);
2725enum btrfs_compare_tree_result {
2726 BTRFS_COMPARE_TREE_NEW,
2727 BTRFS_COMPARE_TREE_DELETED,
2728 BTRFS_COMPARE_TREE_CHANGED,
2729};
2730typedef int (*btrfs_changed_cb_t)(struct btrfs_root *left_root,
2731 struct btrfs_root *right_root,
2732 struct btrfs_path *left_path,
2733 struct btrfs_path *right_path,
2734 struct btrfs_key *key,
2735 enum btrfs_compare_tree_result result,
2736 void *ctx);
2737int btrfs_compare_trees(struct btrfs_root *left_root,
2738 struct btrfs_root *right_root,
2739 btrfs_changed_cb_t cb, void *ctx);
2725int btrfs_cow_block(struct btrfs_trans_handle *trans, 2740int btrfs_cow_block(struct btrfs_trans_handle *trans,
2726 struct btrfs_root *root, struct extent_buffer *buf, 2741 struct btrfs_root *root, struct extent_buffer *buf,
2727 struct extent_buffer *parent, int parent_slot, 2742 struct extent_buffer *parent, int parent_slot,