diff mbox series

[05/11] fs: use sb_for_each_inodes_safe API

Message ID 20241118114508.1405494-6-yebin@huaweicloud.com (mailing list archive)
State New
Headers show
Series fix hungtask due to repeated traversal of inodes list | expand

Commit Message

Ye Bin Nov. 18, 2024, 11:45 a.m. UTC
From: Ye Bin <yebin10@huawei.com>

Use sb_for_each_inodes_safe API foreach super_block->s_inodes.

Signed-off-by: Ye Bin <yebin10@huawei.com>
---
 fs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/inode.c b/fs/inode.c
index e5a60084a7a9..dc966990bda6 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -861,7 +861,7 @@  void evict_inodes(struct super_block *sb)
 
 again:
 	spin_lock(&sb->s_inode_list_lock);
-	list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
+	sb_for_each_inodes_safe(inode, next, &sb->s_inodes) {
 		if (atomic_read(&inode->i_count))
 			continue;
 
@@ -911,7 +911,7 @@  void invalidate_inodes(struct super_block *sb)
 
 again:
 	spin_lock(&sb->s_inode_list_lock);
-	list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
+	sb_for_each_inodes_safe(inode, next, &sb->s_inodes) {
 		spin_lock(&inode->i_lock);
 		if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) {
 			spin_unlock(&inode->i_lock);