Convert simple loops over superblocks to list_for_each_entry_safe
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/fs/buffer.c b/fs/buffer.c
index 021ec4d..ded29b0 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -562,12 +562,11 @@
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 @@
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);
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index 9cd4e4a..42728a1 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -35,11 +35,10 @@
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 @@
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);
}
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 4669e7e..2196f8b 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -47,7 +47,7 @@
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 @@
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 @@
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);
diff --git a/fs/super.c b/fs/super.c
index ba99524..ccb2b5f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -395,11 +395,10 @@
*/
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 @@
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);