diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-13 19:30:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-13 19:30:29 -0500 |
commit | e75cdf9898132f521df98a3ce1c280a2f85d360a (patch) | |
tree | 4f6a24cf7ab56b962cc8bead17895521b5985dc6 /fs/btrfs/extent-tree.c | |
parent | ca4ba96e02e932a0c9997a40fd51253b5b2d0f9d (diff) | |
parent | d5f2e33b92b10b8007be50b570a27e9bacfb4c3a (diff) |
Merge branch 'for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes and cleanups from Chris Mason:
"Some of this got cherry-picked from a github repo this week, but I
verified the patches.
We have three small scrub cleanups and a collection of fixes"
* 'for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
btrfs: Use fs_info directly in btrfs_delete_unused_bgs
btrfs: Fix lost-data-profile caused by balance bg
btrfs: Fix lost-data-profile caused by auto removing bg
btrfs: Remove len argument from scrub_find_csum
btrfs: Reduce unnecessary arguments in scrub_recheck_block
btrfs: Use scrub_checksum_data and scrub_checksum_tree_block for scrub_recheck_block_checksum
btrfs: Reset sblock->xxx_error stats before calling scrub_recheck_block_checksum
btrfs: scrub: setup all fields for sblock_to_check
btrfs: scrub: set error stats when tree block spanning stripes
Btrfs: fix race when listing an inode's xattrs
Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow
Btrfs: fix race leading to incorrect item deletion when dropping extents
Btrfs: fix sleeping inside atomic context in qgroup rescan worker
Btrfs: fix race waiting for qgroup rescan worker
btrfs: qgroup: exit the rescan worker during umount
Btrfs: fix extent accounting for partial direct IO writes
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 99a8e57da8a1..acf3ed11cfb6 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -10279,22 +10279,25 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) | |||
10279 | block_group = list_first_entry(&fs_info->unused_bgs, | 10279 | block_group = list_first_entry(&fs_info->unused_bgs, |
10280 | struct btrfs_block_group_cache, | 10280 | struct btrfs_block_group_cache, |
10281 | bg_list); | 10281 | bg_list); |
10282 | space_info = block_group->space_info; | ||
10283 | list_del_init(&block_group->bg_list); | 10282 | list_del_init(&block_group->bg_list); |
10283 | |||
10284 | space_info = block_group->space_info; | ||
10285 | |||
10284 | if (ret || btrfs_mixed_space_info(space_info)) { | 10286 | if (ret || btrfs_mixed_space_info(space_info)) { |
10285 | btrfs_put_block_group(block_group); | 10287 | btrfs_put_block_group(block_group); |
10286 | continue; | 10288 | continue; |
10287 | } | 10289 | } |
10288 | spin_unlock(&fs_info->unused_bgs_lock); | 10290 | spin_unlock(&fs_info->unused_bgs_lock); |
10289 | 10291 | ||
10290 | mutex_lock(&root->fs_info->delete_unused_bgs_mutex); | 10292 | mutex_lock(&fs_info->delete_unused_bgs_mutex); |
10291 | 10293 | ||
10292 | /* Don't want to race with allocators so take the groups_sem */ | 10294 | /* Don't want to race with allocators so take the groups_sem */ |
10293 | down_write(&space_info->groups_sem); | 10295 | down_write(&space_info->groups_sem); |
10294 | spin_lock(&block_group->lock); | 10296 | spin_lock(&block_group->lock); |
10295 | if (block_group->reserved || | 10297 | if (block_group->reserved || |
10296 | btrfs_block_group_used(&block_group->item) || | 10298 | btrfs_block_group_used(&block_group->item) || |
10297 | block_group->ro) { | 10299 | block_group->ro || |
10300 | list_is_singular(&block_group->list)) { | ||
10298 | /* | 10301 | /* |
10299 | * We want to bail if we made new allocations or have | 10302 | * We want to bail if we made new allocations or have |
10300 | * outstanding allocations in this block group. We do | 10303 | * outstanding allocations in this block group. We do |
@@ -10410,7 +10413,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) | |||
10410 | end_trans: | 10413 | end_trans: |
10411 | btrfs_end_transaction(trans, root); | 10414 | btrfs_end_transaction(trans, root); |
10412 | next: | 10415 | next: |
10413 | mutex_unlock(&root->fs_info->delete_unused_bgs_mutex); | 10416 | mutex_unlock(&fs_info->delete_unused_bgs_mutex); |
10414 | btrfs_put_block_group(block_group); | 10417 | btrfs_put_block_group(block_group); |
10415 | spin_lock(&fs_info->unused_bgs_lock); | 10418 | spin_lock(&fs_info->unused_bgs_lock); |
10416 | } | 10419 | } |