]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: remove xfs_rgbno_to_daddr xfs-rtg-cleanups
authorChristoph Hellwig <hch@lst.de>
Thu, 10 Oct 2024 10:09:55 +0000 (12:09 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 10 Oct 2024 14:57:48 +0000 (16:57 +0200)
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 <hch@lst.de>
fs/xfs/libxfs/xfs_rtgroup.h

index 9e635b89a4abae87eeb1eeb214b48adf788139b2..43a632e8c6b0e299edea3d94d2b8e2f802a9dde8 100644 (file)
@@ -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