Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257305
b: refs/heads/master
c: 43e15cd
h: refs/heads/master
i:
  257303: e212595
v: v3
  • Loading branch information
Al Viro committed Jul 20, 2011
1 parent 2b024cf commit 4c63eb7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 44396f4b5cb8566f7118aec55eeac99be7ad94cb
refs/heads/master: 43e15cdbefea4ce6d68113de98d4f61c0cf45687
36 changes: 36 additions & 0 deletions trunk/fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,42 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg)
spin_unlock(&sb_lock);
}

/**
* iterate_supers_type - call function for superblocks of given type
* @type: fs type
* @f: function to call
* @arg: argument to pass to it
*
* Scans the superblock list and calls given function, passing it
* locked superblock and given argument.
*/
void iterate_supers_type(struct file_system_type *type,
void (*f)(struct super_block *, void *), void *arg)
{
struct super_block *sb, *p = NULL;

spin_lock(&sb_lock);
list_for_each_entry(sb, &type->fs_supers, s_instances) {
sb->s_count++;
spin_unlock(&sb_lock);

down_read(&sb->s_umount);
if (sb->s_root)
f(sb, arg);
up_read(&sb->s_umount);

spin_lock(&sb_lock);
if (p)
__put_super(p);
p = sb;
}
if (p)
__put_super(p);
spin_unlock(&sb_lock);
}

EXPORT_SYMBOL(iterate_supers_type);

/**
* get_super - get the superblock of a device
* @bdev: device to get the superblock for
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2432,6 +2432,8 @@ extern struct super_block *get_active_super(struct block_device *bdev);
extern struct super_block *user_get_super(dev_t);
extern void drop_super(struct super_block *sb);
extern void iterate_supers(void (*)(struct super_block *, void *), void *);
extern void iterate_supers_type(struct file_system_type *,
void (*)(struct super_block *, void *), void *);

extern int dcache_dir_open(struct inode *, struct file *);
extern int dcache_dir_close(struct inode *, struct file *);
Expand Down

0 comments on commit 4c63eb7

Please sign in to comment.