On Fri, Nov 08, 2019 at 03:14:58PM -0500, Dennis Zhou wrote: > On Fri, Nov 08, 2019 at 02:46:51PM -0500, Josef Bacik wrote: > > On Wed, Oct 23, 2019 at 06:53:12PM -0400, 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. > > > > > > > Hmm now that I look at this, it seems like we won't even discard empty metadata > > block groups now, right? Or am I missing something? Thanks, > > > > Empty block groups go through btrfs_add_to_discard_unused_list() which > skips that check. So metadata blocks will be discarded here from > btrfs_discard_queue_work() which should be called from > __btrfs_add_free_space(). > > We should just skip discarding metadata blocks while they are being > used. I believe discarding metadata blocks while in use is called corruption :) But I understand what you mean.
