Make the boundary condition flag more clear and implement it by
a single masking operation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
return xfs_fsb_to_gbno(mp, rtbno, XG_TYPE_RTG);
}
+/* Is rtbno the start of a RT group? */
+static inline bool
+xfs_rtbno_is_group_start(
+ struct xfs_mount *mp,
+ xfs_rtblock_t rtbno)
+{
+ return (rtbno & mp->m_groups[XG_TYPE_RTG].blkmask) == 0;
+}
+
/*
* Note: takes a uint64_t for bno because the rgbno component can be
* > sizeof(xfs_rgblock_t) for legacy file systems.
* single RTG.
*/
if (XFS_IS_REALTIME_INODE(ip) && xfs_has_rtgroups(mp) &&
- xfs_rtb_to_rtx(mp, imap->br_startblock) == 0 &&
- xfs_rtb_to_rtxoff(mp, imap->br_startblock) == 0)
+ xfs_rtbno_is_group_start(mp, imap->br_startblock))
iomap->flags |= IOMAP_F_BOUNDARY;
}
iomap->offset = XFS_FSB_TO_B(mp, imap->br_startoff);