Commit 9e715da8 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Remove fs_info from free_excluded_extents

It can be referenced from the passed block group.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 451a2c13
...@@ -217,9 +217,9 @@ static int add_excluded_extent(struct btrfs_fs_info *fs_info, ...@@ -217,9 +217,9 @@ static int add_excluded_extent(struct btrfs_fs_info *fs_info,
return 0; return 0;
} }
static void free_excluded_extents(struct btrfs_fs_info *fs_info, static void free_excluded_extents(struct btrfs_block_group_cache *cache)
struct btrfs_block_group_cache *cache)
{ {
struct btrfs_fs_info *fs_info = cache->fs_info;
u64 start, end; u64 start, end;
start = cache->key.objectid; start = cache->key.objectid;
...@@ -555,7 +555,7 @@ static noinline void caching_thread(struct btrfs_work *work) ...@@ -555,7 +555,7 @@ static noinline void caching_thread(struct btrfs_work *work)
caching_ctl->progress = (u64)-1; caching_ctl->progress = (u64)-1;
up_read(&fs_info->commit_root_sem); up_read(&fs_info->commit_root_sem);
free_excluded_extents(fs_info, block_group); free_excluded_extents(block_group);
mutex_unlock(&caching_ctl->mutex); mutex_unlock(&caching_ctl->mutex);
wake_up(&caching_ctl->wait); wake_up(&caching_ctl->wait);
...@@ -663,7 +663,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache, ...@@ -663,7 +663,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache,
wake_up(&caching_ctl->wait); wake_up(&caching_ctl->wait);
if (ret == 1) { if (ret == 1) {
put_caching_control(caching_ctl); put_caching_control(caching_ctl);
free_excluded_extents(fs_info, cache); free_excluded_extents(cache);
return 0; return 0;
} }
} else { } else {
...@@ -9860,7 +9860,7 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info) ...@@ -9860,7 +9860,7 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
*/ */
if (block_group->cached == BTRFS_CACHE_NO || if (block_group->cached == BTRFS_CACHE_NO ||
block_group->cached == BTRFS_CACHE_ERROR) block_group->cached == BTRFS_CACHE_ERROR)
free_excluded_extents(info, block_group); free_excluded_extents(block_group);
btrfs_remove_free_space_cache(block_group); btrfs_remove_free_space_cache(block_group);
ASSERT(block_group->cached != BTRFS_CACHE_STARTED); ASSERT(block_group->cached != BTRFS_CACHE_STARTED);
...@@ -10108,7 +10108,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) ...@@ -10108,7 +10108,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
* We may have excluded something, so call this just in * We may have excluded something, so call this just in
* case. * case.
*/ */
free_excluded_extents(info, cache); free_excluded_extents(cache);
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
goto error; goto error;
} }
...@@ -10123,14 +10123,14 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) ...@@ -10123,14 +10123,14 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
if (found_key.offset == btrfs_block_group_used(&cache->item)) { if (found_key.offset == btrfs_block_group_used(&cache->item)) {
cache->last_byte_to_unpin = (u64)-1; cache->last_byte_to_unpin = (u64)-1;
cache->cached = BTRFS_CACHE_FINISHED; cache->cached = BTRFS_CACHE_FINISHED;
free_excluded_extents(info, cache); free_excluded_extents(cache);
} else if (btrfs_block_group_used(&cache->item) == 0) { } else if (btrfs_block_group_used(&cache->item) == 0) {
cache->last_byte_to_unpin = (u64)-1; cache->last_byte_to_unpin = (u64)-1;
cache->cached = BTRFS_CACHE_FINISHED; cache->cached = BTRFS_CACHE_FINISHED;
add_new_free_space(cache, found_key.objectid, add_new_free_space(cache, found_key.objectid,
found_key.objectid + found_key.objectid +
found_key.offset); found_key.offset);
free_excluded_extents(info, cache); free_excluded_extents(cache);
} }
ret = btrfs_add_block_group_cache(info, cache); ret = btrfs_add_block_group_cache(info, cache);
...@@ -10259,14 +10259,14 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, u64 bytes_used, ...@@ -10259,14 +10259,14 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, u64 bytes_used,
* We may have excluded something, so call this just in * We may have excluded something, so call this just in
* case. * case.
*/ */
free_excluded_extents(fs_info, cache); free_excluded_extents(cache);
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
return ret; return ret;
} }
add_new_free_space(cache, chunk_offset, chunk_offset + size); add_new_free_space(cache, chunk_offset, chunk_offset + size);
free_excluded_extents(fs_info, cache); free_excluded_extents(cache);
#ifdef CONFIG_BTRFS_DEBUG #ifdef CONFIG_BTRFS_DEBUG
if (btrfs_should_fragment_free_space(cache)) { if (btrfs_should_fragment_free_space(cache)) {
...@@ -10350,7 +10350,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, ...@@ -10350,7 +10350,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
* Free the reserved super bytes from this block group before * Free the reserved super bytes from this block group before
* remove it. * remove it.
*/ */
free_excluded_extents(fs_info, block_group); free_excluded_extents(block_group);
btrfs_free_ref_tree_range(fs_info, block_group->key.objectid, btrfs_free_ref_tree_range(fs_info, block_group->key.objectid,
block_group->key.offset); block_group->key.offset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment