2022-10-27 09:12:04 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2021-03-11 07:31:07 -07:00
|
|
|
|
|
|
|
#ifndef BTRFS_TREE_MOD_LOG_H
|
|
|
|
#define BTRFS_TREE_MOD_LOG_H
|
|
|
|
|
2024-01-26 16:53:06 -07:00
|
|
|
#include <linux/list.h>
|
|
|
|
|
|
|
|
struct extent_buffer;
|
|
|
|
struct btrfs_fs_info;
|
|
|
|
struct btrfs_path;
|
|
|
|
struct btrfs_root;
|
|
|
|
struct btrfs_seq_list;
|
2021-03-11 07:31:07 -07:00
|
|
|
|
|
|
|
/* Represents a tree mod log user. */
|
|
|
|
struct btrfs_seq_list {
|
|
|
|
struct list_head list;
|
|
|
|
u64 seq;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define BTRFS_SEQ_LIST_INIT(name) { .list = LIST_HEAD_INIT((name).list), .seq = 0 }
|
|
|
|
#define BTRFS_SEQ_LAST ((u64)-1)
|
|
|
|
|
|
|
|
enum btrfs_mod_log_op {
|
|
|
|
BTRFS_MOD_LOG_KEY_REPLACE,
|
|
|
|
BTRFS_MOD_LOG_KEY_ADD,
|
|
|
|
BTRFS_MOD_LOG_KEY_REMOVE,
|
|
|
|
BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING,
|
|
|
|
BTRFS_MOD_LOG_KEY_REMOVE_WHILE_MOVING,
|
|
|
|
BTRFS_MOD_LOG_MOVE_KEYS,
|
|
|
|
BTRFS_MOD_LOG_ROOT_REPLACE,
|
|
|
|
};
|
|
|
|
|
|
|
|
u64 btrfs_get_tree_mod_seq(struct btrfs_fs_info *fs_info,
|
|
|
|
struct btrfs_seq_list *elem);
|
|
|
|
void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info,
|
|
|
|
struct btrfs_seq_list *elem);
|
|
|
|
int btrfs_tree_mod_log_insert_root(struct extent_buffer *old_root,
|
|
|
|
struct extent_buffer *new_root,
|
2021-03-11 07:31:08 -07:00
|
|
|
bool log_removal);
|
2024-06-26 14:39:11 -07:00
|
|
|
int btrfs_tree_mod_log_insert_key(const struct extent_buffer *eb, int slot,
|
2022-10-14 06:44:33 -07:00
|
|
|
enum btrfs_mod_log_op op);
|
2021-03-11 07:31:07 -07:00
|
|
|
int btrfs_tree_mod_log_free_eb(struct extent_buffer *eb);
|
|
|
|
struct extent_buffer *btrfs_tree_mod_log_rewind(struct btrfs_fs_info *fs_info,
|
|
|
|
struct btrfs_path *path,
|
|
|
|
struct extent_buffer *eb,
|
|
|
|
u64 time_seq);
|
|
|
|
struct extent_buffer *btrfs_get_old_root(struct btrfs_root *root, u64 time_seq);
|
|
|
|
int btrfs_old_root_level(struct btrfs_root *root, u64 time_seq);
|
|
|
|
int btrfs_tree_mod_log_eb_copy(struct extent_buffer *dst,
|
2024-06-26 14:39:11 -07:00
|
|
|
const struct extent_buffer *src,
|
2021-03-11 07:31:07 -07:00
|
|
|
unsigned long dst_offset,
|
|
|
|
unsigned long src_offset,
|
|
|
|
int nr_items);
|
2024-06-26 14:39:11 -07:00
|
|
|
int btrfs_tree_mod_log_insert_move(const struct extent_buffer *eb,
|
2021-03-11 07:31:07 -07:00
|
|
|
int dst_slot, int src_slot,
|
|
|
|
int nr_items);
|
2021-03-11 07:31:12 -07:00
|
|
|
u64 btrfs_tree_mod_log_lowest_seq(struct btrfs_fs_info *fs_info);
|
2021-03-11 07:31:07 -07:00
|
|
|
|
|
|
|
#endif
|