[PATCH 2/6] [XFS] Don't directly reference m_perag in allocation code

Dave Chinner david at fromorbit.com
Thu Dec 10 17:41:24 CST 2009


On Thu, Dec 10, 2009 at 06:18:56PM -0500, Christoph Hellwig wrote:
> On Wed, Dec 02, 2009 at 05:11:35PM +1100, Dave Chinner wrote:
> > +		pag = xfs_perag_get(mp, agno);
> > +		pag->pagf_freeblks += len;
> > +		xfs_perag_put(pag);
> > +
> >  		agf = XFS_BUF_TO_AGF(agbp);
> > -		pag = &mp->m_perag[agno];
> >  		be32_add_cpu(&agf->agf_freeblks, len);
> >  		xfs_trans_agblocks_delta(tp, len);
> > -		pag->pagf_freeblks += len;
> 
> Currently not too deep into this code, but did you make sure moving the
> in-core addition before the logging of the transaction doesn't matter/

xfs_trans_agblocks_delta() is debug-only accounting, so moving the
perag update does not change anything. It's still changed inside
the AGF buffer lock, so should be correct.

> 
> > +		args->pag = xfs_perag_get(mp, args->agno);
> >  		down_read(&mp->m_peraglock);
> > -		args->pag = &mp->m_perag[args->agno];
> 
> This adds another place where we could hit the growfs race until your
> later patches go in.

Ah, will fix up.

Cheers,

Dave.
-- 
Dave Chinner
david at fromorbit.com




More information about the xfs mailing list