On Thu, Jun 07, 2018 at 07:42:05AM -0400, Brian Foster wrote: > On Thu, Jun 07, 2018 at 03:27:50PM +1000, Dave Chinner wrote: > > From: Dave Chinner <dchinner@xxxxxxxxxx> > > > > do_mod() is a hold-over from when we have different sizes for file > > offsets and and other internal values for 40 bit XFS filesystems. > > Hence depending on build flags variables passed to do_mod() could > > change size. We no longer support those small format filesystems and > > hence everything is of fixed size theses days, even on 32 bit > > platforms. > > > > As such, we can convert all the do_mod() callers to platform > > optimised modulus operations as defined by linux/math64.h. > > Individual conversions depend on the types of variables being used. > > > > Signed-Off-By: Dave Chinner <dchinner@xxxxxxxxxx> .... > > diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c > > index 80bbfe604ce0..776502a5dcb7 100644 > > --- a/fs/xfs/xfs_rtalloc.c > > +++ b/fs/xfs/xfs_rtalloc.c > ... > > @@ -1262,8 +1266,11 @@ xfs_rtpick_extent( > > resid = seq - (1ULL << log2); > > b = (mp->m_sb.sb_rextents * ((resid << 1) + 1ULL)) >> > > (log2 + 1); > > - if (b >= mp->m_sb.sb_rextents) > > - b = do_mod(b, mp->m_sb.sb_rextents); > > + if (b >= mp->m_sb.sb_rextents) { > > + xfs_rtblock_t mod; > > + div64_u64_rem(b, mp->m_sb.sb_rextents, &mod); > > + b = mod; > > + } > > Shouldn't we be able to do 'div64_u64_rem(b, mp->m_sb.sb_rextents, &b)' > here? Otherwise looks fine: Yeah, I think we can. IIRC I was looking at various implementations and took the template from something like dm_sector_div64() because "obviously correct" :) Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html