Convert simple loops over superblocks to list_for_each_entry_safe
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 23 Mar 2010 00:09:33 +0000 (20:09 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 21 May 2010 22:31:15 +0000 (18:31 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/buffer.c
fs/drop_caches.c
fs/quota/quota.c
fs/super.c

index 021ec4da993251e919c04de5094384b81b86be81..ded29b0fdac3a0db8ee6be49f7a970e3a42dce6b 100644 (file)
@@ -562,12 +562,11 @@ repeat:
 
 static void do_thaw_all(struct work_struct *work)
 {
-       struct super_block *sb;
+       struct super_block *sb, *n;
        char b[BDEVNAME_SIZE];
 
        spin_lock(&sb_lock);
-restart:
-       list_for_each_entry(sb, &super_blocks, s_list) {
+       list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
                if (list_empty(&sb->s_instances))
                        continue;
                sb->s_count++;
@@ -578,8 +577,6 @@ restart:
                               bdevname(sb->s_bdev, b));
                up_read(&sb->s_umount);
                spin_lock(&sb_lock);
-               if (__put_super_and_need_restart(sb))
-                       goto restart;
        }
        spin_unlock(&sb_lock);
        kfree(work);
index 9cd4e4a70f56d80126c685bebe41dd7e85b0a3fc..42728a1f795f7fd83990f9502d4efabd5350019b 100644 (file)
@@ -35,11 +35,10 @@ static void drop_pagecache_sb(struct super_block *sb)
 
 static void drop_pagecache(void)
 {
-       struct super_block *sb;
+       struct super_block *sb, *n;
 
        spin_lock(&sb_lock);
-restart:
-       list_for_each_entry(sb, &super_blocks, s_list) {
+       list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
                if (list_empty(&sb->s_instances))
                        continue;
                sb->s_count++;
@@ -49,8 +48,7 @@ restart:
                        drop_pagecache_sb(sb);
                up_read(&sb->s_umount);
                spin_lock(&sb_lock);
-               if (__put_super_and_need_restart(sb))
-                       goto restart;
+               __put_super(sb);
        }
        spin_unlock(&sb_lock);
 }
index 4669e7e639bd9ca2c745d5d92d80d9c458c384b8..2196f8b07c1f8e2f844b5de59536d7cff1932752 100644 (file)
@@ -47,7 +47,7 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
 
 static int quota_sync_all(int type)
 {
-       struct super_block *sb;
+       struct super_block *sb, *n;
        int ret;
 
        if (type >= MAXQUOTAS)
@@ -57,8 +57,7 @@ static int quota_sync_all(int type)
                return ret;
 
        spin_lock(&sb_lock);
-restart:
-       list_for_each_entry(sb, &super_blocks, s_list) {
+       list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
                if (list_empty(&sb->s_instances))
                        continue;
                if (!sb->s_qcop || !sb->s_qcop->quota_sync)
@@ -71,8 +70,7 @@ restart:
                        sb->s_qcop->quota_sync(sb, type, 1);
                up_read(&sb->s_umount);
                spin_lock(&sb_lock);
-               if (__put_super_and_need_restart(sb))
-                       goto restart;
+               __put_super(sb);
        }
        spin_unlock(&sb_lock);
 
index ba99524998f795adff6ccff4d768216510665330..ccb2b5fa89bda320adf8c1a2faa587fdc473a10e 100644 (file)
@@ -395,11 +395,10 @@ EXPORT_SYMBOL(drop_super);
  */
 void sync_supers(void)
 {
-       struct super_block *sb;
+       struct super_block *sb, *n;
 
        spin_lock(&sb_lock);
-restart:
-       list_for_each_entry(sb, &super_blocks, s_list) {
+       list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
                if (list_empty(&sb->s_instances))
                        continue;
                if (sb->s_op->write_super && sb->s_dirt) {
@@ -412,8 +411,7 @@ restart:
                        up_read(&sb->s_umount);
 
                        spin_lock(&sb_lock);
-                       if (__put_super_and_need_restart(sb))
-                               goto restart;
+                       __put_super(sb);
                }
        }
        spin_unlock(&sb_lock);