Skip to content

Commit ead5a72

Browse files
Alexey Dobriyanakpm00
authored andcommitted
proc: save LOC by using while loop
Use while loop instead of infinite loop with "break;". Also move some variable to the inner scope where they belong. Link: https://lkml.kernel.org/r/82c8f8e7-8ded-46ca-8857-e60b991d6205@p183 Signed-off-by: Alexey Dobriyan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 860a2e7 commit ead5a72

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

fs/proc/inode.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,15 @@ void __init proc_init_kmemcache(void)
110110

111111
void proc_invalidate_siblings_dcache(struct hlist_head *inodes, spinlock_t *lock)
112112
{
113-
struct inode *inode;
114-
struct proc_inode *ei;
115113
struct hlist_node *node;
116114
struct super_block *old_sb = NULL;
117115

118116
rcu_read_lock();
119-
for (;;) {
117+
while ((node = hlist_first_rcu(inodes))) {
118+
struct proc_inode *ei = hlist_entry(node, struct proc_inode, sibling_inodes);
120119
struct super_block *sb;
121-
node = hlist_first_rcu(inodes);
122-
if (!node)
123-
break;
124-
ei = hlist_entry(node, struct proc_inode, sibling_inodes);
120+
struct inode *inode;
121+
125122
spin_lock(lock);
126123
hlist_del_init_rcu(&ei->sibling_inodes);
127124
spin_unlock(lock);

0 commit comments

Comments
 (0)