]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: enable extent size hints for CoW operations
authorDarrick J. Wong <djwong@kernel.org>
Fri, 9 Aug 2024 13:17:06 +0000 (15:17 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 12 Aug 2024 11:53:09 +0000 (13:53 +0200)
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 62dca5e16d157d05663b16d406ca30376c699890..ab296b81c342accbdc263d92982cd84fc435baf3 100644 (file)
@@ -6574,7 +6574,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 da855a98634c9f78ce6221b3da1346617574493b..e2c793fb1974d0f100c093e66b7ba97254deb63a 100644 (file)
@@ -1837,7 +1837,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)