[Concept,09/21] ext4l: Add Kconfig options for optional features
Commit Message
From: Simon Glass <simon.glass@canonical.com>
Add configuration options to disable unused ext4 features:
- CONFIG_EXT4_RESIZE: Online filesystem resize
- CONFIG_EXT4_MIGRATE: Indirect/extent migration
- CONFIG_EXT4_MOVE_EXTENT: Move extent ioctl
These features are only called from ioctl.c and are not needed for
U-Boot's basic filesystem operations. They default to disabled, but
could be resurrected if another API could be provided.
Provide an inline stub for ext4_kvfree_array_rcu() when resize is
disabled, since it is called from mballoc.c and super.c
There is very little code-size impact of this change, since the code is
already eliminated by the linker.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/Kconfig | 28 ++++++++++++++++++++++++++++
fs/ext4l/Makefile | 14 +++++++++-----
fs/ext4l/ext4.h | 8 ++++++++
3 files changed, 45 insertions(+), 5 deletions(-)
@@ -49,4 +49,32 @@ config EXT4L_PRINT
Messages are always recorded and can be retrieved programmatically;
this option controls whether they are also printed.
+config EXT4_RESIZE
+ bool "Enable ext4 online resize support"
+ depends on FS_EXT4L
+ help
+ Enable support for online filesystem resize. This allows
+ growing an ext4 filesystem while it is mounted.
+
+ This adds about 10K to the image size. Not needed for U-Boot
+ in most cases. If unsure, say N.
+
+config EXT4_MIGRATE
+ bool "Enable ext4 extent migration support"
+ depends on FS_EXT4L
+ help
+ Enable support for migrating inodes between indirect block
+ mapping and extent mapping formats.
+
+ This adds about 2.5K to the image size. Not needed for U-Boot
+ in most cases. If unsure, say N.
+
+config EXT4_MOVE_EXTENT
+ bool "Enable ext4 move extent ioctl support"
+ depends on FS_EXT4L
+ help
+ Enable support for the EXT4_IOC_MOVE_EXT ioctl which moves
+ extents between files.
+
+ This adds about 1.5K to the image size. Not needed for U-Boot.
If unsure, say N.
@@ -5,10 +5,14 @@
obj-y := interface.o support.o stub.o
+# Core ext4 objects (always needed)
obj-y += balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \
extents_status.o file.o fsmap.o fsync.o hash.o ialloc.o \
- indirect.o inline.o inode.o mballoc.o migrate.o \
- mmp.o move_extent.o namei.o page-io.o readpage.o resize.o \
- super.o symlink.o xattr.o \
- xattr_hurd.o xattr_trusted.o \
- xattr_user.o fast_commit.o orphan.o
+ indirect.o inline.o inode.o mballoc.o mmp.o namei.o \
+ page-io.o readpage.o super.o symlink.o xattr.o \
+ xattr_hurd.o xattr_trusted.o xattr_user.o fast_commit.o orphan.o
+
+# Optional features
+obj-$(CONFIG_EXT4_RESIZE) += resize.o
+obj-$(CONFIG_EXT4_MIGRATE) += migrate.o
+obj-$(CONFIG_EXT4_MOVE_EXTENT) += move_extent.o
@@ -3185,7 +3185,15 @@ extern int ext4_generic_delete_entry(struct inode *dir,
extern bool ext4_empty_dir(struct inode *inode);
/* resize.c */
+#ifdef CONFIG_EXT4_RESIZE
extern void ext4_kvfree_array_rcu(void *to_free);
+#else
+static inline void ext4_kvfree_array_rcu(void *to_free)
+{
+ kvfree(to_free);
+}
+#endif
+
extern int ext4_group_add(struct super_block *sb,
struct ext4_new_group_data *input);
extern int ext4_group_extend(struct super_block *sb,