Re: [PATCH 13/20] xfs: rmap btree requires more reserved free space

Dave Chinner
2015-07-10T00:38:31Z

On Thu, Jun 25, 2015 at 12:41:04PM -0400, Brian Foster wrote:
> On Wed, Jun 03, 2015 at 04:04:50PM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > The rmap btree is allocated from the AGFL, which means we have to
> > ensure ENOSPC is reported to userspace before we run out of free
> > space in each AG. The last allocation in an AG can cause a full
> > height rmap btree split, and that means we have to reserve at least
> > this many blocks *in each AG* to be placed on the AGFL at ENOSPC.
> > Update the various space calculation functiosn to handle this.
> >
> > Also, because the macros are now executing conditional code and are called quite
> > frequently, convert them to functions that initialise varaibles in the struct
> > xfs_mount, use the new variables everywhere and document the calculations
> > better.
> >
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
.....
> > + * so we set the number of set-aside blocks to 4 + 4*agcount when not using rmap
> > + * btrees.
> > + *
> > + * When rmap btrees are active, we have to consider that using the last block in
> > + * the AG can cause a full height rmap btree split and we need enough blocks on
> > + * the AGFL to be able to handle this. That means we have, in addition to the
> > + * above consideration, another (2 * mp->m_ag_levels) - 1 blocks required to be
> > + * available to the free list.
> > + */
>
> BTW, I think I get the 2 block per level log requirement in that a split
> requires logging the two blocks involved. Where does the 2nd block per
> level come in as an allocation requirement?

Yup, you are right, I've mixed the two conditions up. Split only
requires an extra block per level, plus a new root block. e.g. see
xfs_alloc_min_freelist()...

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com