xfs: introduce fake roots for ag-rooted btrees

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@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
Darrick J. Wong
2020-03-11 10:40:26 -07:00
parent 608eb3cee7
commit e06536a692
7 changed files with 249 additions and 1 deletions

View File

@@ -3605,6 +3605,34 @@ TRACE_EVENT(xfs_check_new_dalign,
__entry->calc_rootino)
)
TRACE_EVENT(xfs_btree_commit_afakeroot,
TP_PROTO(struct xfs_btree_cur *cur),
TP_ARGS(cur),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(xfs_btnum_t, btnum)
__field(xfs_agnumber_t, agno)
__field(xfs_agblock_t, agbno)
__field(unsigned int, levels)
__field(unsigned int, blocks)
),
TP_fast_assign(
__entry->dev = cur->bc_mp->m_super->s_dev;
__entry->btnum = cur->bc_btnum;
__entry->agno = cur->bc_ag.agno;
__entry->agbno = cur->bc_ag.afake->af_root;
__entry->levels = cur->bc_ag.afake->af_levels;
__entry->blocks = cur->bc_ag.afake->af_blocks;
),
TP_printk("dev %d:%d btree %s ag %u levels %u blocks %u root %u",
MAJOR(__entry->dev), MINOR(__entry->dev),
__print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
__entry->agno,
__entry->levels,
__entry->blocks,
__entry->agbno)
)
#endif /* _TRACE_XFS_H */
#undef TRACE_INCLUDE_PATH