Just one more generic group helper to fold.
Signed-off-by: Christoph Hellwig <hch@lst.de>
return fsbno >> mp->m_groups[type].blklog;
}
+static inline xfs_agblock_t xfs_fsb_to_gbno(struct xfs_mount *mp,
+ xfs_fsblock_t fsbno, enum xfs_group_type type)
+{
+ return fsbno & mp->m_groups[type].blkmask;
+}
+
#endif /* __LIBXFS_GROUP_H */
ri->ri_bmap.br_startoff);
unwritten = ri->ri_bmap.br_state == XFS_EXT_UNWRITTEN;
- if (ri->ri_group->xg_type == XG_TYPE_RTG)
- bno = xfs_rtb_to_rgbno(mp, ri->ri_bmap.br_startblock);
- else
- bno = XFS_FSB_TO_AGBNO(mp, ri->ri_bmap.br_startblock);
-
+ bno = xfs_fsb_to_gbno(mp, ri->ri_bmap.br_startblock,
+ ri->ri_group->xg_type);
error = __xfs_rmap_finish_intent(*pcur, ri->ri_type, bno,
ri->ri_bmap.br_blockcount, &oinfo, unwritten);
if (error)
struct xfs_rtgroup *rtg,
xfs_rtxnum_t rtx)
{
+ xfs_rtblock_t start = xfs_group_start_fsb(&rtg->rtg_group);
struct xfs_mount *mp = rtg_mount(rtg);
- xfs_rtblock_t start = xfs_rgno_start_rtb(mp, rtg_rgno(rtg));
if (mp->m_rtxblklog >= 0)
return start + (rtx << mp->m_rtxblklog);
struct xfs_rtgroup *rtg,
xfs_rgblock_t rgbno)
{
- return __xfs_rgbno_to_rtb(rtg_mount(rtg), rtg_rgno(rtg), rgbno);
+ return xfs_gbno_to_fsb(&rtg->rtg_group, rgbno);
}
static inline xfs_rgnumber_t
struct xfs_mount *mp,
xfs_rtblock_t rtbno)
{
- if (!xfs_has_rtgroups(mp))
- return 0;
-
- return rtbno >> mp->m_sb.sb_rgblklog;
+ return xfs_fsb_to_gno(mp, rtbno, XG_TYPE_RTG);
}
static inline uint64_t
struct xfs_mount *mp,
xfs_rtblock_t rtbno)
{
- return __xfs_rtb_to_rgbno(mp, rtbno);
+ return xfs_fsb_to_gbno(mp, rtbno, XG_TYPE_RTG);
}
/*