- ret = btrfs_rmap_block(&root->fs_info->mapping_tree,
- cache->key.objectid, bytenr, 0,
+ ret = btrfs_rmap_block(fs_info, cache->key.objectid, bytenr, 0,
if (!cache) {
printk("Unable to find block group for %llu\n",
(unsigned long long)search_start);
if (!cache) {
printk("Unable to find block group for %llu\n",
(unsigned long long)search_start);
- ret = update_space_info(extent_root->fs_info, flags,
- 0, 0, &space_info);
+ ret = update_space_info(fs_info, flags, 0, 0, &space_info);
- ret = btrfs_alloc_chunk(trans, extent_root, &start, &num_bytes,
+ ret = btrfs_alloc_chunk(trans, fs_info, &start, &num_bytes,
- ret = btrfs_make_block_group(trans, extent_root, 0, space_info->flags,
+ ret = btrfs_make_block_group(trans, fs_info, 0, space_info->flags,
- search_start = round_up(bg_offset + num_bytes,
- BTRFS_STRIPE_LEN) + bg_offset;
+ search_start = round_up(
+ bg_offset + num_bytes, BTRFS_STRIPE_LEN) +
+ bg_cache->key.objectid;
alloc_profile = info->avail_data_alloc_bits &
info->data_alloc_profile;
data = BTRFS_BLOCK_GROUP_DATA | alloc_profile;
alloc_profile = info->avail_data_alloc_bits &
info->data_alloc_profile;
data = BTRFS_BLOCK_GROUP_DATA | alloc_profile;
alloc_profile = info->avail_system_alloc_bits &
info->system_alloc_profile;
data = BTRFS_BLOCK_GROUP_SYSTEM | alloc_profile;
alloc_profile = info->avail_system_alloc_bits &
info->system_alloc_profile;
data = BTRFS_BLOCK_GROUP_SYSTEM | alloc_profile;
search_start, search_end, hint_byte, ins,
trans->alloc_exclude_start,
trans->alloc_exclude_nr, data);
search_start, search_end, hint_byte, ins,
trans->alloc_exclude_start,
trans->alloc_exclude_nr, data);
if (!buf) {
btrfs_free_extent(trans, root, ins.objectid, ins.offset,
0, root->root_key.objectid, level, 0);
if (!buf) {
btrfs_free_extent(trans, root, ins.objectid, ins.offset,
0, root->root_key.objectid, level, 0);
cache->key.objectid, bytenr,
0, &logical, &nr, &stripe_len);
if (ret)
cache->key.objectid, bytenr,
0, &logical, &nr, &stripe_len);
if (ret)
bit = BLOCK_GROUP_METADATA;
}
set_avail_alloc_bits(info, cache->flags);
bit = BLOCK_GROUP_METADATA;
}
set_avail_alloc_bits(info, cache->flags);
u64 type, u64 chunk_objectid, u64 chunk_offset,
u64 size)
{
int ret;
u64 type, u64 chunk_objectid, u64 chunk_offset,
u64 size)
{
int ret;
- cache = btrfs_add_block_group(root->fs_info, bytes_used, type,
+ cache = btrfs_add_block_group(fs_info, bytes_used, type,
ret = btrfs_insert_item(trans, extent_root, &cache->key, &cache->item,
sizeof(cache->item));
BUG_ON(ret);
ret = btrfs_insert_item(trans, extent_root, &cache->key, &cache->item,
sizeof(cache->item));
BUG_ON(ret);
* before doing any block allocation.
*/
int btrfs_make_block_groups(struct btrfs_trans_handle *trans,
* before doing any block allocation.
*/
int btrfs_make_block_groups(struct btrfs_trans_handle *trans,
- total_bytes = btrfs_super_total_bytes(root->fs_info->super_copy);
- group_align = 64 * root->fs_info->sectorsize;
+ total_bytes = btrfs_super_total_bytes(fs_info->super_copy);
+ group_align = 64 * fs_info->sectorsize;
- ret = update_space_info(root->fs_info, group_type, group_size,
+ ret = update_space_info(fs_info, group_type, group_size,
set_extent_bits(block_group_cache, cur_start,
cur_start + group_size - 1,
set_extent_bits(block_group_cache, cur_start,
cur_start + group_size - 1,
BUG_ON(!cache);
ret = btrfs_insert_item(trans, extent_root, &cache->key, &cache->item,
BUG_ON(!cache);
ret = btrfs_insert_item(trans, extent_root, &cache->key, &cache->item,
- clear_extent_bits(&fs_info->block_group_cache, bytenr, bytenr + len,
+ clear_extent_bits(&fs_info->block_group_cache, bytenr, bytenr + len - 1,
(unsigned int)-1);
ret = free_space_info(fs_info, flags, len, 0, NULL);
if (ret < 0)
(unsigned int)-1);
ret = free_space_info(fs_info, flags, len, 0, NULL);
if (ret < 0)
bytes_used += fs_info->nodesize;
ret = btrfs_update_block_group(trans, root,
key.objectid, fs_info->nodesize, 1, 0);
bytes_used += fs_info->nodesize;
ret = btrfs_update_block_group(trans, root,
key.objectid, fs_info->nodesize, 1, 0);
cache->key.objectid, bytenr,
0, &logical, &nr, &stripe_len);
if (ret)
cache->key.objectid, bytenr,
0, &logical, &nr, &stripe_len);
if (ret)