Re: [PATCH v6 04/13] xfs: pass flags to xfs_reflink_allocate_cow()

From: John Garry
Date: Mon Mar 17 2025 - 05:17:47 EST


On 17/03/2025 06:15, Christoph Hellwig wrote:
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.

ok, fine, I can relocate this comment to xfs_direct_write_iomap_begin(), but please let me know if you prefer an rewording.


- 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.

ok



+/*
+ * Flags for xfs_reflink_allocate_cow() and callees
+ */

And the full sentence with a .?

ok