]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: add a xfs_rtbno_is_group_start helper xfs-group-geometry
authorChristoph Hellwig <hch@lst.de>
Wed, 2 Oct 2024 07:21:41 +0000 (09:21 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 2 Oct 2024 07:25:25 +0000 (09:25 +0200)
Make the boundary condition flag more clear and implement it by
a single masking operation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_rtgroup.h
fs/xfs/xfs_iomap.c

index 246228ecd359efb56d6d09a60cd8e96cc99a3126..d3d471c985e8983134c0287745204c2f50f32058 100644 (file)
@@ -196,6 +196,15 @@ xfs_rtb_to_rgbno(
        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.
index 8d60ca29db58c5f61ea8867a5491a781b6f5765f..b74e16e44fd0d332fdffa0f5b580d578650afd46 100644 (file)
@@ -133,8 +133,7 @@ xfs_bmbt_to_iomap(
                 * 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);