From: Christoph Hellwig Date: Thu, 10 Oct 2024 10:09:55 +0000 (+0200) Subject: xfs: remove xfs_rgbno_to_daddr X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fxfs-rtg-cleanups;p=users%2Fhch%2Fxfs.git xfs: remove xfs_rgbno_to_daddr xfs_rgbno_to_daddr is only used by xfs_rtb_to_daddr for RT group file systems. Open code it there so that we don't have to explain the 64-bit rgbno magic. Note that in userspace it is used by libxfs, but the code can be easily rewritten without it. Signed-off-by: Christoph Hellwig --- diff --git a/fs/xfs/libxfs/xfs_rtgroup.h b/fs/xfs/libxfs/xfs_rtgroup.h index 9e635b89a4ab..43a632e8c6b0 100644 --- a/fs/xfs/libxfs/xfs_rtgroup.h +++ b/fs/xfs/libxfs/xfs_rtgroup.h @@ -191,29 +191,16 @@ xfs_rtx_to_rgbno( return rtx * mp->m_sb.sb_rextsize; } -/* - * Note: takes a uint64_t for bno because the rgbno component can overflow - * xfs_rgblock_t on non-rtgroups file systems. - */ -static inline xfs_daddr_t -xfs_rgbno_to_daddr( - struct xfs_mount *mp, - xfs_rgnumber_t rgno, - uint64_t rgbno) -{ - uint64_t r = (xfs_rtblock_t)rgno * - mp->m_groups[XG_TYPE_RTG].blocks; - - return XFS_FSB_TO_BB(mp, r + rgbno); -} - static inline xfs_daddr_t xfs_rtb_to_daddr( struct xfs_mount *mp, xfs_rtblock_t rtbno) { - return xfs_rgbno_to_daddr(mp, xfs_rtb_to_rgno(mp, rtbno), - rtbno & mp->m_groups[XG_TYPE_RTG].blkmask); + struct xfs_groups *g = &mp->m_groups[XG_TYPE_RTG]; + xfs_rgnumber_t rgno = xfs_rtb_to_rgno(mp, rtbno); + uint64_t start_bno = (xfs_rtblock_t)rgno * g->blocks; + + return XFS_FSB_TO_BB(mp, start_bno + (rtbno & g->blkmask)); } static inline xfs_rtblock_t