diff options
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a84420491c11..2b35f8d14bb9 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -529,9 +529,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache, | |||
529 | * allocate blocks for the tree root we can't do the fast caching since | 529 | * allocate blocks for the tree root we can't do the fast caching since |
530 | * we likely hold important locks. | 530 | * we likely hold important locks. |
531 | */ | 531 | */ |
532 | if (trans && (!trans->transaction->in_commit) && | 532 | if (fs_info->mount_opt & BTRFS_MOUNT_SPACE_CACHE) { |
533 | (root && root != root->fs_info->tree_root) && | ||
534 | btrfs_test_opt(root, SPACE_CACHE)) { | ||
535 | ret = load_free_space_cache(fs_info, cache); | 533 | ret = load_free_space_cache(fs_info, cache); |
536 | 534 | ||
537 | spin_lock(&cache->lock); | 535 | spin_lock(&cache->lock); |
@@ -3152,15 +3150,14 @@ static void set_avail_alloc_bits(struct btrfs_fs_info *fs_info, u64 flags) | |||
3152 | /* | 3150 | /* |
3153 | * returns target flags in extended format or 0 if restripe for this | 3151 | * returns target flags in extended format or 0 if restripe for this |
3154 | * chunk_type is not in progress | 3152 | * chunk_type is not in progress |
3153 | * | ||
3154 | * should be called with either volume_mutex or balance_lock held | ||
3155 | */ | 3155 | */ |
3156 | static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags) | 3156 | static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags) |
3157 | { | 3157 | { |
3158 | struct btrfs_balance_control *bctl = fs_info->balance_ctl; | 3158 | struct btrfs_balance_control *bctl = fs_info->balance_ctl; |
3159 | u64 target = 0; | 3159 | u64 target = 0; |
3160 | 3160 | ||
3161 | BUG_ON(!mutex_is_locked(&fs_info->volume_mutex) && | ||
3162 | !spin_is_locked(&fs_info->balance_lock)); | ||
3163 | |||
3164 | if (!bctl) | 3161 | if (!bctl) |
3165 | return 0; | 3162 | return 0; |
3166 | 3163 | ||
@@ -4205,7 +4202,7 @@ static u64 calc_global_metadata_size(struct btrfs_fs_info *fs_info) | |||
4205 | num_bytes += div64_u64(data_used + meta_used, 50); | 4202 | num_bytes += div64_u64(data_used + meta_used, 50); |
4206 | 4203 | ||
4207 | if (num_bytes * 3 > meta_used) | 4204 | if (num_bytes * 3 > meta_used) |
4208 | num_bytes = div64_u64(meta_used, 3) * 2; | 4205 | num_bytes = div64_u64(meta_used, 3); |
4209 | 4206 | ||
4210 | return ALIGN(num_bytes, fs_info->extent_root->leafsize << 10); | 4207 | return ALIGN(num_bytes, fs_info->extent_root->leafsize << 10); |
4211 | } | 4208 | } |