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

Christoph Hellwig
2024-06-13T05:06:16Z

On Wed, Jun 12, 2024 at 10:47:19AM -0700, Darrick J. Wong wrote:
> xfs_filblks_t prealloc,
> struct xfs_bmbt_irec *got,
> struct xfs_iext_cursor *icur,
> - int eof)
> + int eof,
> + bool use_cowextszhint)

Looking at the caller below I don't think we need the use_cowextszhint
flag here, we can just locally check for prealloc beeing non-0 in
the branch below:

> + /*
> + * If the caller wants us to do so, try to expand the range of the
> + * delalloc reservation up and down so that it's aligned with the CoW
> + * extent size hint. 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.
> + */
> + if (whichfork == XFS_COW_FORK && use_cowextszhint) {

Which keeps all the logic and the comments in one single place.