From patchwork Thu Jan 8 18:51:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1359 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=1767898396; bh=j3ggRlZfMq1yTowOzachO+l5HsOPUD+NxRn2tM+/GLA=; 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=QwUQyUHo+PxEP/4kTniwlL19DiLFx7283P+tLlUbd6D2215hqMJ2UkELcXrtAQaSu R5Ec3eQtjCbbuZ86+eOPJ7LfQOfPgViAke4xDzzX6oLGvLCIxAk+79SZ2tiQ5FsoeY Vs651eEwsUAV/yjrGRIIi9FmnPOnsgC5+IqWp+XOc4M76xDoco+0LRJ0fNnQf58Pue 7zzHBmdOiUQRT/Q+A60OtvcgL9ks0J97AXTZFOaFKI0vnrrEjYoWZIABnvzZSDqVKD LA4VyE1YvgQvpFf1P2o5Tk3VMMYGybDfiWOq3fUiEi94nJPvnsXuajif2aAdH3vy+a 63Iajkt006Lew== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B1EB2691DB for ; Thu, 8 Jan 2026 11:53:16 -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 tTKj7zgp_jGU for ; Thu, 8 Jan 2026 11:53:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898395; bh=j3ggRlZfMq1yTowOzachO+l5HsOPUD+NxRn2tM+/GLA=; 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=b9m3N9JjbHPs5Vp6VkuS64C3gmxr+d1inlMBYbsEQKFTXzJLjxk0p3FdTKDyFP1Dy XPN/Jch0X/PyK2zH58152uwZaLvR2+4QjTIT7BynvUgZFF+Kr5UxPNKgJKdWNCLXyG ynhriyP+N0lB/74Hx5fFcma0Vgk+IDAxXlgIHBgkUDMC9ToA36rSfEFFy88zZT/keh /srk35FxwMZs48SWpqflywV70HcQ9C4tnfMAGdjssbkUJNic0y3LP+gLSBd5az2JzW LkCdnv8LmhLRN9xro8gYjg3SZ9Q/G1MItJK5oeYzxMf8vupn37szu57m/zWexsz7Wf aGmb7zluF28Og== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BA68A691C8 for ; Thu, 8 Jan 2026 11:53:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898393; bh=oSFiqJzKvTvPcb84/VfAc09R0ds+jixcbpbzjBRBbJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQw44Eg8Srk5yq2SSZT4YAsCQTQnf23zheKvoDItijZSw/mk/bZ/5/awy3+2NwqbC CMkI4J/65ZJIN5RwEuqYpStF1pqMANmE19HjT90ZNpj08BH6YYXsdJo7TaPLZDAw2S XYPNgnJWPREogWXUdPV4gmEq2RudRBZoIKLZxgZZP6dKcu1ftsEtOnyQOf5OUsWe3X JB7yB81TxyGzJaZskF0g6dyxaxnieib0mS7PN82qOi0IQUnqALHf2PU9Ktckm/HtMA oYvM85xIEX7o0mZPSNQHrTUGTF5MN5+ijmVZjVUwGjjxtY5UDCgDOLmXlV5S7DT9gK lqFDShoXWo/8w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C362A69057; Thu, 8 Jan 2026 11:53:13 -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 BuwAIvPdJF-o; Thu, 8 Jan 2026 11:53:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898392; bh=MC6jp2+csG2KtO7qvYcAA8BOh+yeVyIVhpIwvPjX5cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NO+fj5rvTOnjtX5d/gtjZJBV1iTzdZwMlgl620TbVPdgpIuguCccpIZMgvvafIegH QMPPl2FRtwP5T2weTyGOi6kcA0kgHI9hq2dnkw6JTIyb/jap7OiuEBjRnhUff832kD LSRu5VRcrvtrjKk8+RtcD34lSezKlADOlu1AToo4klkWDbR6oXUZxuZOAIHqkhIrH/ KKClr+AIXx8u9cvk5DScb5m0fsZ2CKJMqvXY9ZkdB7BsXobfIRfmqL33gSPULduBXq Hl/kuUbzas3efHR1AewTB8cGPJePGanbtTy9xFzilksxJJfIx6zfUU0QEiRDKnX2lh CkY0BPEvBO6Qw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 40F3E69101; Thu, 8 Jan 2026 11:53:12 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 8 Jan 2026 11:51:33 -0700 Message-ID: <20260108185149.1995917-19-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: 7OAOCMASUSHSTTAFTDLTHIXTMTGVNNXY X-Message-ID-Hash: 7OAOCMASUSHSTTAFTDLTHIXTMTGVNNXY 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 18/21] ext4l: Exclude transaction commits from read-only builds 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 IS_ENABLED(CONFIG_EXT4_WRITE) guards to jbd2 journal code to exclude write-only functions from read-only ext4l builds. The kjournald2 thread and jbd2_journal_commit_transaction() are only needed when writing to the journal. For read-only builds, skip thread creation and checkpoint/commit operations during journal destroy. This saves approximately 4K on Thumb2 builds. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/jbd2/journal.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index f6478c6ca94..0d38f00e555 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -232,6 +232,14 @@ static int jbd2_journal_start_thread(journal_t *journal) { struct task_struct *t; + /* + * The journal thread handles asynchronous commits. For read-only + * builds, we don't need it - commits happen synchronously in + * jbd2_journal_stop() when write support is enabled. + */ + if (!IS_ENABLED(CONFIG_EXT4_WRITE)) + return 0; + t = kthread_run(kjournald2, journal, "jbd2/%s", journal->j_devname); if (IS_ERR(t)) @@ -2117,14 +2125,15 @@ int jbd2_journal_destroy(journal_t *journal) journal_kill_thread(journal); /* Force a final log commit */ - if (journal->j_running_transaction) + if (IS_ENABLED(CONFIG_EXT4_WRITE) && journal->j_running_transaction) jbd2_journal_commit_transaction(journal); /* Force any old transactions to disk */ /* Totally anal locking here... */ spin_lock(&journal->j_list_lock); - while (journal->j_checkpoint_transactions != NULL) { + while (IS_ENABLED(CONFIG_EXT4_WRITE) && + journal->j_checkpoint_transactions != NULL) { spin_unlock(&journal->j_list_lock); mutex_lock_io(&journal->j_checkpoint_mutex); err = jbd2_log_do_checkpoint(journal);