diff mbox series

[10/17] btrfs: move btrfs_should_fragment_free_space into block-group.c

Message ID 50ba0e87399977ef84a5d3787666fc6ce6c5cf3a.1663167823.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs: initial ctree.h cleanups, simple stuff | expand

Commit Message

Josef Bacik Sept. 14, 2022, 3:06 p.m. UTC
This function uses functions that are not defined in block-group.h, move
it into block-group.c in order to keep the header clean.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/block-group.c | 12 ++++++++++++
 fs/btrfs/block-group.h | 11 +----------
 2 files changed, 13 insertions(+), 10 deletions(-)

Comments

Qu Wenruo Sept. 15, 2022, 9:16 a.m. UTC | #1
On 2022/9/14 23:06, Josef Bacik wrote:
> This function uses functions that are not defined in block-group.h, move
> it into block-group.c in order to keep the header clean.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>


Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/block-group.c | 12 ++++++++++++
>   fs/btrfs/block-group.h | 11 +----------
>   2 files changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
> index c52b6e245b9a..c91f47a45b06 100644
> --- a/fs/btrfs/block-group.c
> +++ b/fs/btrfs/block-group.c
> @@ -18,6 +18,18 @@
>   #include "raid56.h"
>   #include "zoned.h"
>   
> +#ifdef CONFIG_BTRFS_DEBUG
> +int btrfs_should_fragment_free_space(struct btrfs_block_group *block_group)
> +{
> +	struct btrfs_fs_info *fs_info = block_group->fs_info;
> +
> +	return (btrfs_test_opt(fs_info, FRAGMENT_METADATA) &&
> +		block_group->flags & BTRFS_BLOCK_GROUP_METADATA) ||
> +	       (btrfs_test_opt(fs_info, FRAGMENT_DATA) &&
> +		block_group->flags &  BTRFS_BLOCK_GROUP_DATA);
> +}
> +#endif
> +
>   /*
>    * Return target flags in extended format or 0 if restripe for this chunk_type
>    * is not in progress
> diff --git a/fs/btrfs/block-group.h b/fs/btrfs/block-group.h
> index 4d4d2e1f137b..e34cb80ffb25 100644
> --- a/fs/btrfs/block-group.h
> +++ b/fs/btrfs/block-group.h
> @@ -242,16 +242,7 @@ static inline bool btrfs_is_block_group_data_only(
>   }
>   
>   #ifdef CONFIG_BTRFS_DEBUG
> -static inline int btrfs_should_fragment_free_space(
> -		struct btrfs_block_group *block_group)
> -{
> -	struct btrfs_fs_info *fs_info = block_group->fs_info;
> -
> -	return (btrfs_test_opt(fs_info, FRAGMENT_METADATA) &&
> -		block_group->flags & BTRFS_BLOCK_GROUP_METADATA) ||
> -	       (btrfs_test_opt(fs_info, FRAGMENT_DATA) &&
> -		block_group->flags &  BTRFS_BLOCK_GROUP_DATA);
> -}
> +int btrfs_should_fragment_free_space(struct btrfs_block_group *block_group);
>   #endif
>   
>   struct btrfs_block_group *btrfs_lookup_first_block_group(
Johannes Thumshirn Sept. 15, 2022, 2:21 p.m. UTC | #2
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index c52b6e245b9a..c91f47a45b06 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -18,6 +18,18 @@ 
 #include "raid56.h"
 #include "zoned.h"
 
+#ifdef CONFIG_BTRFS_DEBUG
+int btrfs_should_fragment_free_space(struct btrfs_block_group *block_group)
+{
+	struct btrfs_fs_info *fs_info = block_group->fs_info;
+
+	return (btrfs_test_opt(fs_info, FRAGMENT_METADATA) &&
+		block_group->flags & BTRFS_BLOCK_GROUP_METADATA) ||
+	       (btrfs_test_opt(fs_info, FRAGMENT_DATA) &&
+		block_group->flags &  BTRFS_BLOCK_GROUP_DATA);
+}
+#endif
+
 /*
  * Return target flags in extended format or 0 if restripe for this chunk_type
  * is not in progress
diff --git a/fs/btrfs/block-group.h b/fs/btrfs/block-group.h
index 4d4d2e1f137b..e34cb80ffb25 100644
--- a/fs/btrfs/block-group.h
+++ b/fs/btrfs/block-group.h
@@ -242,16 +242,7 @@  static inline bool btrfs_is_block_group_data_only(
 }
 
 #ifdef CONFIG_BTRFS_DEBUG
-static inline int btrfs_should_fragment_free_space(
-		struct btrfs_block_group *block_group)
-{
-	struct btrfs_fs_info *fs_info = block_group->fs_info;
-
-	return (btrfs_test_opt(fs_info, FRAGMENT_METADATA) &&
-		block_group->flags & BTRFS_BLOCK_GROUP_METADATA) ||
-	       (btrfs_test_opt(fs_info, FRAGMENT_DATA) &&
-		block_group->flags &  BTRFS_BLOCK_GROUP_DATA);
-}
+int btrfs_should_fragment_free_space(struct btrfs_block_group *block_group);
 #endif
 
 struct btrfs_block_group *btrfs_lookup_first_block_group(