xfs: enable extent size hints for CoW operations
authorDarrick J. Wong <djwong@kernel.org>
Tue, 15 Oct 2024 19:44:45 +0000 (12:44 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 1 Nov 2024 20:45:00 +0000 (13:45 -0700)
Wire up the copy-on-write extent size hint for realtime files, and
connect it to the rt allocator so that we avoid fragmentation on rt
filesystems.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/xfs_bmap.c

index 1438755aad103db2502808281da3b7a57772953e..03b9d223bd088c0f0f65c5585b45035c2b3e6c50 100644 (file)
@@ -6522,7 +6522,13 @@ xfs_get_cowextsz_hint(
        a = 0;
        if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
                a = ip->i_cowextsize;
-       b = xfs_get_extsz_hint(ip);
+       if (XFS_IS_REALTIME_INODE(ip)) {
+               b = 0;
+               if (ip->i_diflags & XFS_DIFLAG_EXTSIZE)
+                       b = ip->i_extsize;
+       } else {
+               b = xfs_get_extsz_hint(ip);
+       }
 
        a = max(a, b);
        if (a == 0)