Linux 6.13-rc4
[linux.git] / fs / btrfs / tree-mod-log.h
blob1c12566040db52ff54a6a15eab170980e90327ee
1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef BTRFS_TREE_MOD_LOG_H
4 #define BTRFS_TREE_MOD_LOG_H
6 #include <linux/list.h>
8 struct extent_buffer;
9 struct btrfs_fs_info;
10 struct btrfs_path;
11 struct btrfs_root;
12 struct btrfs_seq_list;
14 /* Represents a tree mod log user. */
15 struct btrfs_seq_list {
16 struct list_head list;
17 u64 seq;
20 #define BTRFS_SEQ_LIST_INIT(name) { .list = LIST_HEAD_INIT((name).list), .seq = 0 }
21 #define BTRFS_SEQ_LAST ((u64)-1)
23 enum btrfs_mod_log_op {
24 BTRFS_MOD_LOG_KEY_REPLACE,
25 BTRFS_MOD_LOG_KEY_ADD,
26 BTRFS_MOD_LOG_KEY_REMOVE,
27 BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING,
28 BTRFS_MOD_LOG_KEY_REMOVE_WHILE_MOVING,
29 BTRFS_MOD_LOG_MOVE_KEYS,
30 BTRFS_MOD_LOG_ROOT_REPLACE,
33 u64 btrfs_get_tree_mod_seq(struct btrfs_fs_info *fs_info,
34 struct btrfs_seq_list *elem);
35 void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info,
36 struct btrfs_seq_list *elem);
37 int btrfs_tree_mod_log_insert_root(struct extent_buffer *old_root,
38 struct extent_buffer *new_root,
39 bool log_removal);
40 int btrfs_tree_mod_log_insert_key(const struct extent_buffer *eb, int slot,
41 enum btrfs_mod_log_op op);
42 int btrfs_tree_mod_log_free_eb(struct extent_buffer *eb);
43 struct extent_buffer *btrfs_tree_mod_log_rewind(struct btrfs_fs_info *fs_info,
44 struct extent_buffer *eb,
45 u64 time_seq);
46 struct extent_buffer *btrfs_get_old_root(struct btrfs_root *root, u64 time_seq);
47 int btrfs_old_root_level(struct btrfs_root *root, u64 time_seq);
48 int btrfs_tree_mod_log_eb_copy(struct extent_buffer *dst,
49 const struct extent_buffer *src,
50 unsigned long dst_offset,
51 unsigned long src_offset,
52 int nr_items);
53 int btrfs_tree_mod_log_insert_move(const struct extent_buffer *eb,
54 int dst_slot, int src_slot,
55 int nr_items);
56 u64 btrfs_tree_mod_log_lowest_seq(struct btrfs_fs_info *fs_info);
58 #endif