Re: [PATCH 07/18] xfs: stop using q_core limits in the quota code

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

 



On Wed, Jul 01, 2020 at 04:13:43PM -0700, Darrick J. Wong wrote:
> On Thu, Jul 02, 2020 at 09:01:36AM +1000, Dave Chinner wrote:
> > On Tue, Jun 30, 2020 at 08:42:36AM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > > 
> > > Add limits fields in the incore dquot, and use that instead of the ones
> > > in qcore.  This eliminates a bunch of endian conversions and will
> > > eventually allow us to remove qcore entirely.
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > ....
> > > @@ -124,82 +123,67 @@ xfs_qm_adjust_dqtimers(
> > >  	defq = xfs_get_defquota(qi, xfs_dquot_type(dq));
> > >  
> > >  #ifdef DEBUG
> > > -	if (d->d_blk_hardlimit)
> > > -		ASSERT(be64_to_cpu(d->d_blk_softlimit) <=
> > > -		       be64_to_cpu(d->d_blk_hardlimit));
> > > -	if (d->d_ino_hardlimit)
> > > -		ASSERT(be64_to_cpu(d->d_ino_softlimit) <=
> > > -		       be64_to_cpu(d->d_ino_hardlimit));
> > > -	if (d->d_rtb_hardlimit)
> > > -		ASSERT(be64_to_cpu(d->d_rtb_softlimit) <=
> > > -		       be64_to_cpu(d->d_rtb_hardlimit));
> > > +	if (dq->q_blk.hardlimit)
> > > +		ASSERT(dq->q_blk.softlimit <= dq->q_blk.hardlimit);
> > > +	if (dq->q_ino.hardlimit)
> > > +		ASSERT(dq->q_ino.softlimit <= dq->q_ino.hardlimit);
> > > +	if (dq->q_rtb.hardlimit)
> > > +		ASSERT(dq->q_rtb.softlimit <= dq->q_rtb.hardlimit);
> > >  #endif
> > 
> > You can get rid of the ifdef DEBUG here - if ASSERT is not defined
> > then the compiler will elide all this code anyway.
> 
> OK.

Actually, not ok.  A later patch in this series will refactor this whole
ugly function (and in the next round the #ifdefs) out of existence, so
I'll leave this part of the patch the way it is.

--D

> > >  /* Allocate and initialize the dquot buffer for this in-core dquot. */
> > > @@ -1123,9 +1119,29 @@ static xfs_failaddr_t
> > >  xfs_qm_dqflush_check(
> > >  	struct xfs_dquot	*dqp)
> > >  {
> > > +	struct xfs_disk_dquot	*ddq = &dqp->q_core;
> > > +
> > >  	if (hweight8(dqp->dq_flags & XFS_DQ_ALLTYPES) != 1)
> > >  		return __this_address;
> > >  
> > > +	if (dqp->q_id == 0)
> > > +		return NULL;
> > > +
> > > +	if (dqp->q_blk.softlimit &&
> > > +	    be64_to_cpu(ddq->d_bcount) > dqp->q_blk.softlimit &&
> > > +	    !ddq->d_btimer)
> > > +		return __this_address;
> > > +
> > > +	if (dqp->q_ino.softlimit &&
> > > +	    be64_to_cpu(ddq->d_icount) > dqp->q_ino.softlimit &&
> > > +	    !ddq->d_itimer)
> > > +		return __this_address;
> > > +
> > > +	if (dqp->q_rtb.softlimit &&
> > > +	    be64_to_cpu(ddq->d_rtbcount) > dqp->q_rtb.softlimit &&
> > > +	    !ddq->d_rtbtimer)
> > > +		return __this_address;
> > 
> > These are new in this patch. These are checked by
> > xfs_dquot_verify(), so what's the reason for duplicating the checks
> > here?
> 
> The new functions perform spot-checks of the incore dquot before we start
> flushing them out to disk, because the goal of this patch is to further
> decouple the incore and ondisk dquots ahead of the y2038 support series.
> 
> --D
> 
> > 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