On Tue, May 21, 2024 at 08:00:20PM -0700, Darrick J. Wong wrote: > On Tue, May 21, 2024 at 12:38:30PM +1000, Dave Chinner wrote: > > [RFC] iomap: zeroing needs to be pagecache aware > > > > From: Dave Chinner <dchinner@xxxxxxxxxx> > > > > Unwritten extents can have page cache data over the range being > > zeroed so we can't just skip them entirely. Fix this by checking for > > an existing dirty folio over the unwritten range we are zeroing > > and only performing zeroing if the folio is already dirty. > > > > XXX: how do we detect a iomap containing a cow mapping over a hole > > in iomap_zero_iter()? The XFS code implies this case also needs to > > zero the page cache if there is data present, so trigger for page > > cache lookup only in iomap_zero_iter() needs to handle this case as > > well. > > Hmm. If memory serves, we probably need to adapt the > xfs_buffered/direct_write_iomap_begin functions to return the hole in > srcmap and the cow mapping in the iomap. RN I think it just returns the > hole. Yes, that is what I was thinking we need to do - xfs_buffered_write_iomap_begin() doesn't even check for COW mappings if IOMAP_ZERO is set, so there's a bunch of refactoring work needed to let iomap know that there is a COW mapping over the hole so it can do the same page cache lookup stuff that I added for unwritten extents.... -Dave. -- Dave Chinner david@xxxxxxxxxxxxx