Re: [PATCH v2] quota: widen timestamps for the fs_disk_quota structure

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

 



On Sat, Sep 05, 2020 at 11:02:31PM +0100, Matthew Wilcox wrote:
> On Sat, Sep 05, 2020 at 09:47:03AM -0700, Darrick J. Wong wrote:
> > +static inline void copy_to_xfs_dqblk_ts(const struct fs_disk_quota *d,
> > +		__s32 *timer_lo, __s8 *timer_hi, s64 timer)
> > +{
> > +	*timer_lo = timer;
> > +	if (d->d_fieldmask & FS_DQ_BIGTIME)
> > +		*timer_hi = timer >> 32;
> > +	else
> > +		*timer_hi = 0;
> > +}
> 
> Is that actually the right thing to do?  If FS_DQ_BIGTIME is not set,
> I would expect us to avoid writing to timer_hi at all.  Alternatively, if
> we do want to write to timer_hi, why not write to it unconditionally?

If the flag isn't set, then the space used by timer_hi is a zero-filled
padding field.  Therefore, I made this function zero timer_hi if the
bigtime flag isn't set.  It's redundant with the memset five lines up
from the call site, but I don't like leaving logic bombs in case this
function ever gets exported elsewhere.

--D



[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