Commit 7069830a authored by Alexander Block's avatar Alexander Block

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: default avatarAlexander Block <ablock84@googlemail.com>
Reviewed-by: default avatarDavid Sterba <dave@jikos.cz>
Reviewed-by: default avatarArne Jansen <sensille@gmx.net>
Reviewed-by: default avatarJan Schmidt <list.btrfs@jan-o-sch.net>
Reviewed-by: default avatarAlex Lyakas <alex.bolshoy.btrfs@gmail.com>
parent 8ea05e3a
This diff is collapsed.
...@@ -2722,6 +2722,21 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key, ...@@ -2722,6 +2722,21 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
struct btrfs_key *max_key, struct btrfs_key *max_key,
struct btrfs_path *path, int cache_only, struct btrfs_path *path, int cache_only,
u64 min_trans); u64 min_trans);
enum btrfs_compare_tree_result {
BTRFS_COMPARE_TREE_NEW,
BTRFS_COMPARE_TREE_DELETED,
BTRFS_COMPARE_TREE_CHANGED,
};
typedef int (*btrfs_changed_cb_t)(struct btrfs_root *left_root,
struct btrfs_root *right_root,
struct btrfs_path *left_path,
struct btrfs_path *right_path,
struct btrfs_key *key,
enum btrfs_compare_tree_result result,
void *ctx);
int btrfs_compare_trees(struct btrfs_root *left_root,
struct btrfs_root *right_root,
btrfs_changed_cb_t cb, void *ctx);
int btrfs_cow_block(struct btrfs_trans_handle *trans, int btrfs_cow_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct extent_buffer *buf, struct btrfs_root *root, struct extent_buffer *buf,
struct extent_buffer *parent, int parent_slot, struct extent_buffer *parent, int parent_slot,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment