On Wed 02-10-24 11:33:18, Dave Chinner wrote: > From: Dave Chinner <dchinner@xxxxxxxxxx> > > As of commit e127b9bccdb0 ("fs: simplify invalidate_inodes"), > invalidate_inodes() is functionally identical to evict_inodes(). > Replace calls to invalidate_inodes() with a call to > evict_inodes() and kill the former. > > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> Indeed :). Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@xxxxxxx> Honza > --- > fs/inode.c | 40 ---------------------------------------- > fs/internal.h | 1 - > fs/super.c | 2 +- > 3 files changed, 1 insertion(+), 42 deletions(-) > > diff --git a/fs/inode.c b/fs/inode.c > index 471ae4a31549..0a53d8c34203 100644 > --- a/fs/inode.c > +++ b/fs/inode.c > @@ -827,46 +827,6 @@ void evict_inodes(struct super_block *sb) > } > EXPORT_SYMBOL_GPL(evict_inodes); > > -/** > - * invalidate_inodes - attempt to free all inodes on a superblock > - * @sb: superblock to operate on > - * > - * Attempts to free all inodes (including dirty inodes) for a given superblock. > - */ > -void invalidate_inodes(struct super_block *sb) > -{ > - struct inode *inode, *next; > - LIST_HEAD(dispose); > - > -again: > - spin_lock(&sb->s_inode_list_lock); > - list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { > - spin_lock(&inode->i_lock); > - if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) { > - spin_unlock(&inode->i_lock); > - continue; > - } > - if (atomic_read(&inode->i_count)) { > - spin_unlock(&inode->i_lock); > - continue; > - } > - > - inode->i_state |= I_FREEING; > - inode_lru_list_del(inode); > - spin_unlock(&inode->i_lock); > - list_add(&inode->i_lru, &dispose); > - if (need_resched()) { > - spin_unlock(&sb->s_inode_list_lock); > - cond_resched(); > - dispose_list(&dispose); > - goto again; > - } > - } > - spin_unlock(&sb->s_inode_list_lock); > - > - dispose_list(&dispose); > -} > - > /* > * Isolate the inode from the LRU in preparation for freeing it. > * > diff --git a/fs/internal.h b/fs/internal.h > index 8c1b7acbbe8f..37749b429e80 100644 > --- a/fs/internal.h > +++ b/fs/internal.h > @@ -207,7 +207,6 @@ bool in_group_or_capable(struct mnt_idmap *idmap, > * fs-writeback.c > */ > extern long get_nr_dirty_inodes(void); > -void invalidate_inodes(struct super_block *sb); > > /* > * dcache.c > diff --git a/fs/super.c b/fs/super.c > index 1db230432960..a16e6a6342e0 100644 > --- a/fs/super.c > +++ b/fs/super.c > @@ -1417,7 +1417,7 @@ static void fs_bdev_mark_dead(struct block_device *bdev, bool surprise) > if (!surprise) > sync_filesystem(sb); > shrink_dcache_sb(sb); > - invalidate_inodes(sb); > + evict_inodes(sb); > if (sb->s_op->shutdown) > sb->s_op->shutdown(sb); > > -- > 2.45.2 > > -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR