Re: [PATCH 4/5] xfs: speed up directory bestfree block scanning

Dave Chinner
2019-08-29T08:55:22Z

On Thu, Aug 29, 2019 at 01:47:09AM -0700, Christoph Hellwig wrote:
> On Thu, Aug 29, 2019 at 06:45:30PM +1000, Dave Chinner wrote:
> > >
> > > The label rename while more descriptive also seems entirely unrelated.
> >
> > That was one of your previous suggestions :)
> >
> > I'll push it back up one patch into the cleanup patch and leave this
> > as an optimisation only patch.
>
> Oh well. Just keep it then :)

It was introduced in the previous patch, anyway :P

> > > > + /* Scan the free entry array for a large enough free space. */
> > > > + do {
> > > > + if (be16_to_cpu(bests[findex]) != NULLDATAOFF &&
> > > > + be16_to_cpu(bests[findex]) >= length) {
> > > > + dbno = freehdr.firstdb + findex;
> > > > + goto found_block;
> > > > }
> > > > + } while (++findex < freehdr.nvalid);
> > >
> > > Nit: wou;dn't this be better written as a for loop also taking the
> > > initialization of findex into the loop?
> >
> > Agreed - the next patch does that with the reversal of the search
> > order. The end result is what you're asking for, so I'll leave this
> > alone for now....
>
> If you touch this patch anyway please just switch to the for loop
> here, that keeps the churn down in the next one.

OK.

--
Dave Chinner
david@fromorbit.com