mbox series

[0/5,v2] Fix global reserve size and can overcommit

Message ID 20190822191904.13939-1-josef@toxicpanda.com (mailing list archive)
Headers show
Series Fix global reserve size and can overcommit | expand

Message

Josef Bacik Aug. 22, 2019, 7:18 p.m. UTC
This didn't series didn't change much, but I did move things around a little bit
in previous series so these needed to be updated.

 fs/btrfs/block-rsv.c  | 36 ++++++++++++++++++++++++++----------
 fs/btrfs/space-info.c | 51 ++++++++++++++++++++++++++-------------------------
 2 files changed, 52 insertions(+), 35 deletions(-)

v1->v2:
- Rebased with the new name changes from previous patches.
- Added the reviewed-by's.
- Added a few lockdep_assert_held()'s.
- Patch " btrfs: use btrfs_try_granting_tickets in update_global_rsv" fixed to
  just use btrfs_try_granting_tickets directly since we're already holding the
  space_info->lock.

-- Original email --
We hit a pretty crappy corner case in production that resulted in boxes slowing
down to a crawl.

can_overcommit() will not allow us to overcommit if there is not enough "real"
space to satisfy the global reserve.  This is for hysterical raisins, we used to
not be able to allocate block groups a transaction commit time, so running out
of real space for the global reserve would result in an aborted transaction.

However that limitation was fixed years ago, so we no longer need to impose that
limitation on ourselves and can just overcommit with reckless abandon.

But this change exposed a bunch of corner cases in how we deal with very small
file systems.  A lot of enospc related xfstests make very tiny file systems.
Btrfs by default gives you an 8mib metadata chunk.  We default to having a
minimum global reserve size of 16mib.  This is problematic.

Before we would allocate a new metadata chunk, which actually meant we were
"passing" these tests with 24mib metadata chunks but 256kib of used metadata,
and drastically less data space than was intended.  With my change we started
failing these tests because we were no longer allocating the extra metadata
chunks.

The changes to the global reserve are to make it so we pass these xfstests, as
well as add some real hard logic to the minimum size of the global reserve,
rather than just an arbitrary 16mib.  In practice those changes won't affect
real users because real users use more than 8mib of metadata and will get full
chunks.

These patches fix the original problem I intended to fix, and also have the nice
side-effect of making a bunch of the enospc xfstests finish _much_ faster.  The
diffstat is as follows

 fs/btrfs/block-rsv.c  | 43 ++++++++++++++++++++++++++++++-------------
 fs/btrfs/space-info.c | 51 +++++++++++++++++++++++++--------------------------
 2 files changed, 55 insertions(+), 39 deletions(-)

Thanks,

Josef

Comments

David Sterba Aug. 23, 2019, 1:17 p.m. UTC | #1
On Thu, Aug 22, 2019 at 03:18:59PM -0400, Josef Bacik wrote:
> This didn't series didn't change much, but I did move things around a little bit
> in previous series so these needed to be updated.
> 
>  fs/btrfs/block-rsv.c  | 36 ++++++++++++++++++++++++++----------
>  fs/btrfs/space-info.c | 51 ++++++++++++++++++++++++++-------------------------
>  2 files changed, 52 insertions(+), 35 deletions(-)

Added as topic branch to for-next (based on the ticket rework patchset).
David Sterba Aug. 28, 2019, 6:03 p.m. UTC | #2
On Fri, Aug 23, 2019 at 03:17:26PM +0200, David Sterba wrote:
> On Thu, Aug 22, 2019 at 03:18:59PM -0400, Josef Bacik wrote:
> > This didn't series didn't change much, but I did move things around a little bit
> > in previous series so these needed to be updated.
> > 
> >  fs/btrfs/block-rsv.c  | 36 ++++++++++++++++++++++++++----------
> >  fs/btrfs/space-info.c | 51 ++++++++++++++++++++++++++-------------------------
> >  2 files changed, 52 insertions(+), 35 deletions(-)
> 
> Added as topic branch to for-next (based on the ticket rework patchset).

Moved to misc-next.