On Fri, Feb 17, 2023 at 02:48:31PM +0000, Shiyang Ruan wrote: > - invalidate_mapping_pages(inode->i_mapping, 0, -1); > - iput(toput_inode); > - toput_inode = inode; > - > - cond_resched(); > - spin_lock(&sb->s_inode_list_lock); > - } > - spin_unlock(&sb->s_inode_list_lock); > - iput(toput_inode); > + super_drop_pagecache(sb, invalidate_inode_pages); I thought I explained last time that you can do this with invalidate_mapping_pages() / invalidate_inode_pages2_range() ? Then you don't need to introduce invalidate_inode_pages(). > +void super_drop_pagecache(struct super_block *sb, > + int (*invalidator)(struct address_space *)) void super_drop_pagecache(struct super_block *sb, int (*invalidate)(struct address_space *, pgoff_t, pgoff_t)) > + invalidator(inode->i_mapping); invalidate(inode->i_mapping, 0, -1) ... then all the changes to mm/truncate.c and filemap.h go away.