Commit dcb1bcb7 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (1/4) ->kill_sb() switchover

New method - ->kill_sb().  It will eventually replace current
fs/super.c::shutdown_super() - i.e. it's called when fs driver
must shut the superblock down, remove it from all lists, etc.
parent 2db7312d
...@@ -459,7 +459,10 @@ void kill_super(struct super_block *sb) ...@@ -459,7 +459,10 @@ void kill_super(struct super_block *sb)
return; return;
down_write(&sb->s_umount); down_write(&sb->s_umount);
shutdown_super(sb); if (fs->kill_sb)
fs->kill_sb(sb);
else
shutdown_super(sb);
put_filesystem(fs); put_filesystem(fs);
} }
...@@ -682,6 +685,22 @@ struct super_block *get_anon_super(struct file_system_type *type, ...@@ -682,6 +685,22 @@ struct super_block *get_anon_super(struct file_system_type *type,
insert_super(s, type); insert_super(s, type);
return s; return s;
} }
void kill_anon_super(struct super_block *sb)
{
int slot = minor(sb->s_dev);
generic_shutdown_super(sb);
spin_lock(&unnamed_dev_lock);
clear_bit(slot, unnamed_dev_in_use);
spin_unlock(&unnamed_dev_lock);
}
void kill_litter_super(struct super_block *sb)
{
if (sb->s_root)
d_genocide(sb->s_root);
kill_anon_super(sb);
}
struct super_block *get_sb_bdev(struct file_system_type *fs_type, struct super_block *get_sb_bdev(struct file_system_type *fs_type,
int flags, char *dev_name, void * data, int flags, char *dev_name, void * data,
...@@ -783,6 +802,14 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type, ...@@ -783,6 +802,14 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
return ERR_PTR(error); return ERR_PTR(error);
} }
void kill_block_super(struct super_block *sb)
{
struct block_device *bdev = sb->s_bdev;
generic_shutdown_super(sb);
bd_release(bdev);
blkdev_put(bdev, BDEV_FS);
}
struct super_block *get_sb_nodev(struct file_system_type *fs_type, struct super_block *get_sb_nodev(struct file_system_type *fs_type,
int flags, void *data, int flags, void *data,
int (*fill_super)(struct super_block *, void *, int)) int (*fill_super)(struct super_block *, void *, int))
......
...@@ -944,6 +944,7 @@ struct file_system_type { ...@@ -944,6 +944,7 @@ struct file_system_type {
const char *name; const char *name;
int fs_flags; int fs_flags;
struct super_block *(*get_sb) (struct file_system_type *, int, char *, void *); struct super_block *(*get_sb) (struct file_system_type *, int, char *, void *);
void (*kill_sb) (struct super_block *);
struct module *owner; struct module *owner;
struct file_system_type * next; struct file_system_type * next;
struct list_head fs_supers; struct list_head fs_supers;
...@@ -958,6 +959,9 @@ struct super_block *get_sb_single(struct file_system_type *fs_type, ...@@ -958,6 +959,9 @@ struct super_block *get_sb_single(struct file_system_type *fs_type,
struct super_block *get_sb_nodev(struct file_system_type *fs_type, struct super_block *get_sb_nodev(struct file_system_type *fs_type,
int flags, void *data, int flags, void *data,
int (*fill_super)(struct super_block *, void *, int)); int (*fill_super)(struct super_block *, void *, int));
void kill_block_super(struct super_block *sb);
void kill_anon_super(struct super_block *sb);
void kill_litter_super(struct super_block *sb);
/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ /* Alas, no aliases. Too much hassle with bringing module.h everywhere */
#define fops_get(fops) \ #define fops_get(fops) \
......
...@@ -286,8 +286,11 @@ EXPORT_SYMBOL(dcache_readdir); ...@@ -286,8 +286,11 @@ EXPORT_SYMBOL(dcache_readdir);
EXPORT_SYMBOL(fd_install); EXPORT_SYMBOL(fd_install);
EXPORT_SYMBOL(put_unused_fd); EXPORT_SYMBOL(put_unused_fd);
EXPORT_SYMBOL(get_sb_bdev); EXPORT_SYMBOL(get_sb_bdev);
EXPORT_SYMBOL(kill_block_super);
EXPORT_SYMBOL(get_sb_nodev); EXPORT_SYMBOL(get_sb_nodev);
EXPORT_SYMBOL(get_sb_single); EXPORT_SYMBOL(get_sb_single);
EXPORT_SYMBOL(kill_anon_super);
EXPORT_SYMBOL(kill_litter_super);
/* for stackable file systems (lofs, wrapfs, cryptfs, etc.) */ /* for stackable file systems (lofs, wrapfs, cryptfs, etc.) */
EXPORT_SYMBOL(default_llseek); EXPORT_SYMBOL(default_llseek);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment