diff options
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 5a2db612950b..30476daf966e 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3960,6 +3960,58 @@ static int ext4_get_sb(struct file_system_type *fs_type, int flags, | |||
3960 | return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt); | 3960 | return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt); |
3961 | } | 3961 | } |
3962 | 3962 | ||
3963 | #if !defined(CONTIG_EXT2_FS) && defined(CONFIG_EXT4_USE_FOR_EXT23) | ||
3964 | static struct file_system_type ext2_fs_type = { | ||
3965 | .owner = THIS_MODULE, | ||
3966 | .name = "ext2", | ||
3967 | .get_sb = ext4_get_sb, | ||
3968 | .kill_sb = kill_block_super, | ||
3969 | .fs_flags = FS_REQUIRES_DEV, | ||
3970 | }; | ||
3971 | |||
3972 | static inline void register_as_ext2(void) | ||
3973 | { | ||
3974 | int err = register_filesystem(&ext2_fs_type); | ||
3975 | if (err) | ||
3976 | printk(KERN_WARNING | ||
3977 | "EXT4-fs: Unable to register as ext2 (%d)\n", err); | ||
3978 | } | ||
3979 | |||
3980 | static inline void unregister_as_ext2(void) | ||
3981 | { | ||
3982 | unregister_filesystem(&ext2_fs_type); | ||
3983 | } | ||
3984 | #else | ||
3985 | static inline void register_as_ext2(void) { } | ||
3986 | static inline void unregister_as_ext2(void) { } | ||
3987 | #endif | ||
3988 | |||
3989 | #if !defined(CONTIG_EXT3_FS) && defined(CONFIG_EXT4_USE_FOR_EXT23) | ||
3990 | static struct file_system_type ext3_fs_type = { | ||
3991 | .owner = THIS_MODULE, | ||
3992 | .name = "ext3", | ||
3993 | .get_sb = ext4_get_sb, | ||
3994 | .kill_sb = kill_block_super, | ||
3995 | .fs_flags = FS_REQUIRES_DEV, | ||
3996 | }; | ||
3997 | |||
3998 | static inline void register_as_ext3(void) | ||
3999 | { | ||
4000 | int err = register_filesystem(&ext3_fs_type); | ||
4001 | if (err) | ||
4002 | printk(KERN_WARNING | ||
4003 | "EXT4-fs: Unable to register as ext3 (%d)\n", err); | ||
4004 | } | ||
4005 | |||
4006 | static inline void unregister_as_ext3(void) | ||
4007 | { | ||
4008 | unregister_filesystem(&ext3_fs_type); | ||
4009 | } | ||
4010 | #else | ||
4011 | static inline void register_as_ext3(void) { } | ||
4012 | static inline void unregister_as_ext3(void) { } | ||
4013 | #endif | ||
4014 | |||
3963 | static struct file_system_type ext4_fs_type = { | 4015 | static struct file_system_type ext4_fs_type = { |
3964 | .owner = THIS_MODULE, | 4016 | .owner = THIS_MODULE, |
3965 | .name = "ext4", | 4017 | .name = "ext4", |
@@ -3989,11 +4041,15 @@ static int __init init_ext4_fs(void) | |||
3989 | err = init_inodecache(); | 4041 | err = init_inodecache(); |
3990 | if (err) | 4042 | if (err) |
3991 | goto out1; | 4043 | goto out1; |
4044 | register_as_ext2(); | ||
4045 | register_as_ext3(); | ||
3992 | err = register_filesystem(&ext4_fs_type); | 4046 | err = register_filesystem(&ext4_fs_type); |
3993 | if (err) | 4047 | if (err) |
3994 | goto out; | 4048 | goto out; |
3995 | return 0; | 4049 | return 0; |
3996 | out: | 4050 | out: |
4051 | unregister_as_ext2(); | ||
4052 | unregister_as_ext3(); | ||
3997 | destroy_inodecache(); | 4053 | destroy_inodecache(); |
3998 | out1: | 4054 | out1: |
3999 | exit_ext4_xattr(); | 4055 | exit_ext4_xattr(); |
@@ -4009,6 +4065,8 @@ out4: | |||
4009 | 4065 | ||
4010 | static void __exit exit_ext4_fs(void) | 4066 | static void __exit exit_ext4_fs(void) |
4011 | { | 4067 | { |
4068 | unregister_as_ext2(); | ||
4069 | unregister_as_ext3(); | ||
4012 | unregister_filesystem(&ext4_fs_type); | 4070 | unregister_filesystem(&ext4_fs_type); |
4013 | destroy_inodecache(); | 4071 | destroy_inodecache(); |
4014 | exit_ext4_xattr(); | 4072 | exit_ext4_xattr(); |