]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: remove xfs_daddr_to_rgno
authorChristoph Hellwig <hch@lst.de>
Thu, 10 Oct 2024 11:07:08 +0000 (13:07 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 10 Oct 2024 15:01:19 +0000 (17:01 +0200)
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 <hch@lst.de>
libxfs/xfs_rtgroup.h

index 8c146fcf8b11986adf0ab95a804696a2fae3bd5c..9e635b89a4abae87eeb1eeb214b48adf788139b2 100644 (file)
@@ -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;