diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-12-10 17:05:05 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-01-25 03:13:02 -0500 |
commit | 5a9ed6f5e7b80c95b133818aa96b1fba8e1216a0 (patch) | |
tree | 8213466c061745b9c244e8bc67dab8377be7a2ac /fs/efs/super.c | |
parent | f7f4f4dd6948e3bca0e04e5217c825052ad88f5a (diff) |
efs: get rid of ->put_super()
simplifies failure exits in ->mount()...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/efs/super.c')
-rw-r--r-- | fs/efs/super.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/fs/efs/super.c b/fs/efs/super.c index c6f57a74a559..50215bbd6463 100644 --- a/fs/efs/super.c +++ b/fs/efs/super.c | |||
@@ -26,11 +26,18 @@ static struct dentry *efs_mount(struct file_system_type *fs_type, | |||
26 | return mount_bdev(fs_type, flags, dev_name, data, efs_fill_super); | 26 | return mount_bdev(fs_type, flags, dev_name, data, efs_fill_super); |
27 | } | 27 | } |
28 | 28 | ||
29 | static void efs_kill_sb(struct super_block *s) | ||
30 | { | ||
31 | struct efs_sb_info *sbi = SUPER_INFO(s); | ||
32 | kill_block_super(s); | ||
33 | kfree(sbi); | ||
34 | } | ||
35 | |||
29 | static struct file_system_type efs_fs_type = { | 36 | static struct file_system_type efs_fs_type = { |
30 | .owner = THIS_MODULE, | 37 | .owner = THIS_MODULE, |
31 | .name = "efs", | 38 | .name = "efs", |
32 | .mount = efs_mount, | 39 | .mount = efs_mount, |
33 | .kill_sb = kill_block_super, | 40 | .kill_sb = efs_kill_sb, |
34 | .fs_flags = FS_REQUIRES_DEV, | 41 | .fs_flags = FS_REQUIRES_DEV, |
35 | }; | 42 | }; |
36 | MODULE_ALIAS_FS("efs"); | 43 | MODULE_ALIAS_FS("efs"); |
@@ -105,12 +112,6 @@ static void destroy_inodecache(void) | |||
105 | kmem_cache_destroy(efs_inode_cachep); | 112 | kmem_cache_destroy(efs_inode_cachep); |
106 | } | 113 | } |
107 | 114 | ||
108 | static void efs_put_super(struct super_block *s) | ||
109 | { | ||
110 | kfree(s->s_fs_info); | ||
111 | s->s_fs_info = NULL; | ||
112 | } | ||
113 | |||
114 | static int efs_remount(struct super_block *sb, int *flags, char *data) | 115 | static int efs_remount(struct super_block *sb, int *flags, char *data) |
115 | { | 116 | { |
116 | *flags |= MS_RDONLY; | 117 | *flags |= MS_RDONLY; |
@@ -120,7 +121,6 @@ static int efs_remount(struct super_block *sb, int *flags, char *data) | |||
120 | static const struct super_operations efs_superblock_operations = { | 121 | static const struct super_operations efs_superblock_operations = { |
121 | .alloc_inode = efs_alloc_inode, | 122 | .alloc_inode = efs_alloc_inode, |
122 | .destroy_inode = efs_destroy_inode, | 123 | .destroy_inode = efs_destroy_inode, |
123 | .put_super = efs_put_super, | ||
124 | .statfs = efs_statfs, | 124 | .statfs = efs_statfs, |
125 | .remount_fs = efs_remount, | 125 | .remount_fs = efs_remount, |
126 | }; | 126 | }; |
@@ -259,7 +259,6 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) | |||
259 | struct efs_sb_info *sb; | 259 | struct efs_sb_info *sb; |
260 | struct buffer_head *bh; | 260 | struct buffer_head *bh; |
261 | struct inode *root; | 261 | struct inode *root; |
262 | int ret = -EINVAL; | ||
263 | 262 | ||
264 | sb = kzalloc(sizeof(struct efs_sb_info), GFP_KERNEL); | 263 | sb = kzalloc(sizeof(struct efs_sb_info), GFP_KERNEL); |
265 | if (!sb) | 264 | if (!sb) |
@@ -270,7 +269,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) | |||
270 | if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) { | 269 | if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) { |
271 | printk(KERN_ERR "EFS: device does not support %d byte blocks\n", | 270 | printk(KERN_ERR "EFS: device does not support %d byte blocks\n", |
272 | EFS_BLOCKSIZE); | 271 | EFS_BLOCKSIZE); |
273 | goto out_no_fs_ul; | 272 | return -EINVAL; |
274 | } | 273 | } |
275 | 274 | ||
276 | /* read the vh (volume header) block */ | 275 | /* read the vh (volume header) block */ |
@@ -278,7 +277,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) | |||
278 | 277 | ||
279 | if (!bh) { | 278 | if (!bh) { |
280 | printk(KERN_ERR "EFS: cannot read volume header\n"); | 279 | printk(KERN_ERR "EFS: cannot read volume header\n"); |
281 | goto out_no_fs_ul; | 280 | return -EINVAL; |
282 | } | 281 | } |
283 | 282 | ||
284 | /* | 283 | /* |
@@ -290,13 +289,13 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) | |||
290 | brelse(bh); | 289 | brelse(bh); |
291 | 290 | ||
292 | if (sb->fs_start == -1) { | 291 | if (sb->fs_start == -1) { |
293 | goto out_no_fs_ul; | 292 | return -EINVAL; |
294 | } | 293 | } |
295 | 294 | ||
296 | bh = sb_bread(s, sb->fs_start + EFS_SUPER); | 295 | bh = sb_bread(s, sb->fs_start + EFS_SUPER); |
297 | if (!bh) { | 296 | if (!bh) { |
298 | printk(KERN_ERR "EFS: cannot read superblock\n"); | 297 | printk(KERN_ERR "EFS: cannot read superblock\n"); |
299 | goto out_no_fs_ul; | 298 | return -EINVAL; |
300 | } | 299 | } |
301 | 300 | ||
302 | if (efs_validate_super(sb, (struct efs_super *) bh->b_data)) { | 301 | 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 | printk(KERN_WARNING "EFS: invalid superblock at block %u\n", sb->fs_start + EFS_SUPER); | 303 | printk(KERN_WARNING "EFS: invalid superblock at block %u\n", sb->fs_start + EFS_SUPER); |
305 | #endif | 304 | #endif |
306 | brelse(bh); | 305 | brelse(bh); |
307 | goto out_no_fs_ul; | 306 | return -EINVAL; |
308 | } | 307 | } |
309 | brelse(bh); | 308 | brelse(bh); |
310 | 309 | ||
@@ -319,24 +318,16 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) | |||
319 | root = efs_iget(s, EFS_ROOTINODE); | 318 | root = efs_iget(s, EFS_ROOTINODE); |
320 | if (IS_ERR(root)) { | 319 | if (IS_ERR(root)) { |
321 | printk(KERN_ERR "EFS: get root inode failed\n"); | 320 | printk(KERN_ERR "EFS: get root inode failed\n"); |
322 | ret = PTR_ERR(root); | 321 | return PTR_ERR(root); |
323 | goto out_no_fs; | ||
324 | } | 322 | } |
325 | 323 | ||
326 | s->s_root = d_make_root(root); | 324 | s->s_root = d_make_root(root); |
327 | if (!(s->s_root)) { | 325 | if (!(s->s_root)) { |
328 | printk(KERN_ERR "EFS: get root dentry failed\n"); | 326 | printk(KERN_ERR "EFS: get root dentry failed\n"); |
329 | ret = -ENOMEM; | 327 | return -ENOMEM; |
330 | goto out_no_fs; | ||
331 | } | 328 | } |
332 | 329 | ||
333 | return 0; | 330 | return 0; |
334 | |||
335 | out_no_fs_ul: | ||
336 | out_no_fs: | ||
337 | s->s_fs_info = NULL; | ||
338 | kfree(sb); | ||
339 | return ret; | ||
340 | } | 331 | } |
341 | 332 | ||
342 | static int efs_statfs(struct dentry *dentry, struct kstatfs *buf) { | 333 | static int efs_statfs(struct dentry *dentry, struct kstatfs *buf) { |