]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: enable extent size hints for CoW operations
authorDarrick J. Wong <djwong@kernel.org>
Thu, 15 Aug 2024 18:49:34 +0000 (11:49 -0700)
committerChristoph Hellwig <hch@lst.de>
Sun, 22 Sep 2024 08:48:28 +0000 (10:48 +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 af63b6d772244c49105a1911e272f55fe1a0eab7..924f5223d40cc11e686db798d025731a07908730 100644 (file)
@@ -6582,7 +6582,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 81359c9e4c519419ae6d59317c46c55d8acdf504..d688a8c8c47ed447a01239648981d4622790a1a6 100644 (file)
@@ -1901,7 +1901,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)