diff mbox series

[09/22] xfs_db: add rtrefcount reservations to the rgresv command

Message ID 173888089070.2741962.16480973892880802520.stgit@frogsfrogsfrogs (mailing list archive)
State Not Applicable, archived
Headers show
Series [01/22] libxfs: compute the rt refcount btree maxlevels during initialization | expand

Commit Message

Darrick J. Wong Feb. 6, 2025, 10:59 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Report rt refcount btree reservations in the rgresv subcommand output.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 db/info.c                |   13 +++++++++++++
 libxfs/libxfs_api_defs.h |    1 +
 2 files changed, 14 insertions(+)

Comments

Christoph Hellwig Feb. 13, 2025, 4:23 a.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/db/info.c b/db/info.c
index ce6f358420a79d..6ad3e23832faa3 100644
--- 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,
diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h
index 87a598f346f86a..7ce10c408de1a0 100644
--- a/libxfs/libxfs_api_defs.h
+++ b/libxfs/libxfs_api_defs.h
@@ -320,6 +320,7 @@ 
 #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