Re: [PATCH 3/5] xfs: restrict when we try to align cow fork delalloc to cowextsz hints

Christoph Hellwig
2024-06-14T05:31:09Z

On Thu, Jun 13, 2024 at 10:27:05PM -0700, Darrick J. Wong wrote:
> > + * Unlike the data fork, the CoW cancellation functions will free all
> > + * the reservations at inactivation, so we don't require that every
> > + * delalloc reservation have a dirty pagecache.
> > + *
> > + * XXX(hch): I can't see where we actually require dirty pagecache
> > + * for speculative data fork preallocations. What am I missing?
>
> IIRC a delalloc reservation in the data fork that isn't backing a dirty
> page will just sit there in the data fork and never get reclaimed.
> There's no writeback to turn it into an unwritten -> written extent.
> The blockgc functions won't (can't?) walk the pagecache to find clean
> regions that could be torn down. xfs destroy_inode just asserts on any
> reservations that it finds.

blockgc doesn't walk the page cache at all. It just calls
xfs_free_eofblocks which simply drops all extents after i_size.

If it didn't do that we'd be in trouble because there never is any dirty
page cache past roundup(i_size, PAGE_SIZE).