On Wed, Nov 22, 2023 at 08:09:44PM -0800, Darrick J. Wong wrote: > On Thu, Nov 23, 2023 at 09:26:44AM +1100, Dave Chinner wrote: > > On Wed, Nov 22, 2023 at 05:11:18AM -0800, Christoph Hellwig wrote: > > > On Wed, Nov 22, 2023 at 01:29:46PM +0100, Jan Kara wrote: > > > > writeback bit set. XFS plays the revalidation sequence counter games > > > > because of this so we'd have to do something similar for ext2. Not that I'd > > > > care as much about ext2 writeback performance but it should not be that > > > > hard and we'll definitely need some similar solution for ext4 anyway. Can > > > > you give that a try (as a followup "performance improvement" patch). > > > > > > Darrick has mentioned that he is looking into lifting more of the > > > validation sequence counter validation into iomap. > > > > I think that was me, as part of aligning the writeback path with > > the ->iomap_valid() checks in the write path after we lock the folio > > we instantiated for the write. > > > > It's basically the same thing - once we have a locked folio, we have > > to check that the cached iomap is still valid before we use it for > > anything. > > > > I need to find the time to get back to that, though. > > Heh, we probably both have been chatting with willy on and off about > iomap. > > The particular idea I had is to add a u64 counter to address_space that > we can bump in the same places where we bump xfs_inode_fork::if_seq > right now.. ->iomap_begin would sample this address_space::i_mappingseq > counter (with locks held), and now buffered writes and writeback can > check iomap::mappingseq == address_space::i_mappingseq to decide if it's > time to revalidate. Can't say I'm a great fan of putting filesystem physical extent map state cookies in the page cache address space. One of the primary architectural drivers for iomap was to completely separate the filesystem extent mapping information from the page cache internals and granularities, so this kinda steps over an architectural boundary in my mind. Also, filesystem mapping operations move further away from the VFS structures into deep internal filesystem - they do not interact with the page cache structures at all. Hence requiring physical extent mapping operations have to poke values in the page cache address space structure just seems like unnecessarily long pointer chasing to me. That said, I have no problesm with extent sequence counters in the VFS inode, but I just don't think it belongs in the page cache address space.... -Dave. -- Dave Chinner david@xxxxxxxxxxxxx