| 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 |
|
| 8 |
struct extent_buffer; |
| 9 |
struct btrfs_fs_info; |
| 10 |
struct btrfs_root; |
| 11 |
struct btrfs_trans_handle; |
| 12 |
struct btrfs_ordered_extent; |
| 13 |
struct btrfs_pending_snapshot; |
| 14 |
|
| 15 |
static 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 |
|
| 26 |
int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start, |
| 27 |
bool verbose); |
| 28 |
int btrfs_init_reloc_root(struct btrfs_trans_handle *trans, struct btrfs_root *root); |
| 29 |
int btrfs_update_reloc_root(struct btrfs_trans_handle *trans, |
| 30 |
struct btrfs_root *root); |
| 31 |
int btrfs_recover_relocation(struct btrfs_fs_info *fs_info); |
| 32 |
int btrfs_reloc_clone_csums(struct btrfs_ordered_extent *ordered); |
| 33 |
int 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); |
| 37 |
void btrfs_reloc_pre_snapshot(struct btrfs_pending_snapshot *pending, |
| 38 |
u64 *bytes_to_reserve); |
| 39 |
int btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans, |
| 40 |
struct btrfs_pending_snapshot *pending); |
| 41 |
int btrfs_should_cancel_balance(const struct btrfs_fs_info *fs_info); |
| 42 |
struct btrfs_root *find_reloc_root(struct btrfs_fs_info *fs_info, u64 bytenr); |
| 43 |
bool btrfs_should_ignore_reloc_root(const struct btrfs_root *root); |
| 44 |
u64 btrfs_get_reloc_bg_bytenr(const struct btrfs_fs_info *fs_info); |
| 45 |
int btrfs_translate_remap(struct btrfs_fs_info *fs_info, u64 *logical, u64 *length); |
| 46 |
int btrfs_remove_extent_from_remap_tree(struct btrfs_trans_handle *trans, |
| 47 |
struct btrfs_path *path, |
| 48 |
u64 bytenr, u64 num_bytes); |
| 49 |
int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map, |
| 50 |
struct btrfs_block_group *bg); |
| 51 |
|
| 52 |
#endif |