On Tue, Aug 27, 2019 at 05:11:06PM +1000, Dave Chinner wrote: > On Tue, Aug 20, 2019 at 01:30:57PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > > > Create helper functions to perform unit conversions against a runtime > > filesystem, then remove the open-coded versions in scrub. > > .... and there they are... > > > +/* Convert fs block number into bytes */ > > +static inline uint64_t > > +xfrog_fsb_to_b( > > + const struct xfs_fd *xfd, > > + uint64_t fsb) > > +{ > > + return fsb << xfd->blocklog; > > +} > > FWIW, this is for converting linear offsets in fsb /units/, not the > sparse fsbno (= agno | agbno) to bytes. I've always found it a bit > nasty that this distinction is not clearly made in the core FSB > conversion macros. > > perhaps off_fsb_to_b? Ok to both. --D > > +/* Convert bytes into (rounded down) fs block number */ > > +static inline uint64_t > > +xfrog_b_to_fsbt( > > + const struct xfs_fd *xfd, > > + uint64_t bytes) > > +{ > > + return bytes >> xfd->blocklog; > > +} > > Ditto. > > Otherwise looks ok. > > Cheers, > > Dave. > -- > Dave Chinner > david@xxxxxxxxxxxxx