On Fri, May 31, 2024 at 09:00:53AM -0700, Darrick J. Wong wrote: > > Yes, The main purpose is for the later (avoid preallocating beyond). > > But the user set an extent size hint, so presumably they want us to (try > to) obey that even for unshare operations, right? > > > The patch also makes unshare use delayed allocation for bigger extent. > > If there's a good reason for not trying, can we avoid the iflag by > detecting IOMAP_UNSHARE in the @flags parameter to > xfs_buffered_write_iomap_begin and thereby use delalloc if there isn't > an extent size hint set? .. or (even if this is scope creep) just make delalloc work for extent size hints. Now that we create all extents as unwritten there is no fundamental reason for that to be dangerous, it'll just need a little more work. > (IOWs I don't really like that an upper layer of the fs sets a flag for > a lower layer to catch based on the context of whatever operation it's > doing, and in the meantime another thread could observe that state and > make different decisions.) Yes, that's pretty much a no-go.