On Wed, Sep 18, 2019 at 10:17:33AM -0700, Darrick J. Wong wrote: > > /* > > * Pre-COW all shared blocks within a given byte range of a file and turn off > > * the reflink flag if we unshare all of the file's blocks. > > + * > > + * Let iomap iterate all extents to see which are shared and not unwritten or > > + * delalloc and read them into the page cache, dirty them, fsync them back out, > > + * and then we can update the inode flag. What happens if we run out of > > + * memory? :) > > I don't know, what /does/ happen? :) > > It /should/ be fine, right? Writeback will start pushing the dirty > cache pages to disk, and since writeback only takes the ILOCK, it should > be able to perform the COW even while the unshare process sits on the > IOLOCK/MMAPLOCK. True, the unshare process and writeback will both be > contending on the ILOCK, but that shouldn't be a problem... > > ...unless I'm missing something? It sure does look nice to drain all > this other code out. No idea. This is your old code just moved down to this function. But yes, the comment looks rather confusing and maybe we should just remove it.