]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xfs: enable extent size hints for CoW operations
authorDarrick J. Wong <djwong@kernel.org>
Thu, 21 Nov 2024 00:21:03 +0000 (16:21 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 23 Dec 2024 21:06:14 +0000 (13:06 -0800)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/xfs_rtalloc.c

index ae3d33d60761022b7bfd20d6ca3dc1845e6cf276..40ad22fb808b95025cbc1b7ebd80ba66b0469816 100644 (file)
@@ -6524,7 +6524,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 294aa0739be311ee0606f22f9c81e655af823930..f5a3d5f8c948d8d376564a5dbd96083b3866b4bd 100644 (file)
@@ -2021,7 +2021,10 @@ xfs_rtallocate_align(
        if (*noalign) {
                align = mp->m_sb.sb_rextsize;
        } else {
-               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;
                if (align == mp->m_sb.sb_rextsize)