Skip to content

Commit fc633b5

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent 4126326 commit fc633b5

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

fs/xfs/libxfs/xfs_rtgroup.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,4 +371,19 @@ xfs_rtgs_to_rfsbs(
371371
return xfs_groups_to_rfsbs(mp, nr_groups, XG_TYPE_RTG);
372372
}
373373

374+
/*
375+
* Return the "raw" size of a group on the hardware device. This includes the
376+
* daddr gaps present for XFS_SB_FEAT_INCOMPAT_ZONE_GAPS file systems.
377+
*/
378+
static inline xfs_rgblock_t
379+
xfs_rtgroup_raw_size(
380+
struct xfs_mount *mp)
381+
{
382+
struct xfs_groups *g = &mp->m_groups[XG_TYPE_RTG];
383+
384+
if (g->has_daddr_gaps)
385+
return 1U << g->blklog;
386+
return g->blocks;
387+
}
388+
374389
#endif /* __LIBXFS_RTGROUP_H */

0 commit comments

Comments
 (0)