Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Alexey Dobriyan and committed by
Andrew Morton
ead5a727 860a2e7f

+4 -7
+4 -7
fs/proc/inode.c
··· 110 110 111 111 void proc_invalidate_siblings_dcache(struct hlist_head *inodes, spinlock_t *lock) 112 112 { 113 - struct inode *inode; 114 - struct proc_inode *ei; 115 113 struct hlist_node *node; 116 114 struct super_block *old_sb = NULL; 117 115 118 116 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); 120 119 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 + 125 122 spin_lock(lock); 126 123 hlist_del_init_rcu(&ei->sibling_inodes); 127 124 spin_unlock(lock);