From: Christoph Hellwig Date: Wed, 2 Oct 2024 07:21:41 +0000 (+0200) Subject: xfs: add a xfs_rtbno_is_group_start helper X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fxfs-group-geometry;p=users%2Fhch%2Fxfs.git xfs: add a xfs_rtbno_is_group_start helper Make the boundary condition flag more clear and implement it by a single masking operation. Signed-off-by: Christoph Hellwig --- diff --git a/fs/xfs/libxfs/xfs_rtgroup.h b/fs/xfs/libxfs/xfs_rtgroup.h index 246228ecd359..d3d471c985e8 100644 --- a/fs/xfs/libxfs/xfs_rtgroup.h +++ b/fs/xfs/libxfs/xfs_rtgroup.h @@ -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. diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 8d60ca29db58..b74e16e44fd0 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -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);