From patchwork Thu Jan 8 18:51:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1360 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=1767898401; bh=2ooNLPjDtVYA6vlbSNg+TWhJuDQ+dIxXhdSYdIbnw/w=; 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=uFbxuc/Lj8jlyg/221PHcRU7IfubSzJJUBByQ296MmS3HeyREnbTPTCdK6ujSKsQ7 LacF0pvttn0jWzADO0yv57AkXKsA8G03pmVFw7eCW01K6DjN//ceXMke2i7UY8eCFp tHJgc6k3VIe8mq2ck5J/ANk5QEq9C+CmtljynlShezbsmBR8OH2UBADm852yy4o6+7 hSL+ptwz/vHA1Cq8bqA7CZMEiGR34Zg+SRjZgbdFW6YW9mRAouo6vf5trT8QMpnT8k bcwsj/9yOrKYBM7I1tQQpCp4TUyw6SQ6bGPIZgPUSmgI9zG5C43TsYU8cz5QNtulil On94rWfkla8xQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4898B691C4 for ; Thu, 8 Jan 2026 11:53:21 -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 085YWzGFZayz for ; Thu, 8 Jan 2026 11:53:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898401; bh=2ooNLPjDtVYA6vlbSNg+TWhJuDQ+dIxXhdSYdIbnw/w=; 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=uFbxuc/Lj8jlyg/221PHcRU7IfubSzJJUBByQ296MmS3HeyREnbTPTCdK6ujSKsQ7 LacF0pvttn0jWzADO0yv57AkXKsA8G03pmVFw7eCW01K6DjN//ceXMke2i7UY8eCFp tHJgc6k3VIe8mq2ck5J/ANk5QEq9C+CmtljynlShezbsmBR8OH2UBADm852yy4o6+7 hSL+ptwz/vHA1Cq8bqA7CZMEiGR34Zg+SRjZgbdFW6YW9mRAouo6vf5trT8QMpnT8k bcwsj/9yOrKYBM7I1tQQpCp4TUyw6SQ6bGPIZgPUSmgI9zG5C43TsYU8cz5QNtulil On94rWfkla8xQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 36F1169101 for ; Thu, 8 Jan 2026 11:53:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898399; bh=aGNvsKDB5fcYxIcQ4urL0NXpk32AQ6kMgQaTxLspGiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vq3+puJnUODrtWwnE8xj5f1DTIp8WRfYFZ7DenEws/55PsXVEL19xJjGPntgfSN+Y AD6N3wo4NvppaQN+efu9qg6pimyR3ak02zSTs5AP4EJOqf2hDbPzW24qLjs6G/8V5p U8/GjbE1qrfgbcJynb1wKDmJAgFGSeT6q6vLySNPXNx230GNnDtKuEjzFuBOWOoP7t VmslijxizWJEx+7c0MeWEpNb644mSm3mKsk8z/B1mPVz+4y++Lt7zRIXiJXTpsBAMn RvjDsun3pzqA6Qir9OIBBINLbWm3KqFRenclHJNe7OQYbvy4vCp3NcFAtbnT23WNGt zCa55QtQ4j+mQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0AE51691C4; Thu, 8 Jan 2026 11:53:19 -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 Zzzc__ViMDMw; Thu, 8 Jan 2026 11:53:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898394; bh=+UbRosPFpqfaQdYKhE7zsT/YOBkFtn5YVTumRvYAsrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WfwlsdtCUkSUap9fH5UthpqjRDTdR1eWI3WKjpN78R+6mwf0rDPsEppe6VwMgD1P5 A7cZv9uyNMH9CxcvZxN07Ft3LEpSwhKNc3vgw1wCRsBcLs6Rza4QjFdHNuo4YaCBF1 h0/u9hIjTNt4PSl0i3Uc1fEsY4nUyByL/4PkyLvXQoPX1sCVumPVVIJf4z89AJI72g Z9xY5uITL4Ik98sz5H11E0UcBXtHu3DqkbAu+RooB0oGiK1mA/z5pdEZ0NRU5Jt22z 1g3g1p4mjxhy1aIEt6x75GP32Kojtw9B/cfj4C4em8dnulgEE4FBnh15qzJ2ktk/3i AoD55rQFojKRg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 134FE69101; Thu, 8 Jan 2026 11:53:14 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 8 Jan 2026 11:51:34 -0700 Message-ID: <20260108185149.1995917-20-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: QOBJRACC267MOFMLSMYWXETI4U23Q6FE X-Message-ID-Hash: QOBJRACC267MOFMLSMYWXETI4U23Q6FE 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 19/21] ext4l: Skip the journal flush in 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_flush() and __jbd2_log_wait_for_space() to skip these operations in read-only builds. Journal flushing writes pending transactions to disk, which is not needed when the filesystem is mounted read-only. Similarly, waiting for journal space is only relevant when allocating space for new transactions. This eliminates jbd2_log_do_checkpoint() and saves approximately 1K on Thumb2 builds. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/jbd2/checkpoint.c | 4 ++++ fs/jbd2/journal.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index 994e454bb5b..5b794df3384 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c @@ -48,6 +48,10 @@ __releases(&journal->j_state_lock) int nblocks, space_left; /* assert_spin_locked(&journal->j_state_lock); */ + /* Only needed for write operations */ + if (!IS_ENABLED(CONFIG_EXT4_WRITE)) + return; + nblocks = journal->j_max_transaction_buffers; while (jbd2_log_space_left(journal) < nblocks) { write_unlock(&journal->j_state_lock); diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 0d38f00e555..e5bc62ba337 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -2409,6 +2409,10 @@ int jbd2_journal_flush(journal_t *journal, unsigned int flags) int err = 0; transaction_t *transaction = NULL; + /* Nothing to flush in read-only builds */ + if (!IS_ENABLED(CONFIG_EXT4_WRITE)) + return 0; + write_lock(&journal->j_state_lock); /* Force everything buffered to the log... */