]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: fix xfs_get_extsz_hint behavior with realtime alwayscow files
authorDarrick J. Wong <djwong@kernel.org>
Mon, 24 Feb 2025 18:21:54 +0000 (10:21 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 25 Feb 2025 17:15:59 +0000 (09:15 -0800)
Source kernel commit: 6853d23badd0f1852d3b711128924e2456d27634

Currently, we (ab)use xfs_get_extsz_hint so that it always returns a
nonzero value for realtime files.  This apparently was done to disable
delayed allocation for realtime files.

However, once we enable realtime reflink, we can also turn on the
alwayscow flag to force CoW writes to realtime files.  In this case, the
logic will incorrectly send the write through the delalloc write path.

Fix this by adjusting the logic slightly.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_bmap.c

index 9cfbdb85c975a51ac736df2931653b28088e5035..ed969983cccd1ba02010914c7b55227d84b96ff7 100644 (file)
@@ -6494,9 +6494,8 @@ xfs_get_extsz_hint(
         * No point in aligning allocations if we need to COW to actually
         * write to them.
         */
-       if (xfs_is_always_cow_inode(ip))
-               return 0;
-       if ((ip->i_diflags & XFS_DIFLAG_EXTSIZE) && ip->i_extsize)
+       if (!xfs_is_always_cow_inode(ip) &&
+           (ip->i_diflags & XFS_DIFLAG_EXTSIZE) && ip->i_extsize)
                return ip->i_extsize;
        if (XFS_IS_REALTIME_INODE(ip) &&
            ip->i_mount->m_sb.sb_rextsize > 1)