162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci#ifndef BTRFS_TREE_MOD_LOG_H 462306a36Sopenharmony_ci#define BTRFS_TREE_MOD_LOG_H 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#include "ctree.h" 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci/* Represents a tree mod log user. */ 962306a36Sopenharmony_cistruct btrfs_seq_list { 1062306a36Sopenharmony_ci struct list_head list; 1162306a36Sopenharmony_ci u64 seq; 1262306a36Sopenharmony_ci}; 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#define BTRFS_SEQ_LIST_INIT(name) { .list = LIST_HEAD_INIT((name).list), .seq = 0 } 1562306a36Sopenharmony_ci#define BTRFS_SEQ_LAST ((u64)-1) 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_cienum btrfs_mod_log_op { 1862306a36Sopenharmony_ci BTRFS_MOD_LOG_KEY_REPLACE, 1962306a36Sopenharmony_ci BTRFS_MOD_LOG_KEY_ADD, 2062306a36Sopenharmony_ci BTRFS_MOD_LOG_KEY_REMOVE, 2162306a36Sopenharmony_ci BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING, 2262306a36Sopenharmony_ci BTRFS_MOD_LOG_KEY_REMOVE_WHILE_MOVING, 2362306a36Sopenharmony_ci BTRFS_MOD_LOG_MOVE_KEYS, 2462306a36Sopenharmony_ci BTRFS_MOD_LOG_ROOT_REPLACE, 2562306a36Sopenharmony_ci}; 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ciu64 btrfs_get_tree_mod_seq(struct btrfs_fs_info *fs_info, 2862306a36Sopenharmony_ci struct btrfs_seq_list *elem); 2962306a36Sopenharmony_civoid btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info, 3062306a36Sopenharmony_ci struct btrfs_seq_list *elem); 3162306a36Sopenharmony_ciint btrfs_tree_mod_log_insert_root(struct extent_buffer *old_root, 3262306a36Sopenharmony_ci struct extent_buffer *new_root, 3362306a36Sopenharmony_ci bool log_removal); 3462306a36Sopenharmony_ciint btrfs_tree_mod_log_insert_key(struct extent_buffer *eb, int slot, 3562306a36Sopenharmony_ci enum btrfs_mod_log_op op); 3662306a36Sopenharmony_ciint btrfs_tree_mod_log_free_eb(struct extent_buffer *eb); 3762306a36Sopenharmony_cistruct extent_buffer *btrfs_tree_mod_log_rewind(struct btrfs_fs_info *fs_info, 3862306a36Sopenharmony_ci struct btrfs_path *path, 3962306a36Sopenharmony_ci struct extent_buffer *eb, 4062306a36Sopenharmony_ci u64 time_seq); 4162306a36Sopenharmony_cistruct extent_buffer *btrfs_get_old_root(struct btrfs_root *root, u64 time_seq); 4262306a36Sopenharmony_ciint btrfs_old_root_level(struct btrfs_root *root, u64 time_seq); 4362306a36Sopenharmony_ciint btrfs_tree_mod_log_eb_copy(struct extent_buffer *dst, 4462306a36Sopenharmony_ci struct extent_buffer *src, 4562306a36Sopenharmony_ci unsigned long dst_offset, 4662306a36Sopenharmony_ci unsigned long src_offset, 4762306a36Sopenharmony_ci int nr_items); 4862306a36Sopenharmony_ciint btrfs_tree_mod_log_insert_move(struct extent_buffer *eb, 4962306a36Sopenharmony_ci int dst_slot, int src_slot, 5062306a36Sopenharmony_ci int nr_items); 5162306a36Sopenharmony_ciu64 btrfs_tree_mod_log_lowest_seq(struct btrfs_fs_info *fs_info); 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci#endif 54