aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-03-22 20:09:33 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-05-21 18:31:15 -0400
commit6754af64641e8224c281ee5714e012e3ed41f701 (patch)
tree248a8c01aae46f98505d8c196393fae629f9691a
parent8edd64bd6089e21f47dcdebb14b598b713213ddc (diff)
Convert simple loops over superblocks to list_for_each_entry_safe
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/buffer.c7
-rw-r--r--fs/drop_caches.c8
-rw-r--r--fs/quota/quota.c8
-rw-r--r--fs/super.c8
4 files changed, 11 insertions, 20 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 021ec4da9932..ded29b0fdac3 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -562,12 +562,11 @@ repeat:
562 562
563static void do_thaw_all(struct work_struct *work) 563static void do_thaw_all(struct work_struct *work)
564{ 564{
565 struct super_block *sb; 565 struct super_block *sb, *n;
566 char b[BDEVNAME_SIZE]; 566 char b[BDEVNAME_SIZE];
567 567
568 spin_lock(&sb_lock); 568 spin_lock(&sb_lock);
569restart: 569 list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
570 list_for_each_entry(sb, &super_blocks, s_list) {
571 if (list_empty(&sb->s_instances)) 570 if (list_empty(&sb->s_instances))
572 continue; 571 continue;
573 sb->s_count++; 572 sb->s_count++;
@@ -578,8 +577,6 @@ restart:
578 bdevname(sb->s_bdev, b)); 577 bdevname(sb->s_bdev, b));
579 up_read(&sb->s_umount); 578 up_read(&sb->s_umount);
580 spin_lock(&sb_lock); 579 spin_lock(&sb_lock);
581 if (__put_super_and_need_restart(sb))
582 goto restart;
583 } 580 }
584 spin_unlock(&sb_lock); 581 spin_unlock(&sb_lock);
585 kfree(work); 582 kfree(work);
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index 9cd4e4a70f56..42728a1f795f 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -35,11 +35,10 @@ static void drop_pagecache_sb(struct super_block *sb)
35 35
36static void drop_pagecache(void) 36static void drop_pagecache(void)
37{ 37{
38 struct super_block *sb; 38 struct super_block *sb, *n;
39 39
40 spin_lock(&sb_lock); 40 spin_lock(&sb_lock);
41restart: 41 list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
42 list_for_each_entry(sb, &super_blocks, s_list) {
43 if (list_empty(&sb->s_instances)) 42 if (list_empty(&sb->s_instances))
44 continue; 43 continue;
45 sb->s_count++; 44 sb->s_count++;
@@ -49,8 +48,7 @@ restart:
49 drop_pagecache_sb(sb); 48 drop_pagecache_sb(sb);
50 up_read(&sb->s_umount); 49 up_read(&sb->s_umount);
51 spin_lock(&sb_lock); 50 spin_lock(&sb_lock);
52 if (__put_super_and_need_restart(sb)) 51 __put_super(sb);
53 goto restart;
54 } 52 }
55 spin_unlock(&sb_lock); 53 spin_unlock(&sb_lock);
56} 54}
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 4669e7e639bd..2196f8b07c1f 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -47,7 +47,7 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
47 47
48static int quota_sync_all(int type) 48static int quota_sync_all(int type)
49{ 49{
50 struct super_block *sb; 50 struct super_block *sb, *n;
51 int ret; 51 int ret;
52 52
53 if (type >= MAXQUOTAS) 53 if (type >= MAXQUOTAS)
@@ -57,8 +57,7 @@ static int quota_sync_all(int type)
57 return ret; 57 return ret;
58 58
59 spin_lock(&sb_lock); 59 spin_lock(&sb_lock);
60restart: 60 list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
61 list_for_each_entry(sb, &super_blocks, s_list) {
62 if (list_empty(&sb->s_instances)) 61 if (list_empty(&sb->s_instances))
63 continue; 62 continue;
64 if (!sb->s_qcop || !sb->s_qcop->quota_sync) 63 if (!sb->s_qcop || !sb->s_qcop->quota_sync)
@@ -71,8 +70,7 @@ restart:
71 sb->s_qcop->quota_sync(sb, type, 1); 70 sb->s_qcop->quota_sync(sb, type, 1);
72 up_read(&sb->s_umount); 71 up_read(&sb->s_umount);
73 spin_lock(&sb_lock); 72 spin_lock(&sb_lock);
74 if (__put_super_and_need_restart(sb)) 73 __put_super(sb);
75 goto restart;
76 } 74 }
77 spin_unlock(&sb_lock); 75 spin_unlock(&sb_lock);
78 76
diff --git a/fs/super.c b/fs/super.c
index ba99524998f7..ccb2b5fa89bd 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -395,11 +395,10 @@ EXPORT_SYMBOL(drop_super);
395 */ 395 */
396void sync_supers(void) 396void sync_supers(void)
397{ 397{
398 struct super_block *sb; 398 struct super_block *sb, *n;
399 399
400 spin_lock(&sb_lock); 400 spin_lock(&sb_lock);
401restart: 401 list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
402 list_for_each_entry(sb, &super_blocks, s_list) {
403 if (list_empty(&sb->s_instances)) 402 if (list_empty(&sb->s_instances))
404 continue; 403 continue;
405 if (sb->s_op->write_super && sb->s_dirt) { 404 if (sb->s_op->write_super && sb->s_dirt) {
@@ -412,8 +411,7 @@ restart:
412 up_read(&sb->s_umount); 411 up_read(&sb->s_umount);
413 412
414 spin_lock(&sb_lock); 413 spin_lock(&sb_lock);
415 if (__put_super_and_need_restart(sb)) 414 __put_super(sb);
416 goto restart;
417 } 415 }
418 } 416 }
419 spin_unlock(&sb_lock); 417 spin_unlock(&sb_lock);