Commit 6754af64641e8224c281ee5714e012e3ed41f701
1 parent
8edd64bd60
Exists in
master
and in
4 other branches
Convert simple loops over superblocks to list_for_each_entry_safe
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 4 changed files with 11 additions and 20 deletions Side-by-side Diff
fs/buffer.c
... | ... | @@ -562,12 +562,11 @@ |
562 | 562 | |
563 | 563 | static void do_thaw_all(struct work_struct *work) |
564 | 564 | { |
565 | - struct super_block *sb; | |
565 | + struct super_block *sb, *n; | |
566 | 566 | char b[BDEVNAME_SIZE]; |
567 | 567 | |
568 | 568 | spin_lock(&sb_lock); |
569 | -restart: | |
570 | - list_for_each_entry(sb, &super_blocks, s_list) { | |
569 | + list_for_each_entry_safe(sb, n, &super_blocks, s_list) { | |
571 | 570 | if (list_empty(&sb->s_instances)) |
572 | 571 | continue; |
573 | 572 | sb->s_count++; |
... | ... | @@ -578,8 +577,6 @@ |
578 | 577 | bdevname(sb->s_bdev, b)); |
579 | 578 | up_read(&sb->s_umount); |
580 | 579 | spin_lock(&sb_lock); |
581 | - if (__put_super_and_need_restart(sb)) | |
582 | - goto restart; | |
583 | 580 | } |
584 | 581 | spin_unlock(&sb_lock); |
585 | 582 | kfree(work); |
fs/drop_caches.c
... | ... | @@ -35,11 +35,10 @@ |
35 | 35 | |
36 | 36 | static void drop_pagecache(void) |
37 | 37 | { |
38 | - struct super_block *sb; | |
38 | + struct super_block *sb, *n; | |
39 | 39 | |
40 | 40 | spin_lock(&sb_lock); |
41 | -restart: | |
42 | - list_for_each_entry(sb, &super_blocks, s_list) { | |
41 | + list_for_each_entry_safe(sb, n, &super_blocks, s_list) { | |
43 | 42 | if (list_empty(&sb->s_instances)) |
44 | 43 | continue; |
45 | 44 | sb->s_count++; |
... | ... | @@ -49,8 +48,7 @@ |
49 | 48 | drop_pagecache_sb(sb); |
50 | 49 | up_read(&sb->s_umount); |
51 | 50 | spin_lock(&sb_lock); |
52 | - if (__put_super_and_need_restart(sb)) | |
53 | - goto restart; | |
51 | + __put_super(sb); | |
54 | 52 | } |
55 | 53 | spin_unlock(&sb_lock); |
56 | 54 | } |
fs/quota/quota.c
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | |
48 | 48 | static int quota_sync_all(int type) |
49 | 49 | { |
50 | - struct super_block *sb; | |
50 | + struct super_block *sb, *n; | |
51 | 51 | int ret; |
52 | 52 | |
53 | 53 | if (type >= MAXQUOTAS) |
... | ... | @@ -57,8 +57,7 @@ |
57 | 57 | return ret; |
58 | 58 | |
59 | 59 | spin_lock(&sb_lock); |
60 | -restart: | |
61 | - list_for_each_entry(sb, &super_blocks, s_list) { | |
60 | + list_for_each_entry_safe(sb, n, &super_blocks, s_list) { | |
62 | 61 | if (list_empty(&sb->s_instances)) |
63 | 62 | continue; |
64 | 63 | if (!sb->s_qcop || !sb->s_qcop->quota_sync) |
... | ... | @@ -71,8 +70,7 @@ |
71 | 70 | sb->s_qcop->quota_sync(sb, type, 1); |
72 | 71 | up_read(&sb->s_umount); |
73 | 72 | spin_lock(&sb_lock); |
74 | - if (__put_super_and_need_restart(sb)) | |
75 | - goto restart; | |
73 | + __put_super(sb); | |
76 | 74 | } |
77 | 75 | spin_unlock(&sb_lock); |
78 | 76 |
fs/super.c
... | ... | @@ -395,11 +395,10 @@ |
395 | 395 | */ |
396 | 396 | void sync_supers(void) |
397 | 397 | { |
398 | - struct super_block *sb; | |
398 | + struct super_block *sb, *n; | |
399 | 399 | |
400 | 400 | spin_lock(&sb_lock); |
401 | -restart: | |
402 | - list_for_each_entry(sb, &super_blocks, s_list) { | |
401 | + list_for_each_entry_safe(sb, n, &super_blocks, s_list) { | |
403 | 402 | if (list_empty(&sb->s_instances)) |
404 | 403 | continue; |
405 | 404 | if (sb->s_op->write_super && sb->s_dirt) { |
... | ... | @@ -412,8 +411,7 @@ |
412 | 411 | up_read(&sb->s_umount); |
413 | 412 | |
414 | 413 | spin_lock(&sb_lock); |
415 | - if (__put_super_and_need_restart(sb)) | |
416 | - goto restart; | |
414 | + __put_super(sb); | |
417 | 415 | } |
418 | 416 | } |
419 | 417 | spin_unlock(&sb_lock); |