Re: [PATCH v6 04/13] xfs: pass flags to xfs_reflink_allocate_cow()
From: Christoph Hellwig
Date: Mon Mar 17 2025 - 02:15:50 EST
On Thu, Mar 13, 2025 at 05:13:01PM +0000, John Garry wrote:
> @@ -823,6 +824,9 @@ xfs_direct_write_iomap_begin(
> if (xfs_is_shutdown(mp))
> return -EIO;
>
> + if (flags & IOMAP_DIRECT || IS_DAX(inode))
> + reflink_flags |= XFS_REFLINK_CONVERT_UNWRITTEN;
Given that this is where the policy is implemented now, this comment:
/*
* COW fork extents are supposed to remain unwritten until we're ready
* to initiate a disk write. For direct I/O we are going to write the
* data and need the conversion, but for buffered writes we're done.
*/
from xfs_reflink_convert_unwritten should probably move here now.
> - return xfs_reflink_convert_unwritten(ip, imap, cmap, convert_now);
> + return xfs_reflink_convert_unwritten(ip, imap, cmap,
> + flags & XFS_REFLINK_CONVERT_UNWRITTEN);
I'd probably thread the flags argument all the way through
xfs_reflink_convert_unwritten as that documents the intent better.
> +/*
> + * Flags for xfs_reflink_allocate_cow() and callees
> + */
And the full sentence with a .?