diff options
Diffstat (limited to 'fs/sync.c')
-rw-r--r-- | fs/sync.c | 25 |
1 files changed, 6 insertions, 19 deletions
@@ -77,31 +77,18 @@ int sync_filesystem(struct super_block *sb) | |||
77 | } | 77 | } |
78 | EXPORT_SYMBOL_GPL(sync_filesystem); | 78 | EXPORT_SYMBOL_GPL(sync_filesystem); |
79 | 79 | ||
80 | static void sync_one_sb(struct super_block *sb, void *arg) | ||
81 | { | ||
82 | if (!(sb->s_flags & MS_RDONLY) && sb->s_bdi) | ||
83 | __sync_filesystem(sb, *(int *)arg); | ||
84 | } | ||
80 | /* | 85 | /* |
81 | * Sync all the data for all the filesystems (called by sys_sync() and | 86 | * Sync all the data for all the filesystems (called by sys_sync() and |
82 | * emergency sync) | 87 | * emergency sync) |
83 | */ | 88 | */ |
84 | static void sync_filesystems(int wait) | 89 | static void sync_filesystems(int wait) |
85 | { | 90 | { |
86 | struct super_block *sb, *n; | 91 | iterate_supers(sync_one_sb, &wait); |
87 | |||
88 | spin_lock(&sb_lock); | ||
89 | list_for_each_entry_safe(sb, n, &super_blocks, s_list) { | ||
90 | if (list_empty(&sb->s_instances)) | ||
91 | continue; | ||
92 | sb->s_count++; | ||
93 | spin_unlock(&sb_lock); | ||
94 | |||
95 | down_read(&sb->s_umount); | ||
96 | if (!(sb->s_flags & MS_RDONLY) && sb->s_root && sb->s_bdi) | ||
97 | __sync_filesystem(sb, wait); | ||
98 | up_read(&sb->s_umount); | ||
99 | |||
100 | /* restart only when sb is no longer on the list */ | ||
101 | spin_lock(&sb_lock); | ||
102 | __put_super(sb); | ||
103 | } | ||
104 | spin_unlock(&sb_lock); | ||
105 | } | 92 | } |
106 | 93 | ||
107 | /* | 94 | /* |