On 2/12/20 7:41 PM, Darrick J. Wong wrote: > On Wed, Feb 12, 2020 at 05:51:18PM -0600, Eric Sandeen wrote: >> On 12/31/19 7:11 PM, Darrick J. Wong wrote: >>> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> >>> >>> Refactor the open-coded test for whether or not we're over quota. >> >> Ooh, nice. This was horrible. ... >>> +} >>> + >>> /* >>> * Check the limits and timers of a dquot and start or reset timers >>> * if necessary. >>> @@ -117,6 +128,8 @@ xfs_qm_adjust_dqtimers( >>> struct xfs_mount *mp, >>> struct xfs_disk_dquot *d) >>> { >>> + bool over; >>> + >>> ASSERT(d->d_id); >>> >>> #ifdef DEBUG >>> @@ -131,71 +144,47 @@ xfs_qm_adjust_dqtimers( >>> be64_to_cpu(d->d_rtb_hardlimit)); >>> #endif >>> >>> + over = xfs_quota_exceeded(&d->d_bcount, &d->d_blk_softlimit, >>> + &d->d_blk_hardlimit); >>> if (!d->d_btimer) { >>> - if ((d->d_blk_softlimit && (be64_to_cpu(d->d_bcount) > be64_to_cpu(d->d_blk_softlimit))) || >>> - (d->d_blk_hardlimit && (be64_to_cpu(d->d_bcount) > be64_to_cpu(d->d_blk_hardlimit)))) { >>> + if (over) { >> >> I wonder why we check the hard limit. Isn't exceeding the soft limit >> enough to start the timer? Unrelated to the refactoring tho. > > Suppose there's only a hard limit set? then you get EDQUOT straightaway and timers don't matter? I guess if you set a soft limit after you go over a hard-limit-only and ... meh, ain't broke don't fix? -Eric