diff options
| author | Jan Kara <jack@suse.cz> | 2025-03-07 15:43:19 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-03-08 12:19:22 +0100 |
| commit | 93fd0d46cbf7bc35a3a912c913b4f074955119c7 (patch) | |
| tree | 82d9b3ed3cb40d8d7388e9aa0c2b44311ee89866 /fs/inode.c | |
| parent | 66447acc09dc77addb06875c987dbe22844635f3 (diff) | |
| download | random-93fd0d46cbf7bc35a3a912c913b4f074955119c7.tar.gz | |
vfs: Remove invalidate_inodes()
The function can be replaced by evict_inodes. The only difference is
that evict_inodes() skips the inodes with positive refcount without
touching ->i_lock, but they are equivalent as evict_inodes() repeats the
refcount check after having grabbed ->i_lock.
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20250307144318.28120-2-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/inode.c')
| -rw-r--r-- | fs/inode.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/fs/inode.c b/fs/inode.c index 0cd2304150971f..10121fc7b87e44 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -910,46 +910,6 @@ again: } 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. * |
