From febd3ec6dcc485e0086767068a2a371b6fe7fb89 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 2 Oct 2024 09:21:41 +0200 Subject: [PATCH] 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 --- fs/xfs/libxfs/xfs_rtgroup.h | 9 +++++++++ fs/xfs/xfs_iomap.c | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) 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); -- 2.50.1