Commit 5a9ed6f5 authored by Al Viro's avatar Al Viro

efs: get rid of ->put_super()

simplifies failure exits in ->mount()...
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent f7f4f4dd
...@@ -26,11 +26,18 @@ static struct dentry *efs_mount(struct file_system_type *fs_type, ...@@ -26,11 +26,18 @@ static struct dentry *efs_mount(struct file_system_type *fs_type,
return mount_bdev(fs_type, flags, dev_name, data, efs_fill_super); return mount_bdev(fs_type, flags, dev_name, data, efs_fill_super);
} }
static void efs_kill_sb(struct super_block *s)
{
struct efs_sb_info *sbi = SUPER_INFO(s);
kill_block_super(s);
kfree(sbi);
}
static struct file_system_type efs_fs_type = { static struct file_system_type efs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "efs", .name = "efs",
.mount = efs_mount, .mount = efs_mount,
.kill_sb = kill_block_super, .kill_sb = efs_kill_sb,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };
MODULE_ALIAS_FS("efs"); MODULE_ALIAS_FS("efs");
...@@ -105,12 +112,6 @@ static void destroy_inodecache(void) ...@@ -105,12 +112,6 @@ static void destroy_inodecache(void)
kmem_cache_destroy(efs_inode_cachep); kmem_cache_destroy(efs_inode_cachep);
} }
static void efs_put_super(struct super_block *s)
{
kfree(s->s_fs_info);
s->s_fs_info = NULL;
}
static int efs_remount(struct super_block *sb, int *flags, char *data) static int efs_remount(struct super_block *sb, int *flags, char *data)
{ {
*flags |= MS_RDONLY; *flags |= MS_RDONLY;
...@@ -120,7 +121,6 @@ static int efs_remount(struct super_block *sb, int *flags, char *data) ...@@ -120,7 +121,6 @@ static int efs_remount(struct super_block *sb, int *flags, char *data)
static const struct super_operations efs_superblock_operations = { static const struct super_operations efs_superblock_operations = {
.alloc_inode = efs_alloc_inode, .alloc_inode = efs_alloc_inode,
.destroy_inode = efs_destroy_inode, .destroy_inode = efs_destroy_inode,
.put_super = efs_put_super,
.statfs = efs_statfs, .statfs = efs_statfs,
.remount_fs = efs_remount, .remount_fs = efs_remount,
}; };
...@@ -259,7 +259,6 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) ...@@ -259,7 +259,6 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
struct efs_sb_info *sb; struct efs_sb_info *sb;
struct buffer_head *bh; struct buffer_head *bh;
struct inode *root; struct inode *root;
int ret = -EINVAL;
sb = kzalloc(sizeof(struct efs_sb_info), GFP_KERNEL); sb = kzalloc(sizeof(struct efs_sb_info), GFP_KERNEL);
if (!sb) if (!sb)
...@@ -270,7 +269,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) ...@@ -270,7 +269,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) { if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) {
printk(KERN_ERR "EFS: device does not support %d byte blocks\n", printk(KERN_ERR "EFS: device does not support %d byte blocks\n",
EFS_BLOCKSIZE); EFS_BLOCKSIZE);
goto out_no_fs_ul; return -EINVAL;
} }
/* read the vh (volume header) block */ /* read the vh (volume header) block */
...@@ -278,7 +277,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) ...@@ -278,7 +277,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
if (!bh) { if (!bh) {
printk(KERN_ERR "EFS: cannot read volume header\n"); printk(KERN_ERR "EFS: cannot read volume header\n");
goto out_no_fs_ul; return -EINVAL;
} }
/* /*
...@@ -290,13 +289,13 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) ...@@ -290,13 +289,13 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
brelse(bh); brelse(bh);
if (sb->fs_start == -1) { if (sb->fs_start == -1) {
goto out_no_fs_ul; return -EINVAL;
} }
bh = sb_bread(s, sb->fs_start + EFS_SUPER); bh = sb_bread(s, sb->fs_start + EFS_SUPER);
if (!bh) { if (!bh) {
printk(KERN_ERR "EFS: cannot read superblock\n"); printk(KERN_ERR "EFS: cannot read superblock\n");
goto out_no_fs_ul; return -EINVAL;
} }
if (efs_validate_super(sb, (struct efs_super *) bh->b_data)) { if (efs_validate_super(sb, (struct efs_super *) bh->b_data)) {
...@@ -304,7 +303,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) ...@@ -304,7 +303,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
printk(KERN_WARNING "EFS: invalid superblock at block %u\n", sb->fs_start + EFS_SUPER); printk(KERN_WARNING "EFS: invalid superblock at block %u\n", sb->fs_start + EFS_SUPER);
#endif #endif
brelse(bh); brelse(bh);
goto out_no_fs_ul; return -EINVAL;
} }
brelse(bh); brelse(bh);
...@@ -319,24 +318,16 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) ...@@ -319,24 +318,16 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
root = efs_iget(s, EFS_ROOTINODE); root = efs_iget(s, EFS_ROOTINODE);
if (IS_ERR(root)) { if (IS_ERR(root)) {
printk(KERN_ERR "EFS: get root inode failed\n"); printk(KERN_ERR "EFS: get root inode failed\n");
ret = PTR_ERR(root); return PTR_ERR(root);
goto out_no_fs;
} }
s->s_root = d_make_root(root); s->s_root = d_make_root(root);
if (!(s->s_root)) { if (!(s->s_root)) {
printk(KERN_ERR "EFS: get root dentry failed\n"); printk(KERN_ERR "EFS: get root dentry failed\n");
ret = -ENOMEM; return -ENOMEM;
goto out_no_fs;
} }
return 0; return 0;
out_no_fs_ul:
out_no_fs:
s->s_fs_info = NULL;
kfree(sb);
return ret;
} }
static int efs_statfs(struct dentry *dentry, struct kstatfs *buf) { static int efs_statfs(struct dentry *dentry, struct kstatfs *buf) {
......
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