From patchwork Thu Jan 8 18:51:23 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1349 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=1767898360; bh=a+R7Hk2agpSTSsFN6l9Oj3Grkt4eW0+hHu24JVnAlOI=; 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=AoRWXHuMR4+K+U0hPII5EmsqY0GE3spSz2/c2zllPqjMJPrCkOqHrYSMjZ807/6GB f7fruqKkvvx9qe0V9kt6YcFEbcTwg7EtytWMwyuoCQ0HboWkKdy3nLRlStcg9y0ucC CkxibQWelKN8wohE2l52QYCvCrHnqOYJKoHY7qzz7SYZntZqypSQOIq6l/EiOQpAqM EOfnTpzW9vpOQUlptLhPFL5f76ImeB39j0J5/QtvTBokCkr0jPsUklCyTbYqrqTzPn 5IxwG8cBeOzRN+LX/KVlAcYPqfLpKMrBOR1AG2gIviYJK9I3hK6EFSS+Zr7MWoJofb R/pHkhh88MYag== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2BF0C691DC for ; Thu, 8 Jan 2026 11:52:40 -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 4mtilcIic-X8 for ; Thu, 8 Jan 2026 11:52:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898359; bh=a+R7Hk2agpSTSsFN6l9Oj3Grkt4eW0+hHu24JVnAlOI=; 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=fys7TmdnublCX//MmGEhEsivqGRq9cOwO/LCNgQvRY2F9TZhvjtJKILNbdm+JPQez BVIoGzpq3SPYBjjDnVxMF7UjgQiziXtj12olR3qYqj9kLIJSPJwwbRUT/RVvEM8d1e M/H2q4Cb3sKodyfpugoIl4rIBZZAlOoC3PuWpsItFLY7vOJWYr7IAsGfSTlzrdedkY qm8Mm1ThQM86BTB0G2c/05TjQU2NhEkunY8ap4zUKLxQpUFrpNcd+XlZDmLmeGPGUE m0saE0+Mdhl5taiMsbi+arcQhDH4VzSHIITAZJvfDGkiOe4jXLsnG/1tE4fZuogB7T 35J0JTRmIu/8Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 15312691C8 for ; Thu, 8 Jan 2026 11:52:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898357; bh=bbA39X4WmtAtuUClqC/H/HuxSQsh/Q40uvXnH9lh7Ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ngTqLhSj9+W2XeFMd7hKoazy1tek2O5oPSqISCJvyMuxit8gG+4XA3jwEANR8/Qrj Yuf4gu7ZmjqOAo9V28ucqoPqrKCxydeOxUFGe6GnfQ82eLkTBiHEYQ9uIrDoJiDO1W dMR7Di8RYbv3xSURr3LA1/ULXUjFgkQq8ZuRERiix+voPtGtqiAwWyNdT6/6He9S3T SENbMk5JxGN5+BsZyJ73IQpjZ8w0ClfYkjZxPQQToBz5NtpydP/YAlo2fq8jd31zOu g2yGQgodaKuZkhOCza0KIMWuxwscyz7Ev7mpc/2gnXDUd5uAhvPGUvAdYaKxaY1hEF W4PDoTU+a3tEw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5F0A3691C4; Thu, 8 Jan 2026 11:52:37 -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 BOyi5xCQ0FS6; Thu, 8 Jan 2026 11:52:37 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898357; bh=sprIlTKBmpF6a/K6D14rkSZZiCM/s+AVv2AHtk2rdxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oAROT9dO0I6Il/dAYAy3TThNVpywB+8G8kR7DyqfLaq9y0Hlw9TnyhiQ8A9QS5nlF Sz11bBRUKUxQ8pDYwE+iJjB+63zExf0e9cOU79ZUYFZ498Xwvjf8KdNCLkpUG3dBl5 seLKLnm/EarJdT/2zNZBjILLIAg+Us1hkre+AhMMDz/rY8kN3lf2KAQNsXPVYLcdeN Cdvmw9yyMcKETa4Qlxaek/reRH3GaSrT5aGH3FvaSNrbbLqtWQw3SQ019eYWAwoiWj j5LYqvy+GluA8wEAS0x4zMZx9Z+JEbgzR3Brs2vm1Jr/bURPe/dca6I+j6QeCA0NYC j6fEqruVX1A0Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B98D569101; Thu, 8 Jan 2026 11:52:36 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 8 Jan 2026 11:51:23 -0700 Message-ID: <20260108185149.1995917-9-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: ZZ5XEJCTDQ4RET7X6Q5SIWWOCUVAT3ND X-Message-ID-Hash: ZZ5XEJCTDQ4RET7X6Q5SIWWOCUVAT3ND 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 08/21] ext4l: Tie verbose messages to CONFIG_EXT4L_DEBUG 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 The ext4 code contains many detailed error messages that consume about 20K of rodata. These messages are helpful for debugging mount failures but not essential for normal operation. Use CONFIG_EXT4L_DEBUG directly in ext4.h so that when debug is disabled, the message macros (ext4_msg, ext4_error, ext4_warning, etc.) use generic empty strings instead of detailed format strings. This allows the compiler to eliminate the string literals from rodata. Add a separate CONFIG_EXT4L_PRINT option to control whether messages are printed to the console. Messages are always recorded internally for programmatic access; this option only affects console output. Mount failures are still reported, but without specific details about what went wrong. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Kconfig | 18 +++++++++++++++++- fs/ext4l/ext4.h | 6 +++++- fs/ext4l/ext4_uboot.h | 10 ---------- fs/ext4l/super.c | 4 ++-- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/fs/ext4l/Kconfig b/fs/ext4l/Kconfig index be989208ec5..1f1e9bdb3ed 100644 --- a/fs/ext4l/Kconfig +++ b/fs/ext4l/Kconfig @@ -29,8 +29,24 @@ config EXT4_JOURNAL config EXT4L_DEBUG bool "Enable ext4l debug messages" depends on FS_EXT4L + default y if SANDBOX help Enable debug and informational messages from the ext4l filesystem. - This includes mount messages and other ext4_msg() output. + This includes mount messages, error details, and other ext4_msg() + output with full format strings. + + Disabling this option replaces detailed error messages with generic + strings, saving about 20K of rodata. Mount failures will still be + reported but without specific details about what went wrong. + + If unsure, say N. + +config EXT4L_PRINT + bool "Print ext4l messages to console" + depends on EXT4L_DEBUG + help + Print ext4l messages to the console in addition to recording them. + Messages are always recorded and can be retrieved programmatically; + this option controls whether they are also printed. If unsure, say N. diff --git a/fs/ext4l/ext4.h b/fs/ext4l/ext4.h index 34dbc4f12b8..8a42d8f9bde 100644 --- a/fs/ext4l/ext4.h +++ b/fs/ext4l/ext4.h @@ -3266,7 +3266,11 @@ void __ext4_grp_locked_error(const char *, unsigned int, #define ext4_abort(sb, err, fmt, a...) \ __ext4_error((sb), __func__, __LINE__, true, (err), 0, (fmt), ## a) -#ifdef EXT4L_PRINTF +/* + * When CONFIG_EXT4L_DEBUG is enabled, pass full messages through the error + * macros. When disabled, use empty strings to save rodata space. + */ +#ifdef CONFIG_EXT4L_DEBUG #define ext4_error_inode(inode, func, line, block, fmt, ...) \ __ext4_error_inode(inode, func, line, block, 0, fmt, ##__VA_ARGS__) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 21caecc2ada..a34f5d74dfa 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -40,16 +40,6 @@ #include /* Real rbtree implementation */ #include /* For crc32() used by crc32_be */ -/* - * Enable ext4_msg() and other diagnostic macros to pass full messages. - * This is required for message recording to work. Without this, the - * ext4_msg macro passes empty strings to __ext4_msg(). - * - * Use EXT4L_PRINTF instead of CONFIG_PRINTK since U-Boot requires CONFIG_ - * options to be defined in Kconfig. - */ -#define EXT4L_PRINTF 1 - /* * __CHAR_UNSIGNED__ - directory hash algorithm selection * diff --git a/fs/ext4l/super.c b/fs/ext4l/super.c index 48c87eb0e97..b2c95118220 100644 --- a/fs/ext4l/super.c +++ b/fs/ext4l/super.c @@ -971,8 +971,8 @@ void __ext4_msg(struct super_block *sb, /* Record in message buffer */ ext4l_record_msg(buf, len); - /* Also print if debug is enabled */ - if (IS_ENABLED(CONFIG_EXT4L_DEBUG)) + /* Also print if requested */ + if (IS_ENABLED(CONFIG_EXT4L_PRINT)) printf("%s", buf); }