]> git.ipfire.org Git - thirdparty/linux.git/commit
xfs: only flush when COW fork blocks overlap data fork holes
authorBrian Foster <bfoster@redhat.com>
Wed, 11 Mar 2026 16:25:00 +0000 (12:25 -0400)
committerCarlos Maiolino <cem@kernel.org>
Mon, 23 Mar 2026 10:07:59 +0000 (11:07 +0100)
commitc770f997a4227b6fc5f62275b2337622213e35af
tree0e0586d4568c8b6475ccc9479db97e288d7dd745
parenta8eb41376df987887b33dbf7078d5b13c85f3e0c
xfs: only flush when COW fork blocks overlap data fork holes

The zero range hole mapping flush case has been lifted from iomap
into XFS. Now that we have more mapping context available from the
->iomap_begin() handler, we can isolate the flush further to when we
know a hole is fronted by COW blocks.

Rather than purely rely on pagecache dirty state, explicitly check
for the case where a range is a hole in both forks. Otherwise trim
to the range where there does happen to be overlap and use that for
the pagecache writeback check. This might prevent some spurious
zeroing, but more importantly makes it easier to remove the flush
entirely.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_iomap.c