Commit 96b5179d authored by Chris Mason's avatar Chris Mason

Btrfs: Stop using radix trees for the block group cache

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent f510cfec
...@@ -271,8 +271,6 @@ struct btrfs_csum_item { ...@@ -271,8 +271,6 @@ struct btrfs_csum_item {
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
/* tag for the radix tree of block groups in ram */ /* tag for the radix tree of block groups in ram */
#define BTRFS_BLOCK_GROUP_DIRTY 0
#define BTRFS_BLOCK_GROUP_AVAIL 1
#define BTRFS_BLOCK_GROUP_SIZE (256 * 1024 * 1024) #define BTRFS_BLOCK_GROUP_SIZE (256 * 1024 * 1024)
...@@ -285,7 +283,6 @@ struct btrfs_block_group_item { ...@@ -285,7 +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;
struct radix_tree_root *radix;
u64 first_free; u64 first_free;
u64 last_alloc; u64 last_alloc;
u64 pinned; u64 pinned;
...@@ -301,10 +298,9 @@ struct btrfs_fs_info { ...@@ -301,10 +298,9 @@ struct btrfs_fs_info {
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 pending_del_radix;
struct radix_tree_root pinned_radix; struct radix_tree_root pinned_radix;
struct radix_tree_root block_group_radix;
struct radix_tree_root block_group_data_radix;
struct radix_tree_root extent_ins_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;
u64 generation; u64 generation;
u64 last_trans_committed; u64 last_trans_committed;
struct btrfs_transaction *running_transaction; struct btrfs_transaction *running_transaction;
......
...@@ -436,8 +436,6 @@ struct btrfs_root *open_ctree(struct super_block *sb) ...@@ -436,8 +436,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
init_bit_radix(&fs_info->pending_del_radix); init_bit_radix(&fs_info->pending_del_radix);
init_bit_radix(&fs_info->extent_ins_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_RADIX_TREE(&fs_info->block_group_radix, GFP_KERNEL);
INIT_RADIX_TREE(&fs_info->block_group_data_radix, GFP_KERNEL);
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);
memset(&fs_info->super_kobj, 0, sizeof(fs_info->super_kobj)); memset(&fs_info->super_kobj, 0, sizeof(fs_info->super_kobj));
...@@ -458,6 +456,8 @@ struct btrfs_root *open_ctree(struct super_block *sb) ...@@ -458,6 +456,8 @@ struct btrfs_root *open_ctree(struct super_block *sb)
GFP_NOFS); GFP_NOFS);
extent_map_tree_init(&fs_info->free_space_cache, extent_map_tree_init(&fs_info->free_space_cache,
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,
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.
...@@ -574,7 +574,7 @@ int clear_extent_bit(struct extent_map_tree *tree, u64 start, u64 end, ...@@ -574,7 +574,7 @@ int clear_extent_bit(struct extent_map_tree *tree, u64 start, u64 end,
return set; return set;
search_again: search_again:
if (start >= end) if (start > end)
goto out; goto out;
write_unlock_irqrestore(&tree->lock, flags); write_unlock_irqrestore(&tree->lock, flags);
if (mask & __GFP_WAIT) if (mask & __GFP_WAIT)
...@@ -819,6 +819,21 @@ int set_extent_dirty(struct extent_map_tree *tree, u64 start, u64 end, ...@@ -819,6 +819,21 @@ int set_extent_dirty(struct extent_map_tree *tree, u64 start, u64 end,
} }
EXPORT_SYMBOL(set_extent_dirty); EXPORT_SYMBOL(set_extent_dirty);
int set_extent_bits(struct extent_map_tree *tree, u64 start, u64 end,
int bits, gfp_t mask)
{
return set_extent_bit(tree, start, end, bits, 0, NULL,
mask);
}
EXPORT_SYMBOL(set_extent_bits);
int clear_extent_bits(struct extent_map_tree *tree, u64 start, u64 end,
int bits, gfp_t mask)
{
return clear_extent_bit(tree, start, end, bits, 0, 0, mask);
}
EXPORT_SYMBOL(clear_extent_bits);
int set_extent_delalloc(struct extent_map_tree *tree, u64 start, u64 end, int set_extent_delalloc(struct extent_map_tree *tree, u64 start, u64 end,
gfp_t mask) gfp_t mask)
{ {
...@@ -1138,7 +1153,6 @@ int set_state_private(struct extent_map_tree *tree, u64 start, u64 private) ...@@ -1138,7 +1153,6 @@ int set_state_private(struct extent_map_tree *tree, u64 start, u64 private)
out: out:
write_unlock_irq(&tree->lock); write_unlock_irq(&tree->lock);
return ret; return ret;
} }
int get_state_private(struct extent_map_tree *tree, u64 start, u64 *private) int get_state_private(struct extent_map_tree *tree, u64 start, u64 *private)
......
...@@ -96,6 +96,10 @@ int extent_read_full_page(struct extent_map_tree *tree, struct page *page, ...@@ -96,6 +96,10 @@ int extent_read_full_page(struct extent_map_tree *tree, struct page *page,
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 extent_clean_all_trees(struct extent_map_tree *tree);
int clear_extent_bits(struct extent_map_tree *tree, u64 start, u64 end,
int bits, gfp_t mask);
int set_extent_bits(struct extent_map_tree *tree, u64 start, u64 end,
int bits, gfp_t mask);
int set_extent_uptodate(struct extent_map_tree *tree, u64 start, u64 end, int set_extent_uptodate(struct extent_map_tree *tree, u64 start, u64 end,
gfp_t mask); gfp_t mask);
int set_extent_new(struct extent_map_tree *tree, u64 start, u64 end, int set_extent_new(struct extent_map_tree *tree, u64 start, u64 end,
......
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