diff options
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a84420491c11..49fd7b66d57b 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); |
@@ -2303,6 +2301,7 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans, | |||
2303 | 2301 | ||
2304 | if (ret) { | 2302 | if (ret) { |
2305 | printk(KERN_DEBUG "btrfs: run_delayed_extent_op returned %d\n", ret); | 2303 | printk(KERN_DEBUG "btrfs: run_delayed_extent_op returned %d\n", ret); |
2304 | spin_lock(&delayed_refs->lock); | ||
2306 | return ret; | 2305 | return ret; |
2307 | } | 2306 | } |
2308 | 2307 | ||
@@ -2333,6 +2332,7 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans, | |||
2333 | 2332 | ||
2334 | if (ret) { | 2333 | if (ret) { |
2335 | printk(KERN_DEBUG "btrfs: run_one_delayed_ref returned %d\n", ret); | 2334 | printk(KERN_DEBUG "btrfs: run_one_delayed_ref returned %d\n", ret); |
2335 | spin_lock(&delayed_refs->lock); | ||
2336 | return ret; | 2336 | return ret; |
2337 | } | 2337 | } |
2338 | 2338 | ||
@@ -3152,15 +3152,14 @@ static void set_avail_alloc_bits(struct btrfs_fs_info *fs_info, u64 flags) | |||
3152 | /* | 3152 | /* |
3153 | * returns target flags in extended format or 0 if restripe for this | 3153 | * returns target flags in extended format or 0 if restripe for this |
3154 | * chunk_type is not in progress | 3154 | * chunk_type is not in progress |
3155 | * | ||
3156 | * should be called with either volume_mutex or balance_lock held | ||
3155 | */ | 3157 | */ |
3156 | static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags) | 3158 | static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags) |
3157 | { | 3159 | { |
3158 | struct btrfs_balance_control *bctl = fs_info->balance_ctl; | 3160 | struct btrfs_balance_control *bctl = fs_info->balance_ctl; |
3159 | u64 target = 0; | 3161 | u64 target = 0; |
3160 | 3162 | ||
3161 | BUG_ON(!mutex_is_locked(&fs_info->volume_mutex) && | ||
3162 | !spin_is_locked(&fs_info->balance_lock)); | ||
3163 | |||
3164 | if (!bctl) | 3163 | if (!bctl) |
3165 | return 0; | 3164 | return 0; |
3166 | 3165 | ||
@@ -3772,13 +3771,10 @@ again: | |||
3772 | */ | 3771 | */ |
3773 | if (current->journal_info) | 3772 | if (current->journal_info) |
3774 | return -EAGAIN; | 3773 | return -EAGAIN; |
3775 | ret = wait_event_interruptible(space_info->wait, | 3774 | ret = wait_event_killable(space_info->wait, !space_info->flush); |
3776 | !space_info->flush); | 3775 | /* Must have been killed, return */ |
3777 | /* Must have been interrupted, return */ | 3776 | if (ret) |
3778 | if (ret) { | ||
3779 | printk(KERN_DEBUG "btrfs: %s returning -EINTR\n", __func__); | ||
3780 | return -EINTR; | 3777 | return -EINTR; |
3781 | } | ||
3782 | 3778 | ||
3783 | spin_lock(&space_info->lock); | 3779 | spin_lock(&space_info->lock); |
3784 | } | 3780 | } |
@@ -4205,7 +4201,7 @@ static u64 calc_global_metadata_size(struct btrfs_fs_info *fs_info) | |||
4205 | num_bytes += div64_u64(data_used + meta_used, 50); | 4201 | num_bytes += div64_u64(data_used + meta_used, 50); |
4206 | 4202 | ||
4207 | if (num_bytes * 3 > meta_used) | 4203 | if (num_bytes * 3 > meta_used) |
4208 | num_bytes = div64_u64(meta_used, 3) * 2; | 4204 | num_bytes = div64_u64(meta_used, 3); |
4209 | 4205 | ||
4210 | return ALIGN(num_bytes, fs_info->extent_root->leafsize << 10); | 4206 | return ALIGN(num_bytes, fs_info->extent_root->leafsize << 10); |
4211 | } | 4207 | } |
@@ -4218,8 +4214,8 @@ static void update_global_block_rsv(struct btrfs_fs_info *fs_info) | |||
4218 | 4214 | ||
4219 | num_bytes = calc_global_metadata_size(fs_info); | 4215 | num_bytes = calc_global_metadata_size(fs_info); |
4220 | 4216 | ||
4221 | spin_lock(&block_rsv->lock); | ||
4222 | spin_lock(&sinfo->lock); | 4217 | spin_lock(&sinfo->lock); |
4218 | spin_lock(&block_rsv->lock); | ||
4223 | 4219 | ||
4224 | block_rsv->size = num_bytes; | 4220 | block_rsv->size = num_bytes; |
4225 | 4221 | ||
@@ -4245,8 +4241,8 @@ static void update_global_block_rsv(struct btrfs_fs_info *fs_info) | |||
4245 | block_rsv->full = 1; | 4241 | block_rsv->full = 1; |
4246 | } | 4242 | } |
4247 | 4243 | ||
4248 | spin_unlock(&sinfo->lock); | ||
4249 | spin_unlock(&block_rsv->lock); | 4244 | spin_unlock(&block_rsv->lock); |
4245 | spin_unlock(&sinfo->lock); | ||
4250 | } | 4246 | } |
4251 | 4247 | ||
4252 | static void init_global_block_rsv(struct btrfs_fs_info *fs_info) | 4248 | static void init_global_block_rsv(struct btrfs_fs_info *fs_info) |
@@ -6572,7 +6568,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, | |||
6572 | goto skip; | 6568 | goto skip; |
6573 | } | 6569 | } |
6574 | 6570 | ||
6575 | if (!btrfs_buffer_uptodate(next, generation)) { | 6571 | if (!btrfs_buffer_uptodate(next, generation, 0)) { |
6576 | btrfs_tree_unlock(next); | 6572 | btrfs_tree_unlock(next); |
6577 | free_extent_buffer(next); | 6573 | free_extent_buffer(next); |
6578 | next = NULL; | 6574 | next = NULL; |