Commit fc633b5c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Carlos Maiolino
Browse files

xfs: add a xfs_rtgroup_raw_size helper



Add a helper to figure the on-disk size of a group, accounting for the
XFS_SB_FEAT_INCOMPAT_ZONE_GAPS feature if needed.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarCarlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
parent 41263267
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -371,4 +371,19 @@ xfs_rtgs_to_rfsbs(
	return xfs_groups_to_rfsbs(mp, nr_groups, XG_TYPE_RTG);
}

/*
 * Return the "raw" size of a group on the hardware device.  This includes the
 * daddr gaps present for XFS_SB_FEAT_INCOMPAT_ZONE_GAPS file systems.
 */
static inline xfs_rgblock_t
xfs_rtgroup_raw_size(
	struct xfs_mount	*mp)
{
	struct xfs_groups	*g = &mp->m_groups[XG_TYPE_RTG];

	if (g->has_daddr_gaps)
		return 1U << g->blklog;
	return g->blocks;
}

#endif /* __LIBXFS_RTGROUP_H */