diff mbox series

[4/8] btrfs: relocation: open code mapping_tree_init

Message ID 90521cf5613540330ffde6ec78dc0210aa05d146.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
There's only one user of mapping_tree_init, we don't need a helper for
the simple initialization.

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

Comments

Johannes Thumshirn Sept. 22, 2023, 12:31 p.m. UTC | #1
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Qu Wenruo Sept. 22, 2023, 10:31 p.m. UTC | #2
On 2023/9/22 20:37, David Sterba wrote:
> There's only one user of mapping_tree_init, we don't need a helper for
> the simple initialization.
>
> Signed-off-by: David Sterba <dsterba@suse.com>

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

Thanks,
Qu
> ---
>   fs/btrfs/relocation.c | 10 ++--------
>   1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 87ac8528032c..3e662cadecaf 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -183,13 +183,6 @@ static void mark_block_processed(struct reloc_control *rc,
>   	node->processed = 1;
>   }
>
> -
> -static void mapping_tree_init(struct mapping_tree *tree)
> -{
> -	tree->rb_root = RB_ROOT;
> -	spin_lock_init(&tree->lock);
> -}
> -
>   /*
>    * walk up backref nodes until reach node presents tree root
>    */
> @@ -4024,7 +4017,8 @@ static struct reloc_control *alloc_reloc_control(struct btrfs_fs_info *fs_info)
>   	INIT_LIST_HEAD(&rc->reloc_roots);
>   	INIT_LIST_HEAD(&rc->dirty_subvol_roots);
>   	btrfs_backref_init_cache(fs_info, &rc->backref_cache, 1);
> -	mapping_tree_init(&rc->reloc_root_tree);
> +	rc->reloc_root_tree.rb_root = RB_ROOT;
> +	spin_lock_init(&rc->reloc_root_tree.lock);
>   	extent_io_tree_init(fs_info, &rc->processed_blocks, IO_TREE_RELOC_BLOCKS);
>   	return rc;
>   }
diff mbox series

Patch

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 87ac8528032c..3e662cadecaf 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -183,13 +183,6 @@  static void mark_block_processed(struct reloc_control *rc,
 	node->processed = 1;
 }
 
-
-static void mapping_tree_init(struct mapping_tree *tree)
-{
-	tree->rb_root = RB_ROOT;
-	spin_lock_init(&tree->lock);
-}
-
 /*
  * walk up backref nodes until reach node presents tree root
  */
@@ -4024,7 +4017,8 @@  static struct reloc_control *alloc_reloc_control(struct btrfs_fs_info *fs_info)
 	INIT_LIST_HEAD(&rc->reloc_roots);
 	INIT_LIST_HEAD(&rc->dirty_subvol_roots);
 	btrfs_backref_init_cache(fs_info, &rc->backref_cache, 1);
-	mapping_tree_init(&rc->reloc_root_tree);
+	rc->reloc_root_tree.rb_root = RB_ROOT;
+	spin_lock_init(&rc->reloc_root_tree.lock);
 	extent_io_tree_init(fs_info, &rc->processed_blocks, IO_TREE_RELOC_BLOCKS);
 	return rc;
 }