Skip to content

Commit

Permalink
Btrfs: more allocator enhancements
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason authored and David Woodhouse committed May 6, 2007
1 parent be08c1b commit be74417
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 85 deletions.
6 changes: 4 additions & 2 deletions fs/btrfs/bit-radix.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ int set_radix_bit(struct radix_tree_root *radix, unsigned long bit)
if (ret)
return ret;
}
set_bit(bit_slot, bits + 1);
return 0;
ret = test_and_set_bit(bit_slot, bits + 1);
if (ret < 0)
ret = 1;
return ret;
}

int test_radix_bit(struct radix_tree_root *radix, unsigned long bit)
Expand Down
7 changes: 5 additions & 2 deletions fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,21 @@ struct btrfs_block_group_cache {
struct btrfs_block_group_item item;
u64 first_free;
u64 last_alloc;
u64 pinned;
int data;
};

struct crypto_hash;
struct btrfs_fs_info {
struct btrfs_root *extent_root;
struct btrfs_root *tree_root;
struct btrfs_root *dev_root;
struct btrfs_block_group_cache *block_group_cache;
struct radix_tree_root fs_roots_radix;
struct radix_tree_root pending_del_radix;
struct radix_tree_root pinned_radix;
struct radix_tree_root dev_radix;
struct radix_tree_root block_group_radix;
struct radix_tree_root block_group_data_radix;

u64 extent_tree_insert[BTRFS_MAX_LEVEL * 3];
int extent_tree_insert_nr;
Expand Down Expand Up @@ -1072,7 +1074,8 @@ static inline void btrfs_mark_buffer_dirty(struct buffer_head *bh)
/* extent-tree.c */
struct btrfs_block_group_cache *btrfs_find_block_group(struct btrfs_root *root,
struct btrfs_block_group_cache
*hint, int data);
*hint, u64 search_start,
int data);
int btrfs_inc_root_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root);
struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
INIT_RADIX_TREE(&fs_info->fs_roots_radix, GFP_NOFS);
INIT_RADIX_TREE(&fs_info->dev_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);
sb_set_blocksize(sb, 4096);
fs_info->running_transaction = NULL;
Expand Down Expand Up @@ -582,7 +583,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
}
mutex_init(&fs_info->trans_mutex);
mutex_init(&fs_info->fs_mutex);
fs_info->block_group_cache = NULL;

__setup_root(sb->s_blocksize, dev_root,
fs_info, BTRFS_DEV_TREE_OBJECTID);
Expand Down
Loading

0 comments on commit be74417

Please sign in to comment.