diff mbox series

[3/8] btrfs: relocation: switch bitfields to bool in reloc_control

Message ID 28dd578b57ecb9270fe60b2170b4cac5c1ad77bf.1695380646.git.dsterba@suse.com (mailing list archive)
State New, archived
Headers show
Series Minor cleanups in relocation.c | expand

Commit Message

David Sterba Sept. 22, 2023, 11:07 a.m. UTC
Use bool types for the indicators instead of bitfields. The structure
size slightly grows but the new types are placed within the padding.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/relocation.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Johannes Thumshirn Sept. 22, 2023, 12:30 p.m. UTC | #1
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Qu Wenruo Sept. 22, 2023, 10:30 p.m. UTC | #2
On 2023/9/22 20:37, David Sterba wrote:
> Use bool types for the indicators instead of bitfields. The structure
> size slightly grows but the new types are placed within the padding.
>
> Signed-off-by: David Sterba <dsterba@suse.com>

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

Thanks,
Qu
> ---
>   fs/btrfs/relocation.c | 18 +++++++++---------
>   1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 3afe499f00b1..87ac8528032c 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -163,9 +163,9 @@ struct reloc_control {
>   	u64 extents_found;
>
>   	enum reloc_stage stage;
> -	unsigned int create_reloc_tree:1;
> -	unsigned int merge_reloc_tree:1;
> -	unsigned int found_file_extent:1;
> +	bool create_reloc_tree;
> +	bool merge_reloc_tree;
> +	bool found_file_extent;
>   };
>
>   static void mark_block_processed(struct reloc_control *rc,
> @@ -1902,7 +1902,7 @@ int prepare_to_merge(struct reloc_control *rc, int err)
>   		}
>   	}
>
> -	rc->merge_reloc_tree = 1;
> +	rc->merge_reloc_tree = true;
>
>   	while (!list_empty(&rc->reloc_roots)) {
>   		reloc_root = list_entry(rc->reloc_roots.next,
> @@ -3659,7 +3659,7 @@ int prepare_to_relocate(struct reloc_control *rc)
>   	if (ret)
>   		return ret;
>
> -	rc->create_reloc_tree = 1;
> +	rc->create_reloc_tree = true;
>   	set_reloc_control(rc);
>
>   	trans = btrfs_join_transaction(rc->extent_root);
> @@ -3786,7 +3786,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
>
>   		if (rc->stage == MOVE_DATA_EXTENTS &&
>   		    (flags & BTRFS_EXTENT_FLAG_DATA)) {
> -			rc->found_file_extent = 1;
> +			rc->found_file_extent = true;
>   			ret = relocate_data_extent(rc->data_inode,
>   						   &key, &rc->cluster);
>   			if (ret < 0) {
> @@ -3823,7 +3823,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
>   			err = ret;
>   	}
>
> -	rc->create_reloc_tree = 0;
> +	rc->create_reloc_tree = false;
>   	set_reloc_control(rc);
>
>   	btrfs_backref_release_cache(&rc->backref_cache);
> @@ -3841,7 +3841,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
>
>   	merge_reloc_roots(rc);
>
> -	rc->merge_reloc_tree = 0;
> +	rc->merge_reloc_tree = false;
>   	unset_reloc_control(rc);
>   	btrfs_block_rsv_release(fs_info, rc->block_rsv, (u64)-1, NULL);
>
> @@ -4355,7 +4355,7 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info)
>   		goto out_unset;
>   	}
>
> -	rc->merge_reloc_tree = 1;
> +	rc->merge_reloc_tree = true;
>
>   	while (!list_empty(&reloc_roots)) {
>   		reloc_root = list_entry(reloc_roots.next,
diff mbox series

Patch

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 3afe499f00b1..87ac8528032c 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -163,9 +163,9 @@  struct reloc_control {
 	u64 extents_found;
 
 	enum reloc_stage stage;
-	unsigned int create_reloc_tree:1;
-	unsigned int merge_reloc_tree:1;
-	unsigned int found_file_extent:1;
+	bool create_reloc_tree;
+	bool merge_reloc_tree;
+	bool found_file_extent;
 };
 
 static void mark_block_processed(struct reloc_control *rc,
@@ -1902,7 +1902,7 @@  int prepare_to_merge(struct reloc_control *rc, int err)
 		}
 	}
 
-	rc->merge_reloc_tree = 1;
+	rc->merge_reloc_tree = true;
 
 	while (!list_empty(&rc->reloc_roots)) {
 		reloc_root = list_entry(rc->reloc_roots.next,
@@ -3659,7 +3659,7 @@  int prepare_to_relocate(struct reloc_control *rc)
 	if (ret)
 		return ret;
 
-	rc->create_reloc_tree = 1;
+	rc->create_reloc_tree = true;
 	set_reloc_control(rc);
 
 	trans = btrfs_join_transaction(rc->extent_root);
@@ -3786,7 +3786,7 @@  static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
 
 		if (rc->stage == MOVE_DATA_EXTENTS &&
 		    (flags & BTRFS_EXTENT_FLAG_DATA)) {
-			rc->found_file_extent = 1;
+			rc->found_file_extent = true;
 			ret = relocate_data_extent(rc->data_inode,
 						   &key, &rc->cluster);
 			if (ret < 0) {
@@ -3823,7 +3823,7 @@  static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
 			err = ret;
 	}
 
-	rc->create_reloc_tree = 0;
+	rc->create_reloc_tree = false;
 	set_reloc_control(rc);
 
 	btrfs_backref_release_cache(&rc->backref_cache);
@@ -3841,7 +3841,7 @@  static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
 
 	merge_reloc_roots(rc);
 
-	rc->merge_reloc_tree = 0;
+	rc->merge_reloc_tree = false;
 	unset_reloc_control(rc);
 	btrfs_block_rsv_release(fs_info, rc->block_rsv, (u64)-1, NULL);
 
@@ -4355,7 +4355,7 @@  int btrfs_recover_relocation(struct btrfs_fs_info *fs_info)
 		goto out_unset;
 	}
 
-	rc->merge_reloc_tree = 1;
+	rc->merge_reloc_tree = true;
 
 	while (!list_empty(&reloc_roots)) {
 		reloc_root = list_entry(reloc_roots.next,