Skip to content

Commit 3bc4e44

Browse files
jankarabrauner
authored andcommitted
vfs: Remove unnecessary list_for_each_entry_safe() from evict_inodes()
evict_inodes() uses list_for_each_entry_safe() to iterate sb->s_inodes list. However, since we use i_lru list entry for our local temporary list of inodes to destroy, the inode is guaranteed to stay in sb->s_inodes list while we hold sb->s_inode_list_lock. So there is no real need for safe iteration variant and we can use list_for_each_entry() just fine. Signed-off-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/20250709090635.26319-2-jack@suse.cz Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 2505018 commit 3bc4e44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,12 +865,12 @@ static void dispose_list(struct list_head *head)
865865
*/
866866
void evict_inodes(struct super_block *sb)
867867
{
868-
struct inode *inode, *next;
868+
struct inode *inode;
869869
LIST_HEAD(dispose);
870870

871871
again:
872872
spin_lock(&sb->s_inode_list_lock);
873-
list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
873+
list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
874874
if (atomic_read(&inode->i_count))
875875
continue;
876876

0 commit comments

Comments
 (0)