]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: enable extent size hints for CoW operations
authorDarrick J. Wong <djwong@kernel.org>
Mon, 23 Sep 2024 20:42:40 +0000 (13:42 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 9 Oct 2024 23:27:10 +0000 (16:27 -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 0e814a414366b09b0fee68eb5d7722967a629564..9dde939babb1abb0f40507ca1b5596b0cbc84529 100644 (file)
@@ -6580,7 +6580,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 3ff2cc42a15b3c31283f5b0353a37537fb9c0c72..e0e89fe0e9fba9e3d1831bd477023e31a1307b12 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)