On Mon, Sep 02, 2019 at 10:01:09AM -0700, Darrick J. Wong wrote: > On Mon, Sep 02, 2019 at 06:31:24PM +0200, Christoph Hellwig wrote: > > On Sun, Sep 01, 2019 at 03:08:24PM -0500, Goldwyn Rodrigues wrote: > > > > > + iomap_assert(!(iomap->flags & IOMAP_F_BUFFER_HEAD)); > > > + iomap_assert(srcmap->type == IOMAP_HOLE || srcmap->addr > 0); > > > > 0 can be a valid address in various file systems, so I don't think we > > can just exclude it. Then again COWing from a hole seems pointless, > > doesn't it? > > XFS does that if you set a cowextsize hint and a speculative cow > preallocation ends up covering a hole. Granted I don't think there's > much point in reading from a COW fork extent to fill in an unaligned > buffered write since it /should/ just end up zero-filling the pagecache > regardless of fork... but I don't see much harm in doing that. That assumes you'd set the iomap-level COW flag for anything that writes to the COW fork in XFS. Which doesn't sound right to me - the iomap-level indicates that we actually need to read some data, which for a hole is rather pointless as you said.