[10/10] btrfs-progs: cleanups after block group cache reform
diff mbox series

Message ID 20191205042921.25316-11-Damenly_Su@gmx.com
State New
Headers show
Series
  • unify origanization structure of block group cache
Related show

Commit Message

Damenly Su Dec. 5, 2019, 4:29 a.m. UTC
From: Su Yue <Damenly_Su@gmx.com>

btrfs_fs_info::block_group_cache and the bit BLOCK_GROUP_DIRY are
useless. So is the block_group_state_bits().

Remove them.

Signed-off-by: Su Yue <Damenly_Su@gmx.com>
---
 ctree.h       |  1 -
 disk-io.c     |  2 --
 extent-tree.c | 12 ------------
 extent_io.h   |  2 --
 4 files changed, 17 deletions(-)

Comments

Qu Wenruo Dec. 5, 2019, 7:52 a.m. UTC | #1
On 2019/12/5 下午12:29, damenly.su@gmail.com wrote:
> From: Su Yue <Damenly_Su@gmx.com>
> 
> btrfs_fs_info::block_group_cache and the bit BLOCK_GROUP_DIRY are
> useless. So is the block_group_state_bits().
> 
> Remove them.
> 
> Signed-off-by: Su Yue <Damenly_Su@gmx.com>
> ---
>  ctree.h       |  1 -
>  disk-io.c     |  2 --
>  extent-tree.c | 12 ------------
>  extent_io.h   |  2 --
>  4 files changed, 17 deletions(-)

Everyone loves such cleanup.

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

Thanks,
Qu

> 
> diff --git a/ctree.h b/ctree.h
> index 53882d04ac03..6d2fad6406d7 100644
> --- a/ctree.h
> +++ b/ctree.h
> @@ -1146,7 +1146,6 @@ struct btrfs_fs_info {
>  
>  	struct extent_io_tree extent_cache;
>  	struct extent_io_tree free_space_cache;
> -	struct extent_io_tree block_group_cache;
>  	struct extent_io_tree pinned_extents;
>  	struct extent_io_tree extent_ins;
>  	struct extent_io_tree *excluded_extents;
> diff --git a/disk-io.c b/disk-io.c
> index b7ae72a99f59..95958d9706da 100644
> --- a/disk-io.c
> +++ b/disk-io.c
> @@ -794,7 +794,6 @@ struct btrfs_fs_info *btrfs_new_fs_info(int writable, u64 sb_bytenr)
>  
>  	extent_io_tree_init(&fs_info->extent_cache);
>  	extent_io_tree_init(&fs_info->free_space_cache);
> -	extent_io_tree_init(&fs_info->block_group_cache);
>  	extent_io_tree_init(&fs_info->pinned_extents);
>  	extent_io_tree_init(&fs_info->extent_ins);
>  
> @@ -1069,7 +1068,6 @@ void btrfs_cleanup_all_caches(struct btrfs_fs_info *fs_info)
>  	free_mapping_cache_tree(&fs_info->mapping_tree.cache_tree);
>  	extent_io_tree_cleanup(&fs_info->extent_cache);
>  	extent_io_tree_cleanup(&fs_info->free_space_cache);
> -	extent_io_tree_cleanup(&fs_info->block_group_cache);
>  	extent_io_tree_cleanup(&fs_info->pinned_extents);
>  	extent_io_tree_cleanup(&fs_info->extent_ins);
>  }
> diff --git a/extent-tree.c b/extent-tree.c
> index e227c4db51cf..2815888b6cc5 100644
> --- a/extent-tree.c
> +++ b/extent-tree.c
> @@ -333,18 +333,6 @@ wrapped:
>  	goto again;
>  }
>  
> -static int block_group_state_bits(u64 flags)
> -{
> -	int bits = 0;
> -	if (flags & BTRFS_BLOCK_GROUP_DATA)
> -		bits |= BLOCK_GROUP_DATA;
> -	if (flags & BTRFS_BLOCK_GROUP_METADATA)
> -		bits |= BLOCK_GROUP_METADATA;
> -	if (flags & BTRFS_BLOCK_GROUP_SYSTEM)
> -		bits |= BLOCK_GROUP_SYSTEM;
> -	return bits;
> -}
> -
>  static struct btrfs_block_group_cache *
>  btrfs_find_block_group(struct btrfs_root *root, struct btrfs_block_group_cache
>  		       *hint, u64 search_start, int data, int owner)
> diff --git a/extent_io.h b/extent_io.h
> index 1715acc60708..7f88e3f8a305 100644
> --- a/extent_io.h
> +++ b/extent_io.h
> @@ -47,8 +47,6 @@
>  #define BLOCK_GROUP_METADATA	(1U << 2)
>  #define BLOCK_GROUP_SYSTEM	(1U << 4)
>  
> -#define BLOCK_GROUP_DIRTY 	(1U)
> -
>  /*
>   * The extent buffer bitmap operations are done with byte granularity instead of
>   * word granularity for two reasons:
>

Patch
diff mbox series

diff --git a/ctree.h b/ctree.h
index 53882d04ac03..6d2fad6406d7 100644
--- a/ctree.h
+++ b/ctree.h
@@ -1146,7 +1146,6 @@  struct btrfs_fs_info {
 
 	struct extent_io_tree extent_cache;
 	struct extent_io_tree free_space_cache;
-	struct extent_io_tree block_group_cache;
 	struct extent_io_tree pinned_extents;
 	struct extent_io_tree extent_ins;
 	struct extent_io_tree *excluded_extents;
diff --git a/disk-io.c b/disk-io.c
index b7ae72a99f59..95958d9706da 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -794,7 +794,6 @@  struct btrfs_fs_info *btrfs_new_fs_info(int writable, u64 sb_bytenr)
 
 	extent_io_tree_init(&fs_info->extent_cache);
 	extent_io_tree_init(&fs_info->free_space_cache);
-	extent_io_tree_init(&fs_info->block_group_cache);
 	extent_io_tree_init(&fs_info->pinned_extents);
 	extent_io_tree_init(&fs_info->extent_ins);
 
@@ -1069,7 +1068,6 @@  void btrfs_cleanup_all_caches(struct btrfs_fs_info *fs_info)
 	free_mapping_cache_tree(&fs_info->mapping_tree.cache_tree);
 	extent_io_tree_cleanup(&fs_info->extent_cache);
 	extent_io_tree_cleanup(&fs_info->free_space_cache);
-	extent_io_tree_cleanup(&fs_info->block_group_cache);
 	extent_io_tree_cleanup(&fs_info->pinned_extents);
 	extent_io_tree_cleanup(&fs_info->extent_ins);
 }
diff --git a/extent-tree.c b/extent-tree.c
index e227c4db51cf..2815888b6cc5 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -333,18 +333,6 @@  wrapped:
 	goto again;
 }
 
-static int block_group_state_bits(u64 flags)
-{
-	int bits = 0;
-	if (flags & BTRFS_BLOCK_GROUP_DATA)
-		bits |= BLOCK_GROUP_DATA;
-	if (flags & BTRFS_BLOCK_GROUP_METADATA)
-		bits |= BLOCK_GROUP_METADATA;
-	if (flags & BTRFS_BLOCK_GROUP_SYSTEM)
-		bits |= BLOCK_GROUP_SYSTEM;
-	return bits;
-}
-
 static struct btrfs_block_group_cache *
 btrfs_find_block_group(struct btrfs_root *root, struct btrfs_block_group_cache
 		       *hint, u64 search_start, int data, int owner)
diff --git a/extent_io.h b/extent_io.h
index 1715acc60708..7f88e3f8a305 100644
--- a/extent_io.h
+++ b/extent_io.h
@@ -47,8 +47,6 @@ 
 #define BLOCK_GROUP_METADATA	(1U << 2)
 #define BLOCK_GROUP_SYSTEM	(1U << 4)
 
-#define BLOCK_GROUP_DIRTY 	(1U)
-
 /*
  * The extent buffer bitmap operations are done with byte granularity instead of
  * word granularity for two reasons: