From: Christoph Hellwig Date: Thu, 10 Oct 2024 11:07:08 +0000 (+0200) Subject: xfs: remove xfs_daddr_to_rgno X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=38a782bb1b51eea4e6bb69dc04a934c70356d788;p=users%2Fhch%2Fxfsprogs.git xfs: remove xfs_daddr_to_rgno Source kernel commit: 7fd8369dd2ea40cb70392d83bed7bf166e302a86 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 --- diff --git a/libxfs/xfs_rtgroup.h b/libxfs/xfs_rtgroup.h index 8c146fcf8..9e635b89a 100644 --- a/libxfs/xfs_rtgroup.h +++ b/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;