xfs: enable extent size hints for CoW operations

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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Darrick J. Wong
2024-11-20 16:21:03 -08:00
parent 4de1a7ba41
commit 8e84e8052b
2 changed files with 11 additions and 2 deletions

View File

@@ -6524,7 +6524,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)

View File

@@ -2021,7 +2021,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)