1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef BTRFS_TREE_MOD_LOG_H
4 #define BTRFS_TREE_MOD_LOG_H
8 /* Represents a tree mod log user. */
9 struct btrfs_seq_list {
10 struct list_head list;
14 #define BTRFS_SEQ_LIST_INIT(name) { .list = LIST_HEAD_INIT((name).list), .seq = 0 }
15 #define BTRFS_SEQ_LAST ((u64)-1)
17 enum btrfs_mod_log_op {
18 BTRFS_MOD_LOG_KEY_REPLACE,
19 BTRFS_MOD_LOG_KEY_ADD,
20 BTRFS_MOD_LOG_KEY_REMOVE,
21 BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING,
22 BTRFS_MOD_LOG_KEY_REMOVE_WHILE_MOVING,
23 BTRFS_MOD_LOG_MOVE_KEYS,
24 BTRFS_MOD_LOG_ROOT_REPLACE,
27 u64 btrfs_get_tree_mod_seq(struct btrfs_fs_info *fs_info,
28 struct btrfs_seq_list *elem);
29 void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info,
30 struct btrfs_seq_list *elem);
31 int btrfs_tree_mod_log_insert_root(struct extent_buffer *old_root,
32 struct extent_buffer *new_root,
34 int btrfs_tree_mod_log_insert_key(struct extent_buffer *eb, int slot,
35 enum btrfs_mod_log_op op);
36 int btrfs_tree_mod_log_free_eb(struct extent_buffer *eb);
37 struct extent_buffer *btrfs_tree_mod_log_rewind(struct btrfs_fs_info *fs_info,
38 struct btrfs_path *path,
39 struct extent_buffer *eb,
41 struct extent_buffer *btrfs_get_old_root(struct btrfs_root *root, u64 time_seq);
42 int btrfs_old_root_level(struct btrfs_root *root, u64 time_seq);
43 int btrfs_tree_mod_log_eb_copy(struct extent_buffer *dst,
44 struct extent_buffer *src,
45 unsigned long dst_offset,
46 unsigned long src_offset,
48 int btrfs_tree_mod_log_insert_move(struct extent_buffer *eb,
49 int dst_slot, int src_slot,
51 u64 btrfs_tree_mod_log_lowest_seq(struct btrfs_fs_info *fs_info);