Message ID | 20191205042921.25316-3-Damenly_Su@gmx.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | unify origanization structure of block group cache | expand |
On 2019/12/5 下午12:29, damenly.su@gmail.com wrote: > From: Su Yue <Damenly_Su@gmx.com> > > To convert from existed extent_cache to plain rb_tree, add > btrfs_block_group_cache::cache_node and btrfs_fs_info::block_group_ > cache_tree. > > Signed-off-by: Su Yue <Damenly_Su@gmx.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > ctree.h | 21 ++++++++++++--------- > disk-io.c | 2 ++ > 2 files changed, 14 insertions(+), 9 deletions(-) > > diff --git a/ctree.h b/ctree.h > index 3e50d0863bde..f3f5f52f2559 100644 > --- a/ctree.h > +++ b/ctree.h > @@ -1107,16 +1107,18 @@ struct btrfs_block_group_cache { > int cached; > int ro; > /* > - * If the free space extent count exceeds this number, convert the block > - * group to bitmaps. > - */ > - u32 bitmap_high_thresh; > - /* > - * If the free space extent count drops below this number, convert the > - * block group back to extents. > - */ > - u32 bitmap_low_thresh; > + * If the free space extent count exceeds this number, convert the block > + * group to bitmaps. > + */ > + u32 bitmap_high_thresh; > + /* > + * If the free space extent count drops below this number, convert the > + * block group back to extents. > + */ > + u32 bitmap_low_thresh; > > + /* Block group cache stuff */ > + struct rb_node cache_node; > }; > > struct btrfs_device; > @@ -1146,6 +1148,7 @@ struct btrfs_fs_info { > struct extent_io_tree extent_ins; > struct extent_io_tree *excluded_extents; > > + struct rb_root block_group_cache_tree; > /* logical->physical extent mapping */ > struct btrfs_mapping_tree mapping_tree; > > diff --git a/disk-io.c b/disk-io.c > index 659f8b93a7ca..b7ae72a99f59 100644 > --- a/disk-io.c > +++ b/disk-io.c > @@ -797,6 +797,8 @@ struct btrfs_fs_info *btrfs_new_fs_info(int writable, u64 sb_bytenr) > 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); > + > + fs_info->block_group_cache_tree = RB_ROOT; > fs_info->excluded_extents = NULL; > > fs_info->fs_root_tree = RB_ROOT; >
diff --git a/ctree.h b/ctree.h index 3e50d0863bde..f3f5f52f2559 100644 --- a/ctree.h +++ b/ctree.h @@ -1107,16 +1107,18 @@ struct btrfs_block_group_cache { int cached; int ro; /* - * If the free space extent count exceeds this number, convert the block - * group to bitmaps. - */ - u32 bitmap_high_thresh; - /* - * If the free space extent count drops below this number, convert the - * block group back to extents. - */ - u32 bitmap_low_thresh; + * If the free space extent count exceeds this number, convert the block + * group to bitmaps. + */ + u32 bitmap_high_thresh; + /* + * If the free space extent count drops below this number, convert the + * block group back to extents. + */ + u32 bitmap_low_thresh; + /* Block group cache stuff */ + struct rb_node cache_node; }; struct btrfs_device; @@ -1146,6 +1148,7 @@ struct btrfs_fs_info { struct extent_io_tree extent_ins; struct extent_io_tree *excluded_extents; + struct rb_root block_group_cache_tree; /* logical->physical extent mapping */ struct btrfs_mapping_tree mapping_tree; diff --git a/disk-io.c b/disk-io.c index 659f8b93a7ca..b7ae72a99f59 100644 --- a/disk-io.c +++ b/disk-io.c @@ -797,6 +797,8 @@ struct btrfs_fs_info *btrfs_new_fs_info(int writable, u64 sb_bytenr) 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); + + fs_info->block_group_cache_tree = RB_ROOT; fs_info->excluded_extents = NULL; fs_info->fs_root_tree = RB_ROOT;