source: trunk/target/linux/generic/patches-2.6.32/040-use_ext4_for_ext23.patch @ 24082

Last change on this file since 24082 was 24082, checked in by kaloz, 5 years ago

add 2.6.32 patches to use ext4 for ext2/3

File size: 3.4 KB
  • fs/ext4/Kconfig

    From 24b584240a0006ea7436cd35f5e8983eb76f1e6f Mon Sep 17 00:00:00 2001
    From: Theodore Ts'o <tytso@mit.edu>
    Date: Mon, 7 Dec 2009 14:08:51 -0500
    Subject: [PATCH] ext4: Use ext4 file system driver for ext2/ext3 file system mounts
    
    Add a new config option, CONFIG_EXT4_USE_FOR_EXT23 which if enabled,
    will cause ext4 to be used for either ext2 or ext3 file system mounts
    when ext2 or ext3 is not enabled in the configuration.
    
    This allows minimalist kernel fanatics to drop to file system drivers
    from their compiled kernel with out losing functionality.
    
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    ---
     fs/ext4/Kconfig |   10 +++++++++
     fs/ext4/super.c |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
     2 files changed, 68 insertions(+), 0 deletions(-)
    
    a b config EXT4_FS 
    2626 
    2727          If unsure, say N. 
    2828 
     29config EXT4_USE_FOR_EXT23 
     30        bool "Use ext4 for ext2/ext3 file systems" 
     31        depends on !EXT3_FS || !EXT2_FS 
     32        default y 
     33        help 
     34          Allow the ext4 file system driver code to be used for ext2 or 
     35          ext3 file system mounts.  This allows users to reduce their 
     36          compiled kernel size by using one file system driver for 
     37          ext2, ext3, and ext4 file systems. 
     38 
    2939config EXT4_FS_XATTR 
    3040        bool "Ext4 extended attributes" 
    3141        depends on EXT4_FS 
  • fs/ext4/super.c

    a b static int ext4_get_sb(struct file_syste 
    39893989        return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt); 
    39903990} 
    39913991 
     3992#if !defined(CONTIG_EXT2_FS) && defined(CONFIG_EXT4_USE_FOR_EXT23) 
     3993static struct file_system_type ext2_fs_type = { 
     3994        .owner          = THIS_MODULE, 
     3995        .name           = "ext2", 
     3996        .get_sb         = ext4_get_sb, 
     3997        .kill_sb        = kill_block_super, 
     3998        .fs_flags       = FS_REQUIRES_DEV, 
     3999}; 
     4000 
     4001static inline void register_as_ext2(void) 
     4002{ 
     4003        int err = register_filesystem(&ext2_fs_type); 
     4004        if (err) 
     4005                printk(KERN_WARNING 
     4006                       "EXT4-fs: Unable to register as ext2 (%d)\n", err); 
     4007} 
     4008 
     4009static inline void unregister_as_ext2(void) 
     4010{ 
     4011        unregister_filesystem(&ext2_fs_type); 
     4012} 
     4013#else 
     4014static inline void register_as_ext2(void) { } 
     4015static inline void unregister_as_ext2(void) { } 
     4016#endif 
     4017 
     4018#if !defined(CONTIG_EXT3_FS) && defined(CONFIG_EXT4_USE_FOR_EXT23) 
     4019static struct file_system_type ext3_fs_type = { 
     4020        .owner          = THIS_MODULE, 
     4021        .name           = "ext3", 
     4022        .get_sb         = ext4_get_sb, 
     4023        .kill_sb        = kill_block_super, 
     4024        .fs_flags       = FS_REQUIRES_DEV, 
     4025}; 
     4026 
     4027static inline void register_as_ext3(void) 
     4028{ 
     4029        int err = register_filesystem(&ext3_fs_type); 
     4030        if (err) 
     4031                printk(KERN_WARNING 
     4032                       "EXT4-fs: Unable to register as ext3 (%d)\n", err); 
     4033} 
     4034 
     4035static inline void unregister_as_ext3(void) 
     4036{ 
     4037        unregister_filesystem(&ext3_fs_type); 
     4038} 
     4039#else 
     4040static inline void register_as_ext3(void) { } 
     4041static inline void unregister_as_ext3(void) { } 
     4042#endif 
     4043 
    39924044static struct file_system_type ext4_fs_type = { 
    39934045        .owner          = THIS_MODULE, 
    39944046        .name           = "ext4", 
    static int __init init_ext4_fs(void) 
    40184070        err = init_inodecache(); 
    40194071        if (err) 
    40204072                goto out1; 
     4073        register_as_ext2(); 
     4074        register_as_ext3(); 
    40214075        err = register_filesystem(&ext4_fs_type); 
    40224076        if (err) 
    40234077                goto out; 
    40244078        return 0; 
    40254079out: 
     4080        unregister_as_ext2(); 
     4081        unregister_as_ext3(); 
    40264082        destroy_inodecache(); 
    40274083out1: 
    40284084        exit_ext4_xattr(); 
    out4: 
    40384094 
    40394095static void __exit exit_ext4_fs(void) 
    40404096{ 
     4097        unregister_as_ext2(); 
     4098        unregister_as_ext3(); 
    40414099        unregister_filesystem(&ext4_fs_type); 
    40424100        destroy_inodecache(); 
    40434101        exit_ext4_xattr(); 
Note: See TracBrowser for help on using the repository browser.