]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: fix xfs_get_extsz_hint behavior with realtime alwayscow files
authorDarrick J. Wong <djwong@kernel.org>
Wed, 29 May 2024 04:13:18 +0000 (21:13 -0700)
committerChristoph Hellwig <hch@lst.de>
Mon, 12 Aug 2024 11:53:08 +0000 (13:53 +0200)
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>
fs/xfs/libxfs/xfs_bmap.c

index dd0d3f460a28b5fb3491c561b5432e987a4f7961..62dca5e16d157d05663b16d406ca30376c699890 100644 (file)
@@ -6550,9 +6550,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)