]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_db: add rtrefcount reservations to the rgresv command
authorDarrick J. Wong <djwong@kernel.org>
Mon, 24 Feb 2025 18:22:04 +0000 (10:22 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 25 Feb 2025 17:16:02 +0000 (09:16 -0800)
Report rt refcount btree reservations in the rgresv subcommand output.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
db/info.c
libxfs/libxfs_api_defs.h

index ce6f358420a79d7c49dfd18b826608da854ee4f3..6ad3e23832faa36e834b8a95a779e220b58edb60 100644 (file)
--- a/db/info.c
+++ b/db/info.c
@@ -202,6 +202,19 @@ print_rgresv_info(
 
        ask += libxfs_rtrmapbt_calc_reserves(mp);
 
+       /* rtrefcount */
+       error = -libxfs_rtginode_load(rtg, XFS_RTGI_REFCOUNT, tp);
+       if (error) {
+               dbprintf(_("Cannot load rtgroup %u refcount inode, error %d\n"),
+                       rtg_rgno(rtg), error);
+               goto out_rele_dp;
+       }
+       if (rtg_refcount(rtg))
+               used += rtg_refcount(rtg)->i_nblocks;
+       libxfs_rtginode_irele(&rtg->rtg_inodes[XFS_RTGI_REFCOUNT]);
+
+       ask += libxfs_rtrefcountbt_calc_reserves(mp);
+
        printf(_("rtg %d: dblocks: %llu fdblocks: %llu reserved: %llu used: %llu"),
                        rtg_rgno(rtg),
                        (unsigned long long)mp->m_sb.sb_dblocks,
index 87a598f346f86a51ef3002e57ac8d9e4d3fe97d7..7ce10c408de1a05e1ffc6c7d2e90bbdc63ee594a 100644 (file)
 #define xfs_rtgroup_get                        libxfs_rtgroup_get
 #define xfs_rtgroup_put                        libxfs_rtgroup_put
 
+#define xfs_rtrefcountbt_calc_reserves libxfs_rtrefcountbt_calc_reserves
 #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