diff options
author | Yan Zheng <zheng.yan@oracle.com> | 2008-10-29 14:49:05 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-10-29 14:49:05 -0400 |
commit | f82d02d9d8222183b7945e893111a6d1bf67ae4a (patch) | |
tree | 70be1bb231f4cc2e673920774e759359f3dcf1a5 /fs/btrfs/ctree.h | |
parent | c8b978188c9a0fd3d535c13debd19d522b726f1f (diff) |
Btrfs: Improve space balancing code
This patch improves the space balancing code to keep more sharing
of tree blocks. The only case that breaks sharing of tree blocks is
data extents get fragmented during balancing. The main changes in
this patch are:
Add a 'drop sub-tree' function. This solves the problem in old code
that BTRFS_HEADER_FLAG_WRITTEN check breaks sharing of tree block.
Remove relocation mapping tree. Relocation mappings are stored in
struct btrfs_ref_path and updated dynamically during walking up/down
the reference path. This reduces CPU usage and simplifies code.
This patch also fixes a bug. Root items for reloc trees should be
updated in btrfs_free_reloc_root.
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 793d8fdda244..117090995e7c 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -684,7 +684,6 @@ struct btrfs_fs_info { | |||
684 | int thread_pool_size; | 684 | int thread_pool_size; |
685 | 685 | ||
686 | /* tree relocation relocated fields */ | 686 | /* tree relocation relocated fields */ |
687 | struct extent_io_tree reloc_mapping_tree; | ||
688 | struct list_head dead_reloc_roots; | 687 | struct list_head dead_reloc_roots; |
689 | struct btrfs_leaf_ref_tree reloc_ref_tree; | 688 | struct btrfs_leaf_ref_tree reloc_ref_tree; |
690 | struct btrfs_leaf_ref_tree shared_ref_tree; | 689 | struct btrfs_leaf_ref_tree shared_ref_tree; |
@@ -1636,13 +1635,9 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, | |||
1636 | int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | 1635 | int btrfs_remove_block_group(struct btrfs_trans_handle *trans, |
1637 | struct btrfs_root *root, u64 group_start); | 1636 | struct btrfs_root *root, u64 group_start); |
1638 | int btrfs_relocate_block_group(struct btrfs_root *root, u64 group_start); | 1637 | int btrfs_relocate_block_group(struct btrfs_root *root, u64 group_start); |
1639 | int btrfs_free_reloc_root(struct btrfs_root *root); | 1638 | int btrfs_free_reloc_root(struct btrfs_trans_handle *trans, |
1639 | struct btrfs_root *root); | ||
1640 | int btrfs_drop_dead_reloc_roots(struct btrfs_root *root); | 1640 | int btrfs_drop_dead_reloc_roots(struct btrfs_root *root); |
1641 | int btrfs_add_reloc_mapping(struct btrfs_root *root, u64 orig_bytenr, | ||
1642 | u64 num_bytes, u64 new_bytenr); | ||
1643 | int btrfs_get_reloc_mapping(struct btrfs_root *root, u64 orig_bytenr, | ||
1644 | u64 num_bytes, u64 *new_bytenr); | ||
1645 | void btrfs_free_reloc_mappings(struct btrfs_root *root); | ||
1646 | int btrfs_reloc_tree_cache_ref(struct btrfs_trans_handle *trans, | 1641 | int btrfs_reloc_tree_cache_ref(struct btrfs_trans_handle *trans, |
1647 | struct btrfs_root *root, | 1642 | struct btrfs_root *root, |
1648 | struct extent_buffer *buf, u64 orig_start); | 1643 | struct extent_buffer *buf, u64 orig_start); |
@@ -1726,6 +1721,10 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path); | |||
1726 | int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf); | 1721 | int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf); |
1727 | int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root | 1722 | int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root |
1728 | *root); | 1723 | *root); |
1724 | int btrfs_drop_subtree(struct btrfs_trans_handle *trans, | ||
1725 | struct btrfs_root *root, | ||
1726 | struct extent_buffer *node, | ||
1727 | struct extent_buffer *parent); | ||
1729 | /* root-item.c */ | 1728 | /* root-item.c */ |
1730 | int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 1729 | int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
1731 | struct btrfs_key *key); | 1730 | struct btrfs_key *key); |