Re: [PATCH 18/22] btrfs: only keep track of data extents for async discard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 30, 2019 at 06:39:54PM +0100, David Sterba wrote:
> On Fri, Dec 13, 2019 at 04:22:27PM -0800, Dennis Zhou wrote:
> > As mentioned earlier, discarding data can be done either by issuing an
> > explicit discard or implicitly by reusing the LBA. Metadata chunks see
> > much more frequent reuse due to well it being metadata. So instead of
> > explicitly discarding metadata blocks, just leave them be and let the
> > latter implicit discarding be done for them.
> > 
> > Signed-off-by: Dennis Zhou <dennis@xxxxxxxxxx>
> > Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
> > ---
> >  fs/btrfs/block-group.h |  6 ++++++
> >  fs/btrfs/discard.c     | 11 +++++++++--
> >  2 files changed, 15 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/btrfs/block-group.h b/fs/btrfs/block-group.h
> > index 601e1d217e22..ee8441439a56 100644
> > --- a/fs/btrfs/block-group.h
> > +++ b/fs/btrfs/block-group.h
> > @@ -182,6 +182,12 @@ static inline u64 btrfs_block_group_end(struct btrfs_block_group *block_group)
> >  	return (block_group->start + block_group->length);
> >  }
> >  
> > +static inline bool btrfs_is_block_group_data(
> > +					struct btrfs_block_group *block_group)
> > +{
> > +	return (block_group->flags & BTRFS_BLOCK_GROUP_DATA);
> 
> What happens for mixed data and metadata block groups? As this is a
> special mode that will likely lead to fragmented block groups I think
> that async discard won't be able to help much.
> 
> I'd suggest to make the test explicit only for the separate block group
> types and comment that mixed bg's are not supported.

Yeah it probably wouldn't do the system much good. I've renamed the test
to btrfs_is_block_group_data_only() and added a comment in the async
discard header patch to state that mixed block_groups aren't supported.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux