]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: make the RT allocator rtgroup aware
authorChristoph Hellwig <hch@lst.de>
Mon, 25 Nov 2024 21:14:24 +0000 (13:14 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 24 Dec 2024 02:01:30 +0000 (18:01 -0800)
Source kernel commit: d162491c5459f4dd72e65b72a2c864591668ec07

Make the allocator rtgroup aware by either picking a specific group if
there is a hint, or loop over all groups otherwise.  A simple rotor is
provided to pick the placement for initial allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_bmap.c
libxfs/xfs_rtbitmap.c

index bdede0e683ae912ebace5026c0d4d25667f1ac2b..60310d3c1074c8d7d975bef57e9684d1dd48ff88 100644 (file)
@@ -3145,8 +3145,17 @@ xfs_bmap_adjacent_valid(
        struct xfs_mount        *mp = ap->ip->i_mount;
 
        if (XFS_IS_REALTIME_INODE(ap->ip) &&
-           (ap->datatype & XFS_ALLOC_USERDATA))
-               return x < mp->m_sb.sb_rblocks;
+           (ap->datatype & XFS_ALLOC_USERDATA)) {
+               if (x >= mp->m_sb.sb_rblocks)
+                       return false;
+               if (!xfs_has_rtgroups(mp))
+                       return true;
+
+               return xfs_rtb_to_rgno(mp, x) == xfs_rtb_to_rgno(mp, y) &&
+                       xfs_rtb_to_rgno(mp, x) < mp->m_sb.sb_rgcount &&
+                       xfs_rtb_to_rtx(mp, x) < mp->m_sb.sb_rgextents;
+
+       }
 
        return XFS_FSB_TO_AGNO(mp, x) == XFS_FSB_TO_AGNO(mp, y) &&
                XFS_FSB_TO_AGNO(mp, x) < mp->m_sb.sb_agcount &&
index b6874885107f09fbac61dff3fb6915ace36b163f..44c801f31d5dc3d8d1560835ff18f230b6370073 100644 (file)
@@ -1080,11 +1080,13 @@ xfs_rtfree_extent(
         * Mark more blocks free in the superblock.
         */
        xfs_trans_mod_sb(tp, XFS_TRANS_SB_FREXTENTS, (long)len);
+
        /*
         * If we've now freed all the blocks, reset the file sequence
-        * number to 0.
+        * number to 0 for pre-RTG file systems.
         */
-       if (tp->t_frextents_delta + mp->m_sb.sb_frextents ==
+       if (!xfs_has_rtgroups(mp) &&
+           tp->t_frextents_delta + mp->m_sb.sb_frextents ==
            mp->m_sb.sb_rextents) {
                if (!(rbmip->i_diflags & XFS_DIFLAG_NEWRTBM))
                        rbmip->i_diflags |= XFS_DIFLAG_NEWRTBM;