mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
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>
This commit is contained in:
parent
25050181b6
commit
3bc4e44108
@ -865,12 +865,12 @@ static void dispose_list(struct list_head *head)
|
|||||||
*/
|
*/
|
||||||
void evict_inodes(struct super_block *sb)
|
void evict_inodes(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct inode *inode, *next;
|
struct inode *inode;
|
||||||
LIST_HEAD(dispose);
|
LIST_HEAD(dispose);
|
||||||
|
|
||||||
again:
|
again:
|
||||||
spin_lock(&sb->s_inode_list_lock);
|
spin_lock(&sb->s_inode_list_lock);
|
||||||
list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
|
list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
|
||||||
if (atomic_read(&inode->i_count))
|
if (atomic_read(&inode->i_count))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user