]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: enable extent size hints for CoW operations
authorDarrick J. Wong <djwong@kernel.org>
Wed, 29 May 2024 04:13:19 +0000 (21:13 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 24 Jul 2024 05:33:55 +0000 (22:33 -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>
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/xfs_rtalloc.c

index 4479ee9e7470bd130baea59e8309424dadf41638..a546ac646aec5fba1c0173460a24553cfa3ea0c8 100644 (file)
@@ -6537,7 +6537,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)
index 1a181a8f5bfa57307d1ef01a7b48aa1042d8c409..3ea9540e097d2672e1baebd888c1bb26a25df257 100644 (file)
@@ -1844,7 +1844,10 @@ xfs_bmap_rtalloc(
        };
        int                     error;
 
-       align = xfs_get_extsz_hint(ap->ip);
+       if (ap->flags & XFS_BMAPI_COWFORK)
+               align = xfs_get_cowextsz_hint(ap->ip);
+       else
+               align = xfs_get_extsz_hint(ap->ip);
        if (!align)
                align = 1;
 retry: