From: Josef Bacik <josef@toxicpanda.com>
Date: Thu, 20 Jun 2019 15:38:07 -0400
Subject: btrfs: unexport the temporary exported functions
Git-commit: e11c0406ad1bb602e1e880fa4ff37dadb716639d
Patch-mainline: v5.4-rc1
References: bsc#1165949
These were renamed and exported to facilitate logical migration of
different code chunks into block-group.c. Now that all the users are in
one file go ahead and rename them back, move the code around, and make
them static.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Acked-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/block-group.c | 22 +++++++++++-----------
fs/btrfs/block-group.h | 3 ---
2 files changed, 11 insertions(+), 14 deletions(-)
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -434,7 +434,7 @@ int btrfs_wait_block_group_cache_done(st
}
#ifdef CONFIG_BTRFS_DEBUG
-void btrfs_fragment_free_space(struct btrfs_block_group_cache *block_group)
+static void fragment_free_space(struct btrfs_block_group_cache *block_group)
{
struct btrfs_fs_info *fs_info = block_group->fs_info;
u64 start = block_group->key.objectid;
@@ -671,7 +671,7 @@ static noinline void caching_thread(stru
block_group->space_info->bytes_used += bytes_used >> 1;
spin_unlock(&block_group->lock);
spin_unlock(&block_group->space_info->lock);
- btrfs_fragment_free_space(block_group);
+ fragment_free_space(block_group);
}
#endif
@@ -778,7 +778,7 @@ int btrfs_cache_block_group(struct btrfs
cache->space_info->bytes_used += bytes_used >> 1;
spin_unlock(&cache->lock);
spin_unlock(&cache->space_info->lock);
- btrfs_fragment_free_space(cache);
+ fragment_free_space(cache);
}
#endif
mutex_unlock(&caching_ctl->mutex);
@@ -1182,7 +1182,7 @@ struct btrfs_trans_handle *btrfs_start_t
* data in this block group. That check should be done by relocation routine,
* not this function.
*/
-int __btrfs_inc_block_group_ro(struct btrfs_block_group_cache *cache, int force)
+static int inc_block_group_ro(struct btrfs_block_group_cache *cache, int force)
{
struct btrfs_space_info *sinfo = cache->space_info;
u64 num_bytes;
@@ -1297,7 +1297,7 @@ void btrfs_delete_unused_bgs(struct btrf
spin_unlock(&block_group->lock);
/* We don't want to force the issue, only flip if it's ok. */
- ret = __btrfs_inc_block_group_ro(block_group, 0);
+ ret = inc_block_group_ro(block_group, 0);
up_write(&space_info->groups_sem);
if (ret < 0) {
ret = 0;
@@ -1824,7 +1824,7 @@ int btrfs_read_block_groups(struct btrfs
set_avail_alloc_bits(info, cache->flags);
if (btrfs_chunk_readonly(info, cache->key.objectid)) {
- __btrfs_inc_block_group_ro(cache, 1);
+ inc_block_group_ro(cache, 1);
} else if (btrfs_block_group_used(&cache->item) == 0) {
spin_lock(&info->unused_bgs_lock);
/* Should always be true but just in case. */
@@ -1852,11 +1852,11 @@ int btrfs_read_block_groups(struct btrfs
list_for_each_entry(cache,
&space_info->block_groups[BTRFS_RAID_RAID0],
list)
- __btrfs_inc_block_group_ro(cache, 1);
+ inc_block_group_ro(cache, 1);
list_for_each_entry(cache,
&space_info->block_groups[BTRFS_RAID_SINGLE],
list)
- __btrfs_inc_block_group_ro(cache, 1);
+ inc_block_group_ro(cache, 1);
}
btrfs_add_raid_kobjects(info);
@@ -1950,7 +1950,7 @@ int btrfs_make_block_group(struct btrfs_
u64 new_bytes_used = size - bytes_used;
bytes_used += new_bytes_used >> 1;
- btrfs_fragment_free_space(cache);
+ fragment_free_space(cache);
}
#endif
/*
@@ -2085,14 +2085,14 @@ again:
goto out;
}
- ret = __btrfs_inc_block_group_ro(cache, 0);
+ ret = inc_block_group_ro(cache, 0);
if (!ret)
goto out;
alloc_flags = btrfs_get_alloc_profile(fs_info, cache->space_info->flags);
ret = btrfs_chunk_alloc(trans, alloc_flags, CHUNK_ALLOC_FORCE);
if (ret < 0)
goto out;
- ret = __btrfs_inc_block_group_ro(cache, 0);
+ ret = inc_block_group_ro(cache, 0);
out:
if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM) {
alloc_flags = update_block_group_flags(fs_info, cache->flags);
--- a/fs/btrfs/block-group.h
+++ b/fs/btrfs/block-group.h
@@ -166,7 +166,6 @@ static inline int btrfs_should_fragment_
(btrfs_test_opt(fs_info, FRAGMENT_DATA) &&
block_group->flags & BTRFS_BLOCK_GROUP_DATA);
}
-void btrfs_fragment_free_space(struct btrfs_block_group_cache *block_group);
#endif
struct btrfs_block_group_cache *btrfs_lookup_first_block_group(
@@ -249,7 +248,5 @@ static inline int btrfs_block_group_cach
cache->cached == BTRFS_CACHE_ERROR;
}
-int __btrfs_inc_block_group_ro(struct btrfs_block_group_cache *cache, int force);
u64 btrfs_get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags);
-
#endif /* BTRFS_BLOCK_GROUP_H */