On Thu, Jun 13, 2024 at 07:06:13AM +0200, Christoph Hellwig wrote: > 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: That won't work, because xfs_buffered_write_iomap_begin only sets @prealloc to nonzero if it thinks is an extending write. For the cow fork, we create delalloc reservations that are aligned to the cowextsize value for overwrites below eof. --D > > + /* > > + * 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. > >