Re: [PATCH 9/9] btrfs: remove struct find_free_extent.ram_bytes

Omar Sandoval
2019-12-03T18:01:20Z

On Tue, Dec 03, 2019 at 02:27:13PM +0100, Johannes Thumshirn wrote:
> On Mon, Dec 02, 2019 at 05:34:25PM -0800, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@fb.com>
> >
> > This hasn't been used since it was first introduced in commit
> > b4bd745d1230 ("btrfs: Introduce find_free_extent_ctl structure for later
> > rework").
> >
> > Signed-off-by: Omar Sandoval <osandov@fb.com>
> > ---
> > fs/btrfs/extent-tree.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> > index 18df434bfe52..40c000269232 100644
> > --- a/fs/btrfs/extent-tree.c
> > +++ b/fs/btrfs/extent-tree.c
> > @@ -3437,7 +3437,6 @@ btrfs_release_block_group(struct btrfs_block_group *cache,
> > */
> > struct find_free_extent_ctl {
> > /* Basic allocation info */
> > - u64 ram_bytes;
> > u64 num_bytes;
> > u64 empty_size;
> > u64 flags;
> > @@ -3809,7 +3808,6 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info,
> >
> > WARN_ON(num_bytes < fs_info->sectorsize);
> >
> > - ffe_ctl.ram_bytes = ram_bytes;
> > ffe_ctl.num_bytes = num_bytes;
> > ffe_ctl.empty_size = empty_size;
> > ffe_ctl.flags = flags;
>
> Either that or pass in a find_free_extent_ctl to btrfs_add_reserved_bytes() as
> ram_bytes, num_bytes and delalloc are set in ffe_ctl. I personally would
> favour passing in ffe_ctl to btrfs_add_reserved_bytes() as well as others like
> btrfs_add_free_space(), btrfs_free_reserved_bytes() and so on.

That might be more convenient but it feels a little icky and layer
violating to me. It'd be nice to keep the space_info code separate from
find_free_extent.