On Mon, Jul 11, 2011 at 05:32:53PM -0500, Alex Elder wrote:
> > + continue;
> > +
> > + /*
> > + * Find the first stale entry at or after our index, if any.
> > + * Stop if the answer would be worse than lowstale.
> Stop if the result would require moving more
> entries than using lowstale.
> (I realize you didn't change this comment, you just moved
> it into this helper function.)
I'll change it.
> Actually it seems like this searching of the stale
> entries and moving things around among them could
> be broken into a few even finer-grained utility
> routines. It just seems like what this code is
> doing is simpler than what the code complexity
> suggests (though I haven't really looked at this
> stuff much before).
Some of this code could use some refactoring, but it's going to be
more complex than this patch. Additionally a lot of the logic is
duplicate in the block format code, but that format has the freespace
"header" at the end in struct xfs_dir2_block_tail, which for the fun
of it uses 32-bit count and stale fields instead of the 16-bit values
in struct xfs_dir2_leaf_hdr.