From e5b2a78d91041b8a64ff1aaff25c89e430c5df84 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 10 Oct 2024 11:55:41 +0200 Subject: [PATCH] xfs: remove xfs_daddr_to_rgno xfs_daddr_to_rgno is only used by xfs_daddr_to_rtb, which can already grab the group number from the div_u64_rem. Note that in userspace db also uses it, but I'd rather open code it there. Signed-off-by: Christoph Hellwig --- fs/xfs/libxfs/xfs_rtgroup.h | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/fs/xfs/libxfs/xfs_rtgroup.h b/fs/xfs/libxfs/xfs_rtgroup.h index 8c146fcf8b11..9e635b89a4ab 100644 --- a/fs/xfs/libxfs/xfs_rtgroup.h +++ b/fs/xfs/libxfs/xfs_rtgroup.h @@ -216,31 +216,20 @@ xfs_rtb_to_daddr( rtbno & mp->m_groups[XG_TYPE_RTG].blkmask); } -static inline xfs_rgnumber_t -xfs_daddr_to_rgno( - struct xfs_mount *mp, - xfs_daddr_t daddr) -{ - if (!xfs_has_rtgroups(mp)) - return 0; - - return div_u64(XFS_BB_TO_FSBT(mp, daddr), - mp->m_groups[XG_TYPE_RTG].blocks); -} - static inline xfs_rtblock_t xfs_daddr_to_rtb( struct xfs_mount *mp, xfs_daddr_t daddr) { + struct xfs_groups *g = &mp->m_groups[XG_TYPE_RTG]; xfs_rfsblock_t bno = XFS_BB_TO_FSBT(mp, daddr); if (xfs_has_rtgroups(mp)) { - xfs_rgnumber_t rgno = xfs_daddr_to_rgno(mp, daddr); - uint32_t rem; + xfs_rgnumber_t rgno; + uint32_t rgbno; - div_u64_rem(bno, mp->m_groups[XG_TYPE_RTG].blocks, &rem); - return ((xfs_rtblock_t)rgno << mp->m_sb.sb_rgblklog) + rem; + rgno = div_u64_rem(bno, g->blocks, &rgbno); + return ((xfs_rtblock_t)rgno << g->blklog) + rgbno; } return bno; -- 2.50.1