From: Darrick J. Wong Date: Thu, 15 Aug 2024 18:58:29 +0000 (-0700) Subject: xfs_db: support the realtime refcountbt X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=54b8d41c9501519a24f59e12d3595215cee46faa;p=users%2Fhch%2Fxfsprogs.git xfs_db: support the realtime refcountbt Wire up various parts of xfs_db for realtime refcount support. Signed-off-by: Darrick J. Wong --- diff --git a/db/btblock.c b/db/btblock.c index 40913a094..e9e5d2f86 100644 --- a/db/btblock.c +++ b/db/btblock.c @@ -159,6 +159,9 @@ block_to_bt( case TYP_REFCBT: magic = crc ? XFS_REFC_CRC_MAGIC : 0; break; + case TYP_RTREFCBT: + magic = crc ? XFS_RTREFC_CRC_MAGIC : 0; + break; default: ASSERT(0); } diff --git a/db/btdump.c b/db/btdump.c index 9c528e5a1..31f32a8f7 100644 --- a/db/btdump.c +++ b/db/btdump.c @@ -447,7 +447,8 @@ is_btree_inode(void) struct xfs_dinode *dip; dip = iocur_top->data; - return dip->di_format == XFS_DINODE_FMT_RMAP; + return dip->di_format == XFS_DINODE_FMT_RMAP || + dip->di_format == XFS_DINODE_FMT_REFCOUNT; } static int @@ -457,6 +458,7 @@ dump_btree_inode( char *prefix; struct xfs_dinode *dip; struct xfs_rtrmap_root *rtrmap; + struct xfs_rtrefcount_root *rtrefc; int level; int numrecs; int ret; @@ -469,6 +471,12 @@ dump_btree_inode( level = be16_to_cpu(rtrmap->bb_level); numrecs = be16_to_cpu(rtrmap->bb_numrecs); break; + case XFS_DINODE_FMT_REFCOUNT: + prefix = "u3.rtrefcbt"; + rtrefc = (struct xfs_rtrefcount_root *)XFS_DFORK_DPTR(dip); + level = be16_to_cpu(rtrefc->bb_level); + numrecs = be16_to_cpu(rtrefc->bb_numrecs); + break; default: dbprintf("Unknown metadata inode type %u\n", dip->di_format); return 0; @@ -550,6 +558,7 @@ btdump_f( case TYP_BMAPBTA: case TYP_BMAPBTD: case TYP_RTRMAPBT: + case TYP_RTREFCBT: return dump_btree_long(iflag); case TYP_INODE: if (is_btree_inode()) diff --git a/db/btheight.c b/db/btheight.c index 25ce34003..9dd21ddae 100644 --- a/db/btheight.c +++ b/db/btheight.c @@ -58,6 +58,11 @@ struct btmap { .maxlevels = libxfs_rtrmapbt_maxlevels_ondisk, .maxrecs = libxfs_rtrmapbt_maxrecs, }, + { + .tag = "rtrefcountbt", + .maxlevels = libxfs_rtrefcountbt_maxlevels_ondisk, + .maxrecs = libxfs_rtrefcountbt_maxrecs, + }, }; static void diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 0bb39e278..8b9d7954e 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -313,6 +313,7 @@ #define xfs_rtgroup_put libxfs_rtgroup_put #define xfs_rtrefcountbt_droot_maxrecs libxfs_rtrefcountbt_droot_maxrecs +#define xfs_rtrefcountbt_maxlevels_ondisk libxfs_rtrefcountbt_maxlevels_ondisk #define xfs_rtrefcountbt_maxrecs libxfs_rtrefcountbt_maxrecs #define xfs_rtrmapbt_calc_reserves libxfs_rtrmapbt_calc_reserves diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8 index d9204f208..5a27033a5 100644 --- a/man/man8/xfs_db.8 +++ b/man/man8/xfs_db.8 @@ -536,6 +536,7 @@ The supported btree types are: .IR bmapbt , .IR refcountbt , .IR rmapbt , +.IR rtrefcountbt , and .IR rtrmapbt . The magic value