From patchwork Thu Jan 8 18:51:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1350 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898364; bh=Pj0SARvP7GVcTcgd6JjTEA1AwDt1++hhkkWePdNFCis=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=e55aTfHft+7F3kpGkbrl0Ora2aGxwxXGDSAl81rnRPgYS3kf/5jVIBWSYpFera9rC nRTx4HtS/QeSwjmPUEsU/UaNiq5sNTN1lJER3PV7d7vc/p2ouZN6EFmmoazTuwQSHq y4dwm/Kw5nXxFj87z/W4JRfBQPv98ycJ6uVmTt1QTQ5qvYcvcBXKs9fcZmAhwWFs4U VYR/pxQMeRgveJhVWNnoK5/UCEnbBbIg6hVxzVJWxfu34AgO9TWC1oJlWRx8P7J/6q a43xRwuAClYSpB7JVsEr6eVvPxlcqq5TUv92miuPx0P4PqYuRtMtfor0xcs4RRL76x TBaErCDzQWFRA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 91A9E691C4 for ; Thu, 8 Jan 2026 11:52:44 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7juXoj54I_uJ for ; Thu, 8 Jan 2026 11:52:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898364; bh=Pj0SARvP7GVcTcgd6JjTEA1AwDt1++hhkkWePdNFCis=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=e55aTfHft+7F3kpGkbrl0Ora2aGxwxXGDSAl81rnRPgYS3kf/5jVIBWSYpFera9rC nRTx4HtS/QeSwjmPUEsU/UaNiq5sNTN1lJER3PV7d7vc/p2ouZN6EFmmoazTuwQSHq y4dwm/Kw5nXxFj87z/W4JRfBQPv98ycJ6uVmTt1QTQ5qvYcvcBXKs9fcZmAhwWFs4U VYR/pxQMeRgveJhVWNnoK5/UCEnbBbIg6hVxzVJWxfu34AgO9TWC1oJlWRx8P7J/6q a43xRwuAClYSpB7JVsEr6eVvPxlcqq5TUv92miuPx0P4PqYuRtMtfor0xcs4RRL76x TBaErCDzQWFRA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 80988691C8 for ; Thu, 8 Jan 2026 11:52:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898362; bh=glNxx1btVbXspZQYMzs74DIUUp2uN34sqhEnwWsU6Vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ub6nSuij9PrjDZU2xsAUMPiCkeWwc9DT/SxomGthGV5Dl29Y47nBTONjdTR8HGah5 bdx+VbpfJpUrgby2Gk1N70jKE4z6vC5+HmeKnootaxYAcUQ+sr6iyx7TlXzPzWVDNZ fzBfUwna8YFDXJ8HJ+u3E/Le3tOb88GdmGxByB9cdSzq8emCl4FUdDrq8mYEz+3B+F RBTUUvtsKGFtWooT5XO9WX8Cc0tz1B7GJds01HSbMTjOYwTPJV/6OtiaUUnt63/X+e PQQHRcHxQKVIvE9F8STsiE0RU0ZIDPcb++pls3NtbBd0qcQEe93lQFBcFk8VZfCYNY GHsiBmkTHCLFg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 633C0691C4; Thu, 8 Jan 2026 11:52:42 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id ZGYlLBWAQ562; Thu, 8 Jan 2026 11:52:42 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898358; bh=jfWme1DzpLhXIolfisAhg35pgJL0aAZt+qB1mAWLpzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tSkWAawcfRxNjASHDiXoPQZXZtX2uOJwG5dTTCdfjd0E81l5GCudAEs48G1FEROey ysOx+pq9BqLHoDZ2rCtqkKWlsVXK2wfXQ8Ny5L8DPVqFIYBO8qaxLktru35Ed/TgoM nCmV5XIND+al3QUlZbes/CzfUOvB2DOvVY8KXHJ3ncmjx0qWYMnj9CHy3XIdcSCI79 1Aj1IwGbaTubdt4EuZgMZukQS/sozytFPMfOBPyyeFy2/B35m81Tx6CWiiI9UJkiiB f96rsfB+SUvW9jx6BUiGQFCAqzr8PVSWErKXX4YFUaXb7rSe2dzd+2agcRb1FgnQNi qr2rxMkTe5ufQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A102D69101; Thu, 8 Jan 2026 11:52:37 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 8 Jan 2026 11:51:24 -0700 Message-ID: <20260108185149.1995917-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108185149.1995917-1-sjg@u-boot.org> References: <20260108185149.1995917-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QX3TNJFCNKICAWOB37IHIARHCTATG2Z4 X-Message-ID-Hash: QX3TNJFCNKICAWOB37IHIARHCTATG2Z4 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/21] ext4l: Add Kconfig options for optional features List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass 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 Signed-off-by: Simon Glass --- fs/ext4l/Kconfig | 28 ++++++++++++++++++++++++++++ fs/ext4l/Makefile | 14 +++++++++----- fs/ext4l/ext4.h | 8 ++++++++ 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/fs/ext4l/Kconfig b/fs/ext4l/Kconfig index 1f1e9bdb3ed..7bb1cbe7537 100644 --- a/fs/ext4l/Kconfig +++ b/fs/ext4l/Kconfig @@ -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. diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index 7bb843c3fad..262384b6bbb 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -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 diff --git a/fs/ext4l/ext4.h b/fs/ext4l/ext4.h index 8a42d8f9bde..26795a595df 100644 --- a/fs/ext4l/ext4.h +++ b/fs/ext4l/ext4.h @@ -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,