Commit 1a5bc167 authored by Chris Mason's avatar Chris Mason

Btrfs: Change the remaining radix trees used by extent-tree.c to extent_map trees

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 96b5179d
...@@ -283,10 +283,6 @@ struct btrfs_block_group_item { ...@@ -283,10 +283,6 @@ struct btrfs_block_group_item {
struct btrfs_block_group_cache { struct btrfs_block_group_cache {
struct btrfs_key key; struct btrfs_key key;
struct btrfs_block_group_item item; struct btrfs_block_group_item item;
u64 first_free;
u64 last_alloc;
u64 pinned;
u64 last_prealloc;
int data; int data;
int cached; int cached;
}; };
...@@ -296,11 +292,13 @@ struct btrfs_fs_info { ...@@ -296,11 +292,13 @@ struct btrfs_fs_info {
struct btrfs_root *extent_root; struct btrfs_root *extent_root;
struct btrfs_root *tree_root; struct btrfs_root *tree_root;
struct radix_tree_root fs_roots_radix; struct radix_tree_root fs_roots_radix;
struct radix_tree_root pending_del_radix;
struct radix_tree_root pinned_radix;
struct radix_tree_root extent_ins_radix;
struct extent_map_tree free_space_cache; struct extent_map_tree free_space_cache;
struct extent_map_tree block_group_cache; struct extent_map_tree block_group_cache;
struct extent_map_tree pinned_extents;
struct extent_map_tree pending_del;
struct extent_map_tree extent_ins;
u64 generation; u64 generation;
u64 last_trans_committed; u64 last_trans_committed;
struct btrfs_transaction *running_transaction; struct btrfs_transaction *running_transaction;
...@@ -926,7 +924,7 @@ static inline int btrfs_set_root_name(struct btrfs_root *root, ...@@ -926,7 +924,7 @@ static inline int btrfs_set_root_name(struct btrfs_root *root,
/* extent-tree.c */ /* extent-tree.c */
int btrfs_extent_post_op(struct btrfs_trans_handle *trans, int btrfs_extent_post_op(struct btrfs_trans_handle *trans,
struct btrfs_root *root); struct btrfs_root *root);
int btrfs_copy_pinned(struct btrfs_root *root, struct radix_tree_root *copy); int btrfs_copy_pinned(struct btrfs_root *root, struct extent_map_tree *copy);
struct btrfs_block_group_cache *btrfs_lookup_block_group(struct struct btrfs_block_group_cache *btrfs_lookup_block_group(struct
btrfs_fs_info *info, btrfs_fs_info *info,
u64 blocknr); u64 blocknr);
...@@ -949,7 +947,7 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -949,7 +947,7 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
*root, u64 blocknr, u64 num_blocks, int pin); *root, u64 blocknr, u64 num_blocks, int pin);
int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct radix_tree_root *unpin_radix); struct extent_map_tree *unpin);
int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
u64 blocknr, u64 num_blocks); u64 blocknr, u64 num_blocks);
......
...@@ -432,9 +432,6 @@ struct btrfs_root *open_ctree(struct super_block *sb) ...@@ -432,9 +432,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
err = -ENOMEM; err = -ENOMEM;
goto fail; goto fail;
} }
init_bit_radix(&fs_info->pinned_radix);
init_bit_radix(&fs_info->pending_del_radix);
init_bit_radix(&fs_info->extent_ins_radix);
INIT_RADIX_TREE(&fs_info->fs_roots_radix, GFP_NOFS); INIT_RADIX_TREE(&fs_info->fs_roots_radix, GFP_NOFS);
INIT_LIST_HEAD(&fs_info->trans_list); INIT_LIST_HEAD(&fs_info->trans_list);
INIT_LIST_HEAD(&fs_info->dead_roots); INIT_LIST_HEAD(&fs_info->dead_roots);
...@@ -458,6 +455,12 @@ struct btrfs_root *open_ctree(struct super_block *sb) ...@@ -458,6 +455,12 @@ struct btrfs_root *open_ctree(struct super_block *sb)
fs_info->btree_inode->i_mapping, GFP_NOFS); fs_info->btree_inode->i_mapping, GFP_NOFS);
extent_map_tree_init(&fs_info->block_group_cache, extent_map_tree_init(&fs_info->block_group_cache,
fs_info->btree_inode->i_mapping, GFP_NOFS); fs_info->btree_inode->i_mapping, GFP_NOFS);
extent_map_tree_init(&fs_info->pinned_extents,
fs_info->btree_inode->i_mapping, GFP_NOFS);
extent_map_tree_init(&fs_info->pending_del,
fs_info->btree_inode->i_mapping, GFP_NOFS);
extent_map_tree_init(&fs_info->extent_ins,
fs_info->btree_inode->i_mapping, GFP_NOFS);
fs_info->do_barriers = 1; fs_info->do_barriers = 1;
fs_info->closing = 0; fs_info->closing = 0;
......
This diff is collapsed.
...@@ -1188,7 +1188,7 @@ int get_state_private(struct extent_map_tree *tree, u64 start, u64 *private) ...@@ -1188,7 +1188,7 @@ int get_state_private(struct extent_map_tree *tree, u64 start, u64 *private)
* has the bits set. Otherwise, 1 is returned if any bit in the * has the bits set. Otherwise, 1 is returned if any bit in the
* range is found set. * range is found set.
*/ */
static int test_range_bit(struct extent_map_tree *tree, u64 start, u64 end, int test_range_bit(struct extent_map_tree *tree, u64 start, u64 end,
int bits, int filled) int bits, int filled)
{ {
struct extent_state *state = NULL; struct extent_state *state = NULL;
...@@ -1222,6 +1222,7 @@ static int test_range_bit(struct extent_map_tree *tree, u64 start, u64 end, ...@@ -1222,6 +1222,7 @@ static int test_range_bit(struct extent_map_tree *tree, u64 start, u64 end,
read_unlock_irq(&tree->lock); read_unlock_irq(&tree->lock);
return bitset; return bitset;
} }
EXPORT_SYMBOL(test_range_bit);
/* /*
* helper function to set a given page up to date if all the * helper function to set a given page up to date if all the
......
...@@ -95,7 +95,9 @@ int extent_read_full_page(struct extent_map_tree *tree, struct page *page, ...@@ -95,7 +95,9 @@ int extent_read_full_page(struct extent_map_tree *tree, struct page *page,
get_extent_t *get_extent); get_extent_t *get_extent);
void __init extent_map_init(void); void __init extent_map_init(void);
void __exit extent_map_exit(void); void __exit extent_map_exit(void);
int extent_clean_all_trees(struct extent_map_tree *tree);
int test_range_bit(struct extent_map_tree *tree, u64 start, u64 end,
int bits, int filled);
int clear_extent_bits(struct extent_map_tree *tree, u64 start, u64 end, int clear_extent_bits(struct extent_map_tree *tree, u64 start, u64 end,
int bits, gfp_t mask); int bits, gfp_t mask);
int set_extent_bits(struct extent_map_tree *tree, u64 start, u64 end, int set_extent_bits(struct extent_map_tree *tree, u64 start, u64 end,
......
...@@ -481,11 +481,12 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, ...@@ -481,11 +481,12 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
struct btrfs_transaction *cur_trans; struct btrfs_transaction *cur_trans;
struct btrfs_transaction *prev_trans = NULL; struct btrfs_transaction *prev_trans = NULL;
struct list_head dirty_fs_roots; struct list_head dirty_fs_roots;
struct radix_tree_root pinned_copy; struct extent_map_tree pinned_copy;
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
int ret; int ret;
init_bit_radix(&pinned_copy); extent_map_tree_init(&pinned_copy,
root->fs_info->btree_inode->i_mapping, GFP_NOFS);
INIT_LIST_HEAD(&dirty_fs_roots); INIT_LIST_HEAD(&dirty_fs_roots);
mutex_lock(&root->fs_info->trans_mutex); mutex_lock(&root->fs_info->trans_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment