From: Darrick J. Wong Date: Wed, 3 Jul 2024 21:22:31 +0000 (-0700) Subject: xfs: fix xfs_get_extsz_hint behavior with realtime alwayscow files X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=13df6286459f68d844a0e45d0f75e094231fe56c;p=users%2Fhch%2Fxfsprogs.git xfs: fix xfs_get_extsz_hint behavior with realtime alwayscow files 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 --- diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 1c857988f..830782da7 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -6508,9 +6508,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)