projects/linux·blob master · refs

52 lines · 1.9 KiB

1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef BTRFS_RELOCATION_H
4#define BTRFS_RELOCATION_H
5
6#include <linux/types.h>
7
8struct extent_buffer;
9struct btrfs_fs_info;
10struct btrfs_root;
11struct btrfs_trans_handle;
12struct btrfs_ordered_extent;
13struct btrfs_pending_snapshot;
14
15static inline bool should_relocate_using_remap_tree(const struct btrfs_block_group *bg)
16{
17 if (!btrfs_fs_incompat(bg->fs_info, REMAP_TREE))
18 return false;
19
20 if (bg->flags & (BTRFS_BLOCK_GROUP_SYSTEM | BTRFS_BLOCK_GROUP_METADATA_REMAP))
21 return false;
22
23 return true;
24}
25
26int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start,
27 bool verbose);
28int btrfs_init_reloc_root(struct btrfs_trans_handle *trans, struct btrfs_root *root);
29int btrfs_update_reloc_root(struct btrfs_trans_handle *trans,
30 struct btrfs_root *root);
31int btrfs_recover_relocation(struct btrfs_fs_info *fs_info);
32int btrfs_reloc_clone_csums(struct btrfs_ordered_extent *ordered);
33int btrfs_reloc_cow_block(struct btrfs_trans_handle *trans,
34 struct btrfs_root *root,
35 const struct extent_buffer *buf,
36 struct extent_buffer *cow);
37void btrfs_reloc_pre_snapshot(struct btrfs_pending_snapshot *pending,
38 u64 *bytes_to_reserve);
39int btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans,
40 struct btrfs_pending_snapshot *pending);
41int btrfs_should_cancel_balance(const struct btrfs_fs_info *fs_info);
42struct btrfs_root *find_reloc_root(struct btrfs_fs_info *fs_info, u64 bytenr);
43bool btrfs_should_ignore_reloc_root(const struct btrfs_root *root);
44u64 btrfs_get_reloc_bg_bytenr(struct btrfs_fs_info *fs_info);
45int btrfs_translate_remap(struct btrfs_fs_info *fs_info, u64 *logical, u64 *length);
46int btrfs_remove_extent_from_remap_tree(struct btrfs_trans_handle *trans,
47 struct btrfs_path *path,
48 u64 bytenr, u64 num_bytes);
49int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map,
50 struct btrfs_block_group *bg);
51
52#endif