On Sat, Feb 17, 2024 at 04:55:51PM +0800, Zhang Yi wrote: > On 2024/2/13 13:46, Christoph Hellwig wrote: > > Wouldn't it make more sense to just move the size manipulation to the > > write-only code? An untested version of that is below. With this > > Sorry for the late reply and thanks for your suggestion, The reason why > I introduced this new helper iomap_write_end_simple() is I don't want to > open code __iomap_put_folio() in each caller since corresponding to > iomap_write_begin(), it's the responsibility for iomap_write_end_*() to > put and unlock folio, so I'd like to keep it in iomap_write_end_*(). Just because we currently put the folio in iomap_write_end_*(), it doesn't mean we must always do it that way. > But I don't feel strongly about it, it's also fine by me to just move > the size manipulation to the write-only code if you think it's better. I agree with Christoph that it's better to move the i_size update into iomap_write_iter() than it is to implement a separate write_end function that does not update the i_size. The iter functions already do work directly on the folio that iomap_write_begin() returns, so having them drop the folio when everything is done isn't a huge deal... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx