diff options
-rw-r--r-- | fs/btrfs/extent-tree.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 4d2508bbf6f0..1341163abe68 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -8337,9 +8337,15 @@ static void __link_block_group(struct btrfs_space_info *space_info, | |||
8337 | struct btrfs_block_group_cache *cache) | 8337 | struct btrfs_block_group_cache *cache) |
8338 | { | 8338 | { |
8339 | int index = get_block_group_index(cache); | 8339 | int index = get_block_group_index(cache); |
8340 | bool first = false; | ||
8340 | 8341 | ||
8341 | down_write(&space_info->groups_sem); | 8342 | down_write(&space_info->groups_sem); |
8342 | if (list_empty(&space_info->block_groups[index])) { | 8343 | if (list_empty(&space_info->block_groups[index])) |
8344 | first = true; | ||
8345 | list_add_tail(&cache->list, &space_info->block_groups[index]); | ||
8346 | up_write(&space_info->groups_sem); | ||
8347 | |||
8348 | if (first) { | ||
8343 | struct kobject *kobj = &space_info->block_group_kobjs[index]; | 8349 | struct kobject *kobj = &space_info->block_group_kobjs[index]; |
8344 | int ret; | 8350 | int ret; |
8345 | 8351 | ||
@@ -8351,8 +8357,6 @@ static void __link_block_group(struct btrfs_space_info *space_info, | |||
8351 | kobject_put(&space_info->kobj); | 8357 | kobject_put(&space_info->kobj); |
8352 | } | 8358 | } |
8353 | } | 8359 | } |
8354 | list_add_tail(&cache->list, &space_info->block_groups[index]); | ||
8355 | up_write(&space_info->groups_sem); | ||
8356 | } | 8360 | } |
8357 | 8361 | ||
8358 | static struct btrfs_block_group_cache * | 8362 | static struct btrfs_block_group_cache * |