diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-10-17 09:58:56 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-10-17 09:58:56 -0400 |
commit | 678af9b3a425534c55cfe42c633c8fdd2e658e17 (patch) | |
tree | 18343cf1205d70979b50ca5cc8d5505871b3e6d9 /mkfs.c | |
parent | 167388ab2b97dd91580b88242825cdd5ee0cfa0a (diff) |
Remove the last radix tree (block_group_cache)
Diffstat (limited to 'mkfs.c')
-rw-r--r-- | mkfs.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -28,7 +28,6 @@ #include <fcntl.h> #include <unistd.h> #include <uuid/uuid.h> -#include "radix-tree.h" #include <linux/fs.h> #include "kerncompat.h" #include "ctree.h" @@ -91,6 +90,7 @@ static int make_block_groups(struct btrfs_trans_handle *trans, int ret; u64 nr = 0; struct btrfs_block_group_cache *cache; + struct cache_tree *bg_cache = &root->fs_info->block_group_cache; root = root->fs_info->extent_root; @@ -99,13 +99,14 @@ static int make_block_groups(struct btrfs_trans_handle *trans, cache = malloc(sizeof(*cache)); cache->key.objectid = 0; cache->key.offset = group_size; + cache->cache.start = 0; + cache->cache.size = group_size; btrfs_set_key_type(&cache->key, BTRFS_BLOCK_GROUP_ITEM_KEY); memset(&cache->item, 0, sizeof(cache->item)); btrfs_set_block_group_used(&cache->item, btrfs_super_bytes_used(root->fs_info->disk_super)); - ret = radix_tree_insert(&root->fs_info->block_group_radix, - group_size - 1, (void *)cache); + ret = insert_existing_cache_extent(bg_cache, &cache->cache); BUG_ON(ret); total_bytes = btrfs_super_total_bytes(root->fs_info->disk_super); @@ -114,14 +115,14 @@ static int make_block_groups(struct btrfs_trans_handle *trans, cache = malloc(sizeof(*cache)); cache->key.objectid = cur_start; cache->key.offset = group_size; + cache->cache.start = cur_start; + cache->cache.size = group_size; btrfs_set_key_type(&cache->key, BTRFS_BLOCK_GROUP_ITEM_KEY); memset(&cache->item, 0, sizeof(cache->item)); if (nr % 3) cache->item.flags |= BTRFS_BLOCK_GROUP_DATA; - ret = radix_tree_insert(&root->fs_info->block_group_radix, - cur_start + group_size - 1, - (void *)cache); + ret = insert_existing_cache_extent(bg_cache, &cache->cache); BUG_ON(ret); cur_start += group_size; nr++; @@ -129,9 +130,11 @@ static int make_block_groups(struct btrfs_trans_handle *trans, /* then insert all the items */ cur_start = 0; while(cur_start < total_bytes) { - cache = radix_tree_lookup(&root->fs_info->block_group_radix, - cur_start + group_size - 1); - BUG_ON(!cache); + struct cache_extent *ce; + ce = find_first_cache_extent(bg_cache, cur_start); + BUG_ON(!ce); + cache = container_of(ce, struct btrfs_block_group_cache, + cache); ret = btrfs_insert_block_group(trans, root, &cache->key, &cache->item); BUG_ON(ret); @@ -353,8 +356,6 @@ int main(int ac, char **av) char *buf = malloc(sectorsize); char *realpath_name; - radix_tree_init(); - while(1) { int c; c = getopt(ac, av, "l:n:"); |