Use Ext4 driver for Ext3 and Ext2 filesystems
The ext4 filesystem driver has the ability to register as ext3 and ext2 as well, and to mount those filesystems unchanged. This is accomplished with the following kernel config option:
config EXT4_USE_FOR_EXT23 bool "Use ext4 for ext2/ext3 file systems" depends on EXT4_FS depends on EXT3_FS=n || EXT2_FS=n default y help Allow the ext4 file system driver code to be used for ext2 or ext3 file system mounts. This allows users to reduce their compiled kernel size by using one file system driver for ext2, ext3, and ext4 file systems.
(note that this is different from migrating ext3 to ext4, for example, because disk format features are not modified or migrated).
- Name: Eric Sandeen
- Email: firstname.lastname@example.org
- Targeted release: Fedora 16
- Last updated: 08/09/2011
- Percentage of completion: 100%
- Config was checked in, and no issues arose in regression testing
With this change, ext2, ext3, and ext4 will all show up in /proc/filesystems, and mount -t ext2, mount -t ext3 will work as expected. blkid will properly recognize ext2 and ext3 filesystems, and mount them as such. However, all mounts will actually be handled by the ext4 filesystem codebase.
Benefit to Fedora
This will reduce the size of the kernel, and will also reduce the amount of filesystem code which must be maintained for this Fedora release.
To change this, we simply un-configure CONFIG_EXT3_FS and CONFIG_EXT2_FS, and enable EXT4_USE_FOR_EXT23.
How To Test
By and large, this can be tested by simply using ext2 and ext3 filesystems after the change is made, and confirming that no issues arise.
Targeted testing can be done by running the xfstests test suite over ext2 and ext3 when mounted using the ext4 driver.
Sanity checking can be done via e2fsck, by using blkid to confirm that feature flags have not changed, etc.
Extra bonus points for going back to F15 or earlier, which have separate ext2 and ext3 drivers, and confirming that the filesystem is still mountable by these dedicated drivers.
Because ext2 and ext3 are not loadable modules anyway, there should be very little user-visible changes as long as things work without problems. (Were they loadable, the user would notice a lack of ext2 and ext3 in the loaded module list).
Kernel changes only.
The kernel configuration can be reverted.
- fs/ext4/Kconfig help text
- In Fedora 16, dedicated ext2 and ext3 filesystem drivers have been disabled, and the ext4 driver now handles these filesystems. This does not migrate your ext2 or ext3 filesystems, they will mount as ext2 and ext3, and they remain mountable as ext2 and ext3 by older kernels as well. By utilizing the ext4 driver for these filesystems, we have reduced kernel memory footprint and filesystem lines of code which must be maintained in Fedora, and we will be using the most up-to-date, actively developed codebase.