]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: enable extent size hints for CoW operations
authorDarrick J. Wong <djwong@kernel.org>
Tue, 15 Oct 2024 19:40:30 +0000 (12:40 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 1 Nov 2024 20:47:11 +0000 (13:47 -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 400a357ee85e00fbac725b9547ef7ba2c53950d9..30a6138954bb7b2aaa503045612ee9bc1a2a3c21 100644 (file)
@@ -6528,7 +6528,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 b79202cffe4c0b03126b2febe8aaded4dc9bd5f5..ae142e73d678aac5371f8c1d05ae18c97301b5a8 100644 (file)
@@ -2017,7 +2017,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)