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

[PATCH] (3/3) fs/super.c cleanups

Preparation to adding new method:
 new helper - shutdown_super().  It is cut from kill_super() and
 it had absorbed all actions done with superblock contents -
 now kill_super(s) is simply

	struct file_system_type *fs = s->s_type;
	if (!deactivate_super(s))
		return;
		shutdown_super(s);
	put_filesystem(fs);

 and shutdown_super() is going to become a method.
parent 859041ac
...@@ -400,6 +400,68 @@ static void remove_super(struct super_block *s) ...@@ -400,6 +400,68 @@ static void remove_super(struct super_block *s)
put_super(s); put_super(s);
} }
static void generic_shutdown_super(struct super_block *sb)
{
struct dentry *root = sb->s_root;
struct super_operations *sop = sb->s_op;
if (root) {
sb->s_root = NULL;
shrink_dcache_parent(root);
dput(root);
fsync_super(sb);
lock_super(sb);
lock_kernel();
sb->s_flags &= ~MS_ACTIVE;
/* bad name - it should be evict_inodes() */
invalidate_inodes(sb);
if (sop) {
if (sop->write_super && sb->s_dirt)
sop->write_super(sb);
if (sop->put_super)
sop->put_super(sb);
}
/* Forget any remaining inodes */
if (invalidate_inodes(sb)) {
printk("VFS: Busy inodes after unmount. "
"Self-destruct in 5 seconds. Have a nice day...\n");
}
unlock_kernel();
unlock_super(sb);
}
remove_super(sb);
}
static void shutdown_super(struct super_block *sb)
{
struct file_system_type *fs = sb->s_type;
kdev_t dev = sb->s_dev;
struct block_device *bdev = sb->s_bdev;
/* Need to clean after the sucker */
if (fs->fs_flags & FS_LITTER && sb->s_root)
d_genocide(sb->s_root);
generic_shutdown_super(sb);
if (bdev)
blkdev_put(bdev, BDEV_FS);
else
put_anon_dev(dev);
}
void kill_super(struct super_block *sb)
{
struct file_system_type *fs = sb->s_type;
if (!deactivate_super(sb))
return;
down_write(&sb->s_umount);
shutdown_super(sb);
put_filesystem(fs);
}
struct vfsmount *alloc_vfsmnt(char *name); struct vfsmount *alloc_vfsmnt(char *name);
void free_vfsmnt(struct vfsmount *mnt); void free_vfsmnt(struct vfsmount *mnt);
...@@ -808,55 +870,6 @@ do_kern_mount(const char *fstype, int flags, char *name, void *data) ...@@ -808,55 +870,6 @@ do_kern_mount(const char *fstype, int flags, char *name, void *data)
return (struct vfsmount *)sb; return (struct vfsmount *)sb;
} }
void kill_super(struct super_block *sb)
{
struct dentry *root = sb->s_root;
struct file_system_type *fs = sb->s_type;
struct super_operations *sop = sb->s_op;
kdev_t dev = sb->s_dev;
struct block_device *bdev = sb->s_bdev;
if (!deactivate_super(sb))
return;
down_write(&sb->s_umount);
if (sb->s_root) {
sb->s_root = NULL;
/* Need to clean after the sucker */
if (fs->fs_flags & FS_LITTER)
d_genocide(root);
shrink_dcache_parent(root);
dput(root);
fsync_super(sb);
lock_super(sb);
lock_kernel();
sb->s_flags &= ~MS_ACTIVE;
/* bad name - it should be evict_inodes() */
invalidate_inodes(sb);
if (sop) {
if (sop->write_super && sb->s_dirt)
sop->write_super(sb);
if (sop->put_super)
sop->put_super(sb);
}
/* Forget any remaining inodes */
if (invalidate_inodes(sb)) {
printk("VFS: Busy inodes after unmount. "
"Self-destruct in 5 seconds. Have a nice day...\n");
}
unlock_kernel();
unlock_super(sb);
}
remove_super(sb);
if (bdev)
blkdev_put(bdev, BDEV_FS);
else
put_anon_dev(dev);
put_filesystem(fs);
}
struct vfsmount *kern_mount(struct file_system_type *type) struct vfsmount *kern_mount(struct file_system_type *type)
{ {
return do_kern_mount(type->name, 0, (char *)type->name, NULL); return do_kern_mount(type->name, 0, (char *)type->name, NULL);
......
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