diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-03-23 06:06:58 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-05-21 18:31:16 -0400 |
commit | 01a05b337a5b647909e1d6670f57e7202318a5fb (patch) | |
tree | 7877f08db14877d06346c8e1ef52aa17f2483e93 /fs/sync.c | |
parent | 35cf7ba0b46dc3582a01c3860b14bff122662aa3 (diff) | |
download | linux-01a05b337a5b647909e1d6670f57e7202318a5fb.tar.gz linux-01a05b337a5b647909e1d6670f57e7202318a5fb.tar.bz2 linux-01a05b337a5b647909e1d6670f57e7202318a5fb.zip |
new helper: iterate_supers()
... and switch the simple "loop over superblocks and do something"
loops to it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/sync.c')
-rw-r--r-- | fs/sync.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/fs/sync.c b/fs/sync.c index f3f0a0e1948f..d5369203f8e4 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -77,31 +77,18 @@ int sync_filesystem(struct super_block *sb) } EXPORT_SYMBOL_GPL(sync_filesystem); +static void sync_one_sb(struct super_block *sb, void *arg) +{ + if (!(sb->s_flags & MS_RDONLY) && sb->s_bdi) + __sync_filesystem(sb, *(int *)arg); +} /* * Sync all the data for all the filesystems (called by sys_sync() and * emergency sync) */ static void sync_filesystems(int wait) { - struct super_block *sb, *n; - - spin_lock(&sb_lock); - list_for_each_entry_safe(sb, n, &super_blocks, s_list) { - if (list_empty(&sb->s_instances)) - continue; - sb->s_count++; - spin_unlock(&sb_lock); - - down_read(&sb->s_umount); - if (!(sb->s_flags & MS_RDONLY) && sb->s_root && sb->s_bdi) - __sync_filesystem(sb, wait); - up_read(&sb->s_umount); - - /* restart only when sb is no longer on the list */ - spin_lock(&sb_lock); - __put_super(sb); - } - spin_unlock(&sb_lock); + iterate_supers(sync_one_sb, &wait); } /* |