On Thu, Mar 05, 2020 at 12:20:54PM +1100, Dave Chinner wrote: > On Tue, Mar 03, 2020 at 07:28:28PM -0800, Darrick J. Wong wrote: > > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > > > Create an in-core fake root for AG-rooted btree types so that callers > > can generate a whole new btree using the upcoming btree bulk load > > function without making the new tree accessible from the rest of the > > filesystem. It is up to the individual btree type to provide a function > > to create a staged cursor (presumably with the appropriate callouts to > > update the fakeroot) and then commit the staged root back into the > > filesystem. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > ..... > > @@ -188,6 +188,16 @@ union xfs_btree_cur_private { > > } abt; > > }; > > > > +/* Private information for a AG-rooted btree. */ > > +struct xfs_btree_priv_ag { /* needed for BNO, CNT, INO */ > > + union { > > + struct xfs_buf *agbp; /* agf/agi buffer pointer */ > > + struct xbtree_afakeroot *afake; /* fake ag header root */ > > + }; > > + xfs_agnumber_t agno; /* ag number */ > > + union xfs_btree_cur_private priv; > > +}; > > + > > /* > > * Btree cursor structure. > > * This collects all information needed by the btree code in one place. > > @@ -209,11 +219,7 @@ typedef struct xfs_btree_cur > > xfs_btnum_t bc_btnum; /* identifies which btree type */ > > int bc_statoff; /* offset of btre stats array */ > > union { > > - struct { /* needed for BNO, CNT, INO */ > > - struct xfs_buf *agbp; /* agf/agi buffer pointer */ > > - xfs_agnumber_t agno; /* ag number */ > > - union xfs_btree_cur_private priv; > > - } a; > > + struct xfs_btree_priv_ag a; > > struct { /* needed for BMAP */ > > struct xfs_inode *ip; /* pointer to our inode */ > > int allocated; /* count of alloced */ > > I don't really like the mess this is turning into. I'll write a > quick cleanup patch set for this union to make it much neater and > the code much less verbose before we make the code even more > unreadable. :/ Ok, thank you! --D > Cheers, > > Dave. > -- > Dave Chinner > david@xxxxxxxxxxxxx