diff options
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/super.c b/fs/super.c index 95adbb3d8e58..2c3e370c60d9 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -392,6 +392,36 @@ void sync_supers(void) | |||
392 | } | 392 | } |
393 | 393 | ||
394 | /** | 394 | /** |
395 | * iterate_supers - call function for all active superblocks | ||
396 | * @f: function to call | ||
397 | * @arg: argument to pass to it | ||
398 | * | ||
399 | * Scans the superblock list and calls given function, passing it | ||
400 | * locked superblock and given argument. | ||
401 | */ | ||
402 | void iterate_supers(void (*f)(struct super_block *, void *), void *arg) | ||
403 | { | ||
404 | struct super_block *sb, *n; | ||
405 | |||
406 | spin_lock(&sb_lock); | ||
407 | list_for_each_entry_safe(sb, n, &super_blocks, s_list) { | ||
408 | if (list_empty(&sb->s_instances)) | ||
409 | continue; | ||
410 | sb->s_count++; | ||
411 | spin_unlock(&sb_lock); | ||
412 | |||
413 | down_read(&sb->s_umount); | ||
414 | if (sb->s_root) | ||
415 | f(sb, arg); | ||
416 | up_read(&sb->s_umount); | ||
417 | |||
418 | spin_lock(&sb_lock); | ||
419 | __put_super(sb); | ||
420 | } | ||
421 | spin_unlock(&sb_lock); | ||
422 | } | ||
423 | |||
424 | /** | ||
395 | * get_super - get the superblock of a device | 425 | * get_super - get the superblock of a device |
396 | * @bdev: device to get the superblock for | 426 | * @bdev: device to get the superblock for |
397 | * | 427 | * |