Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 374847
b: refs/heads/master
c: 8c579fe
h: refs/heads/master
i:
  374845: 68e4eab
  374843: fdbd66f
  374839: 50e9c89
  374831: 8f999d9
  374815: 48f155b
  374783: 3c01f5a
v: v3
  • Loading branch information
Josef Bacik committed May 6, 2013
1 parent f90948a commit 1ecfc74
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5c2d867fdcbc11a6862379ebd60b2c1a66e13671
refs/heads/master: 8c579fe745d96d0841c28295c10ac3e427cef9f2
41 changes: 33 additions & 8 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -8175,20 +8175,33 @@ int btrfs_read_block_groups(struct btrfs_root *root)
free_excluded_extents(root, cache);
}

ret = btrfs_add_block_group_cache(root->fs_info, cache);
if (ret) {
btrfs_remove_free_space_cache(cache);
btrfs_put_block_group(cache);
goto error;
}

ret = update_space_info(info, cache->flags, found_key.offset,
btrfs_block_group_used(&cache->item),
&space_info);
BUG_ON(ret); /* -ENOMEM */
if (ret) {
btrfs_remove_free_space_cache(cache);
spin_lock(&info->block_group_cache_lock);
rb_erase(&cache->cache_node,
&info->block_group_cache_tree);
spin_unlock(&info->block_group_cache_lock);
btrfs_put_block_group(cache);
goto error;
}

cache->space_info = space_info;
spin_lock(&cache->space_info->lock);
cache->space_info->bytes_readonly += cache->bytes_super;
spin_unlock(&cache->space_info->lock);

__link_block_group(space_info, cache);

ret = btrfs_add_block_group_cache(root->fs_info, cache);
BUG_ON(ret); /* Logic error */

set_avail_alloc_bits(root->fs_info, cache->flags);
if (btrfs_chunk_readonly(root, cache->key.objectid))
set_block_group_ro(cache, 1);
Expand Down Expand Up @@ -8311,9 +8324,24 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans,

free_excluded_extents(root, cache);

ret = btrfs_add_block_group_cache(root->fs_info, cache);
if (ret) {
btrfs_remove_free_space_cache(cache);
btrfs_put_block_group(cache);
return ret;
}

ret = update_space_info(root->fs_info, cache->flags, size, bytes_used,
&cache->space_info);
BUG_ON(ret); /* -ENOMEM */
if (ret) {
btrfs_remove_free_space_cache(cache);
spin_lock(&root->fs_info->block_group_cache_lock);
rb_erase(&cache->cache_node,
&root->fs_info->block_group_cache_tree);
spin_unlock(&root->fs_info->block_group_cache_lock);
btrfs_put_block_group(cache);
return ret;
}
update_global_block_rsv(root->fs_info);

spin_lock(&cache->space_info->lock);
Expand All @@ -8322,9 +8350,6 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans,

__link_block_group(cache->space_info, cache);

ret = btrfs_add_block_group_cache(root->fs_info, cache);
BUG_ON(ret); /* Logic error */

list_add_tail(&cache->new_bg_list, &trans->new_bgs);

set_avail_alloc_bits(extent_root->fs_info, type);
Expand Down

0 comments on commit 1ecfc74

Please sign in to comment.