Re: [PATCH 10/15] xfs: compute actual maximum btree height for critical reservation calculation

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

 



On Wed, Oct 13, 2021 at 10:07:47AM -0700, Darrick J. Wong wrote:
> On Wed, Oct 13, 2021 at 04:49:39PM +1100, Dave Chinner wrote:
> > On Tue, Oct 12, 2021 at 04:33:28PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@xxxxxxxxxx>
> > > 
> > > Compute the actual maximum btree height when deciding if per-AG block
> > > reservation is critically low.  This only affects the sanity check
> > > condition, since we /generally/ will trigger on the 10% threshold.
> > > This is a long-winded way of saying that we're removing one more
> > > usage of XFS_BTREE_MAXLEVELS.
> > 
> > And replacing it with a branchy dynamic calculation that has a
> > static, unchanging result. :(
> > 
> > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
> > > ---
> > >  fs/xfs/libxfs/xfs_ag_resv.c |   18 +++++++++++++++++-
> > >  1 file changed, 17 insertions(+), 1 deletion(-)
> > > 
> > > 
> > > diff --git a/fs/xfs/libxfs/xfs_ag_resv.c b/fs/xfs/libxfs/xfs_ag_resv.c
> > > index 2aa2b3484c28..d34d4614f175 100644
> > > --- a/fs/xfs/libxfs/xfs_ag_resv.c
> > > +++ b/fs/xfs/libxfs/xfs_ag_resv.c
> > > @@ -60,6 +60,20 @@
> > >   * to use the reservation system should update ask/used in xfs_ag_resv_init.
> > >   */
> > >  
> > > +/* Compute maximum possible height for per-AG btree types for this fs. */
> > > +static unsigned int
> > > +xfs_ag_btree_maxlevels(
> > > +	struct xfs_mount	*mp)
> > > +{
> > > +	unsigned int		ret = mp->m_ag_maxlevels;
> > > +
> > > +	ret = max(ret, mp->m_bm_maxlevels[XFS_DATA_FORK]);
> > > +	ret = max(ret, mp->m_bm_maxlevels[XFS_ATTR_FORK]);
> > > +	ret = max(ret, M_IGEO(mp)->inobt_maxlevels);
> > > +	ret = max(ret, mp->m_rmap_maxlevels);
> > > +	return max(ret, mp->m_refc_maxlevels);
> > > +}
> > 
> > Hmmmm. perhaps mp->m_ag_maxlevels should be renamed to
> > mp->m_agbno_maxlevels and we pre-calculate mp->m_ag_maxlevels from
> 
> I prefer m_alloc_maxlevels for the first one, since "agbno" means "AG
> block number" in my head.
> 
> As for the second, how about "m_agbtree_maxlevels" since we already use
> 'agbtree' to refer to per-AG btrees elsewhere?

Much better than my suggestions :)

Cheers,

Dave.

-- 
Dave Chinner
david@xxxxxxxxxxxxx



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux