Re: [PATCH 05/10] xfs: move the zero records logic into xfs_bmap_broot_space_calc

Christoph Hellwig
2024-08-29T03:51:56Z

On Wed, Aug 28, 2024 at 06:15:55PM -0700, Darrick J. Wong wrote:
> save 72 bytes per inode when the btree is completely empty by returning
> 0 from xfs_{rtrmap,rtrefcount}_broot_space_calc? The answer to
> that was a bunch of null pointer dereferences because there's a fair
> amount of code in the rtrmap/rtrefcount/btree code that assumes that
> if_broot isn't null if you've created a btree cursor.
>
> OTOH if you're really going to have 130000 zns rtgroups then maybe we
> actually want this savings? That's 9MB of memory that we don't have to
> waste on an empty device -- for rtrmaps the savings are minimal because
> eventually you'll write *something*; for rtrefcounts, this might be
> meaningful because you format with reflink but don't necessarily use it
> right away.

Sounds kinda nice, but also painful. If the abstraction works out nice
enough it might be worth it.