Re: [PATCH 17/27] xfs: kill struct xfs_dir2_block

Christoph Hellwig
2011-07-06T08:37:16Z

On Wed, Jul 06, 2011 at 12:31:57PM +1000, Dave Chinner wrote:
> > btp = xfs_dir2_block_tail_p(mp, hdr);
> > - ptr = (char *)block->u;
> > + ptr = (char *)(hdr + 1);
> > endptr = (char *)xfs_dir2_block_leaf_p(btp);
>
> That is slightly less obvious what it is doing. It's jumping over
> the entire header, but could easily be confused with jumping one
> byte in.
>
> Perhaps adding a wrapper e.g. xfs_dir2_block_data_p(hdr) to match
> the xfs_dir2_block_tail_p() and xfs_dir2_block_leaf_p() wrappers,
> and converting all the other cases to use this as well?

I had that in the initial version, but given that we usually use
the result as char, and not one of the two types of the union just
made the code very messy.

I can try it again, maybe as a add-on patch at the end so that we can
decide if it actually improves anything.