On Thu, Oct 24, 2019 at 10:15:27PM -0700, Darrick J. Wong wrote: > +struct xfs_iread_state { > + struct xfs_iext_cursor icur; > + struct xfs_ifork *ifp; Given that the btree cursor contains the whichfork information there is not real need to also pass a ifork pointer. > + xfs_extnum_t loaded; > + xfs_extnum_t nextents; That can just use XFS_IFORK_NEXTENTS() directly in the callback. > + int state; Same here. The xfs_bmap_fork_to_state is cheap enough to just do it inside the callback function. > + block = xfs_btree_get_block(cur, level, &bp); This is opencoded in almost all xfs_btree_visit_blocks callbacks. Any chance we could simply pass the buffer to the callback? > +/* Only visit record blocks. */ > +#define XFS_BTREE_VISIT_RECORDS_ONLY (0x1) I find these only flags a little weird. I'd rather have two flags, one to to visit interior nodes, and one to visit leaf nodes, which makes the interface very much self-describing.