From patchwork Tue Dec 30 20:51:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1110 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=1767127942; bh=Pm7RtlnWIma/TBimBjMb8YaCCYNkfadT+It+sEpUkyc=; 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=sv+qumf0UXxgV9SBl7Z2Ln3GXWPYACOkUvbuZs1HlmNgTteVtZGuQkA3x4iLHR+R8 nUJZJtWZBJCzxDmPO3PbXBiW4ttV1n/fbnM0qdwiBhWXUkxs6P9jI/ZKY1G9sgLr6/ H4l2fXIipyTwlQZFf+lwMs00Tx9eEzGoiyb39b00fjYtlwZ9KzjzfyN8mxRgEdd4v4 +gqe650pRXGJ9xEhkTNXMcC1ijaLZuiwVg2TXTlWtn/PKFrbWUJO1e42W6jyFYqkSs tf6mn5p5opnuB1XTZ4tankwp9qRE+VlBsKiVN6P2QYWIs6WCSWMcWuwR/g9dL/qogO Xbt5X8WGTA+HA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 69C0668F88 for ; Tue, 30 Dec 2025 13:52:22 -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 gD0VlBB_KMEc for ; Tue, 30 Dec 2025 13:52:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127940; bh=Pm7RtlnWIma/TBimBjMb8YaCCYNkfadT+It+sEpUkyc=; 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=kLoERdeoWwpO9GXHSdK8J7dpEB2PrJSTDVmUjiHgcnB5OeRqUbno6NXtAWDjfTgCQ YXt7LmroCSfGS6CfrN7HgJW4u2Q4Ud4T7ncXm8qs721MfN9o3RmFmfwTnB4JzfHgwg VUXTk7C1DN2OdVz/R+MXtM2j01rESC2bPeu9yXTJHATJkOddGQmVGc0kycxQu1Th6h qCiLEntYQG+pQf7ZWS1wanjQd+T1tY1mRKfioB1Ccm/qaeDUXcUf9j5d3mmzc5vRqh 0U8LbIDRwPRgOnbyg6sNEeIOd/P1qie+tuMCe+voZZ4AODDTdc7lVRlbF5lMY76Ez2 EsP9xxVC1XQsg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 61DE368C0D for ; Tue, 30 Dec 2025 13:52:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127938; bh=8nOsVMdX8T1mapHbE/0WrYcErFqCrDlTiwnPi7kURsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YYs30wQZ0SSf0NgzwuVovPPwltZJrVgVp+ZAHypJ4RQz2fsOv+Nr/yZT0EMFCKBA/ Y6DGZIAlj0KbOK4Su6I0O4/bzA8Ju3DZopfSr4J2aAuobL8DM8/OgCH2H3bR6YTCjz a5/IXJRNyA1mGC4ZWCMOLSDcDgsE6I0gMazyEglMKwfYwmSXPQU+7QJG9I3S6hNlvs xclY4BTkVfq8bWSsnZ0Vd2F9imdjYoQ8Q31pOzOhgmckE1PkvkyB5a4EP1aExx/lY3 WaEOVBGb5Dtk8DuO4BigDK1Z4Ny+A0hJgkyZCCiCjkgjqoFXg/kcx0RzlRwrdx5rkQ hTE8sHwl6TQuw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 45D9068F73; Tue, 30 Dec 2025 13:52:18 -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 PkD9uEIsfpYD; Tue, 30 Dec 2025 13:52:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127937; bh=cSoIfSmBtO+SvZq7NoznbVZwG2EarEZQNtDbcbLPAmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UxUi+LdRxRkBck3h6VVChXs0ehiyeqefdvzVDsEsj9NmUfh6NX0VO5JBh9CizG/vv uAGak9CbrYPFVRpNQVBViDys0AqKtZkYmlhhie2lbD0sJ+NFcMMFyqnwF0HinfSfy7 7St3o8KSHYJk93PZdqnvvg3baWva08neFCPK7kkqh5qUUw0t5f9AiJYfBBTUJW3t+Q b4afExnW+rE2jIfc3rmyTJ8Klp40DOwlMN9jG7V+qaaukmdYTcR118+SKSz/KJy94Y vJw+MW4cWvz/Gfgj31da4OE73cd9A6PCVbj5aSCBHHDgCrYTLoj7sqz1c+vRV7dsNx jiZeg/3SFZCCQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A725464C8A; Tue, 30 Dec 2025 13:52:17 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:38 -0700 Message-ID: <20251230205157.3383926-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TCF5NDE7JXOYTLX5YRW5OLB3BKDEM3RC X-Message-ID-Hash: TCF5NDE7JXOYTLX5YRW5OLB3BKDEM3RC 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: Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/14] linux: ext4l: Fix REQ_OP and BH_OwnsData bit positions 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 REQ_OP flags (REQ_SYNC, REQ_FUA) use bits 0-1, which collide with REQ_OP_WRITE (value 1). Move the flags to bits 8+ and add REQ_OP_MASK to properly separate operation from flags. Move BH_OwnsData from buffer_head.h to ext4_uboot.h to keep Linux headers unmodified. Define it as BH_JBDPrivateStart to avoid conflicts with JBD2 state bits (17-25). Co-developed-by: Claude Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 17 +++++++++++++---- fs/ext4l/support.c | 2 +- include/linux/buffer_head.h | 2 -- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index a90289c8fa5..39bade68654 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -515,8 +515,14 @@ struct sb_writers { /* Buffer head - from linux/buffer_head.h */ #include +#include -/* BH_JBDPrivateStart is defined in jbd2.h as an enum value */ +/* + * U-Boot: marks buffer owns b_data and should free it. + * Use BH_JBDPrivateStart to avoid conflicts with JBD2 state bits. + */ +#define BH_OwnsData BH_JBDPrivateStart +BUFFER_FNS(OwnsData, ownsdata) /* Forward declare for get_block_t */ struct inode; @@ -2153,10 +2159,13 @@ struct fs_parse_result { #define BLK_OPEN_WRITE (1 << 1) #define BLK_OPEN_RESTRICT_WRITES (1 << 2) -/* Request flags */ +/* Request operation (bits 0-7) and flags (bits 8+) */ #define REQ_OP_WRITE 1 -#define REQ_SYNC (1 << 0) -#define REQ_FUA (1 << 1) +#define REQ_OP_MASK 0xff + +/* ensure these values are outside the operations mask */ +#define REQ_SYNC (1 << 8) +#define REQ_FUA (1 << 9) /* blk_holder_ops for block device */ struct blk_holder_ops { diff --git a/fs/ext4l/support.c b/fs/ext4l/support.c index 05efa8d067c..a046654ca54 100644 --- a/fs/ext4l/support.c +++ b/fs/ext4l/support.c @@ -565,7 +565,7 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, int submit_bh(int op, struct buffer_head *bh) { int ret; - int op_type = op & 0xff; /* Mask out flags, keep operation type */ + int op_type = op & REQ_OP_MASK; /* Mask out flags, keep operation type */ if (op_type == REQ_OP_READ) { ret = ext4l_read_block(bh->b_blocknr, bh->b_size, bh->b_data); diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 5fbcc757c80..b22df564119 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -37,8 +37,6 @@ enum bh_state_bits { BH_PrivateStart,/* not a state bit, but the first bit available * for private allocation by other entities */ - /* U-Boot specific: marks buffer owns b_data and should free it */ - BH_OwnsData = BH_PrivateStart, }; #define MAX_BUF_PER_PAGE (PAGE_SIZE / 512) From patchwork Tue Dec 30 20:51:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1111 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=1767127942; bh=acbwvY78xnMqg9LdR9AvlvHH5l/cK7jaK5vcsayQbBU=; 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=ptx1cy3/Ew3e1b/ijZOkgW6EaglGA8Fy6VlXQ529URyi1I953MBPNSUGbi2mJQZjq X+JWmTOdxO83fV4ApCKquVe+9bCPRWw/jjVSyrj+VZDIJbXc14NAxiPlg6Bz2tTtEf sd6k5GRlfSCQMQEOH7RrxzNfG8JbASu7aNRp8gP8fxTOwxO6+8LvN71E4tbxnGGYyV mMJ8jlhtgrlL0YUflNb9LHXW/ex7v6/EopSGiO/2MB61U4OSluKXl46a5pFW9ZqZLA 9uUTQ7SvpDnO9+OkVFtTt4LUBb8sdJgUsM25BGdhnlmGUFDOZYoh3Nrwauyv58FMJo P+sxNHzxjWuug== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ABD5C68F80 for ; Tue, 30 Dec 2025 13:52:22 -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 cBAGIzVhEnBU for ; Tue, 30 Dec 2025 13:52:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127941; bh=acbwvY78xnMqg9LdR9AvlvHH5l/cK7jaK5vcsayQbBU=; 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=chcasN+j7AV3Wheeo3FM/9rnl8lquXmYlqQbHWOSCUt8VTD/h9wB/TDMPg6jRp7jP eT/HzHmTLoUE6XzGNno6yMKMSLZ62LlG3eI05NiGAfZUOUFXgedkeK7EokrmgABy0K cKlNFNLIEAceB1FP1N5UDN3UCbU2B1dho3PfxV5/Rn1jtZC0Fz4NyL+VLDq/5ghl57 UuQVUiwzoheHcakTgTii3DGlTYaK2MpZ7bbXcAwn+mYEExZ/gMpsw77oxvmJXEBGNf s7PV3Y7J/KcrV840KC942IysC9aKo4R13bCC3vLC04cIh2TBMH+I/kMJNb58AhnJxA Zckglv1sEzSlA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0CE4168F86 for ; Tue, 30 Dec 2025 13:52:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127939; bh=Qqrh0nQjhhiNMZ/1sg86fMRb7rJAT6GMriEhNuYECmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m//P8nY9p2713AE4ZkW3cSpIaU/Mh+oIyaUram4AcThzcbRlT9fH7tUgwPoVbpWtj M5M6zEh4MxxkpV8JTs2CoroWWtGW5iRObBoZ9uiyTptA3FbFHBilO0Movat5x5oOlT cbscy+CRCfP+F3fnw115S6A/woxmgrJcdFtuMiAuZ2il0GuKF78hLG+NPHHcEjVBcc 161SMIZPGn1cPf8tjVCYLUMPFI4z1sRMO3vwbbP/f514yttEyB0E6kLgWCZGVz8EkM o5ZvPHP3/mkwxjaTOQoYbQ29UZgiBk5TyKRnlHev6fxiTUG3ZV7aZoR9vK3KvAG47N ZLbeazvmH70sg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0EF7368F73; Tue, 30 Dec 2025 13:52: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 iGMXe1256MmF; Tue, 30 Dec 2025 13:52:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127938; bh=6BOvmK+I76n7zEbZAUjsEgE1r5B7RxTv02LVieryHXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xxl4lW7lXQD3sUVY8Jc9yMMejYL+LIsIkMuv+RloxnCsRCGwTD/C8zZClM95bNqr7 r+EV5j52618URGzvEJpGEUIgQFFtL2aP/fnYH5V0kmRYInmmOFRkWfoungjdRE7w8o XKTKV+sh58bn5m/OCeK7WxdLTZpe0aJ4aC6HxOYKHjBsgllDkuO/I8JzKZYPhwRb/y u8NRcccCqvZzK2xj8Sfz0Ga8WICY14N3C9SSV4YfVsDBM3MODQdcw/SYtbxCHZBjYk 1Ums/rLIrVXN/GNIOb8vPB1TFnqbSg03VgsqEFApYEQgpgzWp7/IISCInfXTM8DztV SZGLInwGNZHaw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8A18864C8A; Tue, 30 Dec 2025 13:52:18 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:39 -0700 Message-ID: <20251230205157.3383926-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ENI3TQT7SH54MOO4QW7IJS3TEHNEA5NF X-Message-ID-Hash: ENI3TQT7SH54MOO4QW7IJS3TEHNEA5NF 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: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/14] linux: jbd2: Add synchronous commit on transaction stop 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 U-Boot operates in a single-threaded environment without a journal daemon. Commit transactions synchronously when jbd2_journal_stop() is called and there are no active handles (t_updates == 0). This ensures crash-safety by writing journal entries to disk immediately after each file-operation completes. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/jbd2/transaction.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index a524f490c79..b997c8495f5 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -1938,6 +1938,24 @@ int jbd2_journal_stop(handle_t *handle) */ stop_this_handle(handle); +#ifdef __UBOOT__ + /* + * U-Boot: Always commit synchronously for crash safety. + * In single-threaded mode, we commit immediately after each + * operation completes to ensure durability. + */ + if (IS_ENABLED(CONFIG_EXT4_WRITE) && + journal->j_running_transaction && + atomic_read(&journal->j_running_transaction->t_updates) == 0) { + jbd2_journal_commit_transaction(journal); + /* + * Check if journal was aborted during commit + * (e.g., due to I/O error) and propagate the error. + */ + if (is_journal_aborted(journal) && !err) + err = -EIO; + } else +#endif if (wait_for_commit) err = jbd2_log_wait_commit(journal, tid); From patchwork Tue Dec 30 20:51:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1112 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=1767127946; bh=Y2Ohj6tWke7cpCz4+WTl2oOndb2hdydhLNRyC5Lf6zQ=; 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=Za//Rz25cIyfgydVKgeKnce8gC7N8RhIdyM5knguS/AcyjocNxUx+x2oY4FEDN7Pg sBdqOUyOdSLA7yWPjYw1oznlrE9ZN2vMor3Tv/5a1nXxJhdakdQIwd29R+DRcbiTAQ zCTNl6AY//EOja+GrxJkBhTCECWiuax6DqkRnMvFEALB+tFgKG15/eGG62gv66KUvh JqihYXK9dMi7OGS+dM02llA8B0oCXAgbWHPYG7/ESugMJ1cgFU5ps6Jbvfq5WDxD8R CXLBrMWJidJFXADIpkhAAZR9toIVQ8ekYmUJ+fAlhuLxxM+JX5FWvv8bP61NF/1i2F GbTulNnpC+/tQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8947A68F7D for ; Tue, 30 Dec 2025 13:52:26 -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 vUDknH_fVnem for ; Tue, 30 Dec 2025 13:52:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127946; bh=Y2Ohj6tWke7cpCz4+WTl2oOndb2hdydhLNRyC5Lf6zQ=; 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=Za//Rz25cIyfgydVKgeKnce8gC7N8RhIdyM5knguS/AcyjocNxUx+x2oY4FEDN7Pg sBdqOUyOdSLA7yWPjYw1oznlrE9ZN2vMor3Tv/5a1nXxJhdakdQIwd29R+DRcbiTAQ zCTNl6AY//EOja+GrxJkBhTCECWiuax6DqkRnMvFEALB+tFgKG15/eGG62gv66KUvh JqihYXK9dMi7OGS+dM02llA8B0oCXAgbWHPYG7/ESugMJ1cgFU5ps6Jbvfq5WDxD8R CXLBrMWJidJFXADIpkhAAZR9toIVQ8ekYmUJ+fAlhuLxxM+JX5FWvv8bP61NF/1i2F GbTulNnpC+/tQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7908E68C06 for ; Tue, 30 Dec 2025 13:52:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127944; bh=G/3+Y+Q5+bVmSodKy+ZUsyRqNUAAvJ3a1u69ErPlVxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kWLYVYpwWEgOTgJvBRo0q9V6gTHpZO+zmBnU9e0tJkrc/vzSWI+SkWrB4+FqGPCpB W8Y22E68FD0KxdKtzUjrTxbNt3kVkzrn+jbBxjo7EgEFIiyfJ3UawHy79Seui4jDuW 4dirtEC7Kd3GiF48NdAy7r+qehoG46IcINJK7GmjTqV2izT7xdqoqkLMBrZk9Y5+IC nASM6eDNAARhqrN7EMoPNG9YlNEScHLhbyqoIOS11I4Cvo2jfGKRFKfBdqqt6XmROn JIh8TTpNSmMQQhnOSb1oVFg8BbXK/vRsUO/Bd6u2NiENCbCmkYrQCrot2xMVczxKlt f+HTEfN7m3grg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EDECB68C06; Tue, 30 Dec 2025 13:52:24 -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 jV9CaFiOrnlV; Tue, 30 Dec 2025 13:52:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127939; bh=y9TqtVA41a5cbfYinndL7CeCy65p9THUZ0vmWs1vgZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T2HBwX5IUkI4bxW84TIp+xUQkEQl8DmyHDbTXNYnRjWGVDR4giv/IJkd0NIex3dt4 yo3wmmOO13KSqeI5PjGbtry/dBQAuQ5tXSnK9clSSVrQ65aorPuhiQDGtB9bQzj0zt ZPMEmqXyflN92I5nnr6UUW5mFl2qF5cI1P58jHQTxPFicjtKgFWWv0REV153XvXlZk w1b0MlAxupzfKaCiP0I57SlRWzga8L+z/TdiG2hO/QB7SZP4H49WGZqRyjL2/42Kk5 tAuUlkpW0dBdOqpOl0sLBVCKI1oUfme8IUHtT10u3X3ucUsWlh9UDJDur9QBiU32WU FD0RgNwvhrOnw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 52C1764C8A; Tue, 30 Dec 2025 13:52:19 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:40 -0700 Message-ID: <20251230205157.3383926-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CES4WSRCSNCRLPAVQDIE2UAJGXSMQFGV X-Message-ID-Hash: CES4WSRCSNCRLPAVQDIE2UAJGXSMQFGV 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: Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/14] linux: ext4l: Export ext4 functions for U-Boot interface 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 Remove static from ext4_create(), ext4_mkdir(), ext4_symlink(), and ext4_rename2() and add declarations in ext4.h to allow calling them from ext4l interface code. Co-developed-by: Claude Signed-off-by: Simon Glass --- fs/ext4l/ext4.h | 9 +++++++++ fs/ext4l/namei.c | 18 +++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/fs/ext4l/ext4.h b/fs/ext4l/ext4.h index 1c2d5beb121..669d5522f27 100644 --- a/fs/ext4l/ext4.h +++ b/fs/ext4l/ext4.h @@ -3137,6 +3137,15 @@ extern int ext4_ext_migrate(struct inode *); extern int ext4_ind_migrate(struct inode *inode); /* namei.c */ +extern int ext4_create(struct mnt_idmap *idmap, struct inode *dir, + struct dentry *dentry, umode_t mode, bool excl); +extern struct dentry *ext4_mkdir(struct mnt_idmap *idmap, struct inode *dir, + struct dentry *dentry, umode_t mode); +extern int ext4_symlink(struct mnt_idmap *idmap, struct inode *dir, + struct dentry *dentry, const char *symname); +extern int ext4_rename(struct mnt_idmap *idmap, struct inode *old_dir, + struct dentry *old_dentry, struct inode *new_dir, + struct dentry *new_dentry, unsigned int flags); extern int ext4_init_new_dir(handle_t *handle, struct inode *dir, struct inode *inode); extern int ext4_dirblock_csum_verify(struct inode *inode, diff --git a/fs/ext4l/namei.c b/fs/ext4l/namei.c index 53c48d12918..bede355d497 100644 --- a/fs/ext4l/namei.c +++ b/fs/ext4l/namei.c @@ -2792,8 +2792,8 @@ static int ext4_add_nondir(handle_t *handle, * If the create succeeds, we fill in the inode information * with d_instantiate(). */ -static int ext4_create(struct mnt_idmap *idmap, struct inode *dir, - struct dentry *dentry, umode_t mode, bool excl) +int ext4_create(struct mnt_idmap *idmap, struct inode *dir, + struct dentry *dentry, umode_t mode, bool excl) { handle_t *handle; struct inode *inode; @@ -2974,8 +2974,8 @@ out: return err; } -static struct dentry *ext4_mkdir(struct mnt_idmap *idmap, struct inode *dir, - struct dentry *dentry, umode_t mode) +struct dentry *ext4_mkdir(struct mnt_idmap *idmap, struct inode *dir, + struct dentry *dentry, umode_t mode) { handle_t *handle; struct inode *inode; @@ -3340,8 +3340,8 @@ out: return err; } -static int ext4_symlink(struct mnt_idmap *idmap, struct inode *dir, - struct dentry *dentry, const char *symname) +int ext4_symlink(struct mnt_idmap *idmap, struct inode *dir, + struct dentry *dentry, const char *symname) { handle_t *handle; struct inode *inode; @@ -3773,9 +3773,9 @@ retry: * while new_{dentry,inode) refers to the destination dentry/inode * This comes from rename(const char *oldpath, const char *newpath) */ -static int ext4_rename(struct mnt_idmap *idmap, struct inode *old_dir, - struct dentry *old_dentry, struct inode *new_dir, - struct dentry *new_dentry, unsigned int flags) +int ext4_rename(struct mnt_idmap *idmap, struct inode *old_dir, + struct dentry *old_dentry, struct inode *new_dir, + struct dentry *new_dentry, unsigned int flags) { handle_t *handle = NULL; struct ext4_renament old = { From patchwork Tue Dec 30 20:51:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1113 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=1767127951; bh=Fn1EUialN0gw7QeGa/gztiGQ2OVHRSBh0uU0zWDsxiE=; 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=qPW0xWBe4jK+bzc0uE8RVvvlc3Fy3NSuO5re5sQJAoVonGTzWJPzW9xniB4w79bHJ HbE3vX1sjepxgAs39kS4zhNAX/DnHWj6+aO6IYxl6WcXbUUPuuTAo5Kt8wv3gVwuxI nlNHobkjnXjJlAet0wb2UiZHv/Sg7Pj4X4ERJw/dfODrqt1xwQcT2TW36JkYR706uq Bp3Zj/ZU35M1E9/YbrWbthzxdx9lhga3q4qTWffcKIlguod3O1qbB3FxzgoSzuR/xA fwKtvcEEIkwijW7tJDSX6vFepUU3lBF0Vdb7t41a/fo7hz/MkRQ0uJvAG0sjrydlMC APAF77EoJVNqw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0155B68F7D for ; Tue, 30 Dec 2025 13:52:31 -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 VJeLlwWkqkrk for ; Tue, 30 Dec 2025 13:52:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127950; bh=Fn1EUialN0gw7QeGa/gztiGQ2OVHRSBh0uU0zWDsxiE=; 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=e1FaAnB0ZBniuHcT2ri3NpM8yb0dYAHQvgqiZRTgZPR2tEf0EPzP2bS0A4iU5Oag0 Vu+C80HG8wttErOvXjR+i7+tFVUG84+3747IQwLz9aKEupXO4Khmcv3JXKdww8r2u+ rEIF1yDSYiWRFScgVdh09VWeNkoZostzoAEIhlBG/jKuYHdmrO7SwgI+TNC70wlCru U8oO/7nw/qAqDFDB0zOhUz+7aH9YpK5VMTD5KkHHi7EEg4JLJmlaZzaMS7FffocuYt xd8azif+cNFoeI1gHosy0GG6by+dH2rHmcAhmETdFIwdixnLbbjWMfwABskDm6UxPM FrVNdp4yKf+7A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E610E68F77 for ; Tue, 30 Dec 2025 13:52:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127948; bh=au7siNHUCSnulnzSPJ/scL1E/9yHJTLqps7vz2LL2ww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eg17es117hXpCNDvxvaw02/Fp3YPUjRunR416q5xB6fnbeHFWHl1JJXRuZmJpnQwW G5M7sy/PkOyctjPYF5ajZyHFrPGAoXZ52uKFPE1j/SHZ22BW1rw4qudKbvMmI54Vif RSxLXMYcf7NhSGhPvu7nC4MZgsxNu7RBzuGKfxMgZUES+epeTyFo9qWdWcT7vMsGFl P99EsxvQ7lGmHot348w7DbW70LEeVaxhXXCdp9Rcjf4UoLmN4gmFFRP1uah6YDu1rD I+KxVDaoHWJNdjSKrledVJ2Am9T4uP5MHqNxY3i4qYekBM6DBBOJKWv8kjONMZ8Bsq JlbpFzhl0T2Mg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E44F568C13; Tue, 30 Dec 2025 13:52:28 -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 gQmCQA0qo14z; Tue, 30 Dec 2025 13:52:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127944; bh=PEULgvM1IDjY5DFgq+4mZZcuVNFCS04i9LvD5bCowdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B4AonyVJiYDULay66OyZ21wiZ4g6i3EQMKPS7KhxU1n22WPcFSUrChLA0YDDjNgxv VIBhBapM7ttg3d5SEnQ5i2uDD+iqu9KFkjrzDSiIyG27BLlFwksJzqcM3gU9sul493 itjxST1nblhmVelepOj0yWESwpDYsmDp0Rg0HWRdUsxQQ+nQ0YeCfdcj2Gtp5fqS1s tz5jvV6RPcw6J86lVGKcgvbLFfJ6/J23Arbp42O/9RlIjg9Et/Bs0XH+yYdWxO/9Kp djOnOFTpR6oxoMlogyI5X1ETv+ao8rob/4Uj2VQS7tPQVRXV3AkUU9AviRc/gLnShI b/Aw152SrnmGw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E34A368BF0; Tue, 30 Dec 2025 13:52:23 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:41 -0700 Message-ID: <20251230205157.3383926-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JAXK5K4XK5FLSZWPA34373IM4CZ6LKIU X-Message-ID-Hash: JAXK5K4XK5FLSZWPA34373IM4CZ6LKIU 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: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/14] linux: ext4l: Skip orphan handling in U-Boot 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 Skip orphan handling in U-Boot. We do synchronous journal commits after each operation, so orphan recovery is not needed. Adding to the orphan list without proper locking can corrupt the list. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/orphan.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ext4l/orphan.c b/fs/ext4l/orphan.c index 32ec59b2978..b142c1bd21f 100644 --- a/fs/ext4l/orphan.c +++ b/fs/ext4l/orphan.c @@ -103,6 +103,15 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) int err = 0, rc; bool dirty = false; +#ifdef __UBOOT__ + /* + * Skip orphan handling in U-Boot. We do synchronous journal commits + * after each operation, so orphan recovery is not needed. Adding to + * the orphan list without proper locking can corrupt the list. + */ + return 0; +#endif + if (!sbi->s_journal || is_bad_inode(inode)) return 0; From patchwork Tue Dec 30 20:51:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1114 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=1767127954; bh=xocHhyJT8Sotq4cDiBZ3l8jmobMY38KTDXNlZA2O8NM=; 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=ooJtlajsrbuolan8oRKHoYWn6iNQPdo9QpWiw6NvycMWGdfuk2w+W+qnGN1C9d+NR 2dPgQq7l5af7FPePfjW2MQj4prSjJ9gPUDlJwFZXmWHZ1c2fmwvksJWZJMIkQLFWCU r9wYIdcHnANtBAROfPsUYNHbRH2yrvO4Oc2MLn9PkMdwmEtZlRV4Rj6DLo0w6gC6D3 Zv1bLU7Uk1uaJ9SVq/7WFftQ2yxW785K1PuM2nlL6IZxbKjSFfE1GTrKyNxNA8ZXGX TO+eY0HtogZAuNh+csyF8KU17JhGBxM3uAph3iX/wz+UThlWgTcVmHo/9JVxvU/+P7 i7OZrMwY2Vo/A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 75E4A68F80 for ; Tue, 30 Dec 2025 13:52:34 -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 hkjtIuwgbP3e for ; Tue, 30 Dec 2025 13:52:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127954; bh=xocHhyJT8Sotq4cDiBZ3l8jmobMY38KTDXNlZA2O8NM=; 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=ooJtlajsrbuolan8oRKHoYWn6iNQPdo9QpWiw6NvycMWGdfuk2w+W+qnGN1C9d+NR 2dPgQq7l5af7FPePfjW2MQj4prSjJ9gPUDlJwFZXmWHZ1c2fmwvksJWZJMIkQLFWCU r9wYIdcHnANtBAROfPsUYNHbRH2yrvO4Oc2MLn9PkMdwmEtZlRV4Rj6DLo0w6gC6D3 Zv1bLU7Uk1uaJ9SVq/7WFftQ2yxW785K1PuM2nlL6IZxbKjSFfE1GTrKyNxNA8ZXGX TO+eY0HtogZAuNh+csyF8KU17JhGBxM3uAph3iX/wz+UThlWgTcVmHo/9JVxvU/+P7 i7OZrMwY2Vo/A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 65B0368F7D for ; Tue, 30 Dec 2025 13:52:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127953; bh=sSUBVVY3RgV5XU8QFYbC0/qVVQOj+s7OLBmXngpifqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ROAtrWA2lBSt4XRdpqEC64i4wlI94sNLoKASXUT1PGGRbjHHUKmN17GSgH43t5CZC sdaMJr6hr7U5LFbP5alAyrYzt0rlMwDs8waFrF3QXCotUiwDG0K8G7G3AwVU+RGiV/ WyF4Dfrt035xnHgMjiYeYtA0xlJqUpDbTe6y2vuFQvZqR8hGpxtYesD6p72Zbj1xtJ kX07sgIIaD08U+te05ajv3xyiGWbowutHlfkbWGLemNJfWpS12xN1SYCVXxKAhasvC YlRN8xB+Hqgl6/Hd5G/1wzIpxQb6SR768MPePRTDdKRFfl9nnCbq/k+9A8fk5YuCRE /sc2nBspB5h0w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 600EA68C13; Tue, 30 Dec 2025 13:52:33 -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 WuTGRSppo0Ej; Tue, 30 Dec 2025 13:52:33 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127948; bh=hbJ2CXdJ5IRQbN1KvkGgP7BRKTGkR0dagCJUPWI/KTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UY0ETUVQfo5N+DfazBdoVaZdkTmWUzZCf/Do4kLTy4o02y4fqub9GF5QirqDx2Pbo mjQZyp22OAy21RMXfUWB52XLnQFgPFuDNvGIgLF99VdVkzBEkCYtTZH43nRienqkKV a/KFx8RZ6FlwVsjWhX8SqLtcdl/TCV6rC4B8DK8a5HhhWldA3mQJAHsRtYtD8+JtDB AkzqTLjVko6cJA1s8BYk81WaZNxPJZGnjb5EHo867HXA2dDGXtFWvmOpXZNuKK0b0M IazbcmSjXo7vtp1YftZbsCC5UkbkfNO/zSDmK+2Pt06SxqWDZLmwBisSARmBBj824W YBNvyjI54HtQg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7C78368C0D; Tue, 30 Dec 2025 13:52:28 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:42 -0700 Message-ID: <20251230205157.3383926-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 3D52XONTPVZ7NVEBNMJYYBC656TMFZN7 X-Message-ID-Hash: 3D52XONTPVZ7NVEBNMJYYBC656TMFZN7 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: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/14] linux: fs: Add folio cache to address_space 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 a simple folio cache array to struct address_space for U-Boot's folio management, avoiding the need for Linux's XArray/radix tree infrastructure. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/fs.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/fs.h b/include/linux/fs.h index 090ee192061..0bf0d3b0379 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -50,6 +50,11 @@ struct path { /* Buffer operations are in buffer_head.h */ +#ifdef __UBOOT__ +/* Maximum number of cached folios per address_space */ +#define FOLIO_CACHE_MAX 64 +#endif + /* address_space - extended for inode.c */ struct address_space { struct inode *host; @@ -58,6 +63,11 @@ struct address_space { unsigned long writeback_index; struct list_head i_private_list; const struct address_space_operations *a_ops; +#ifdef __UBOOT__ + /* Simple folio cache for U-Boot (no XA/radix tree) */ + struct folio *folio_cache[FOLIO_CACHE_MAX]; + int folio_cache_count; +#endif }; /* block_device - minimal stub */ From patchwork Tue Dec 30 20:51:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1115 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=1767127956; bh=O2JJOHkLeT8ayZUxhdYhLBt9oG7wa8fCkLZFi7qrzKk=; 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=V3vi/e3iuen2OVTZjW4H1YtnNbCsl00RlnY5n2AV/vZo9Dxf4EUX6Gg7BuX+C9Zi7 SjfSDsK7xC4ix4dK9YHFiHTwzTICGsnly4XiBD1jBQUGft0C+7sTJMUCmfe2+8D4vU xmgyxYOFH/P4WGJLgr+cdoSmm2L8VB9EDA19hJzXf+ulkmW/yAwiIUk4Lo/wxryxO1 D362f87mvHDAW+Td3IgpRwhO457wGS1gW4I8joZWNk77WQ2kAhKiVKPWpISWYrj8aK cGHOi9yVbzP6WehQAdPChGKpcFILCx00miUxV7DCVYsnle0VU/K9Jb+rofyvJhc11x vbkkZXaik916Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C968668C0D for ; Tue, 30 Dec 2025 13:52:36 -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 7WaxFQzrDgI2 for ; Tue, 30 Dec 2025 13:52:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127955; bh=O2JJOHkLeT8ayZUxhdYhLBt9oG7wa8fCkLZFi7qrzKk=; 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=uPoAKml6+j381cJNzxsApeEkxxz9Ag/OPuYg0qFUus5wzZpZeTJ7XV85U2mCvAP5Z dq/+r84msycB3wr3otrjxTT0aGP8tItoR1KCulkFVIUu5F+p6xPWfzfdXclmzkowkc TdlDEJhMEIsOZZxfM+R1NOGyUxf2sLgrXMvijtHI1H+viPFLFZt5PGhDk9Ie9NYtwT IEPqJusq+YdeClJrHwjDQh3Lv7MVLa8dSciiSCb7gE2fiA4TIR9ECdz6myWMl1HRWH uKJNaQ5FNdL52tUokhLLS7M9EXg6TNkIVLIkDGg8pSsAXkq0DQd0CdibENk4dc7SaO mn5OWvV7TKbYg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7B06668F81 for ; Tue, 30 Dec 2025 13:52:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127953; bh=D69pJr1uFLWLePd31rCRGmyWkgq/gIGLw+jPfvCXvGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lgKW6hS1sBFHWOV+BxqxPf2RQlfcFHejn/f5x48+WO6bB85Bkcay8/tq9QG4g5TvF Z1uw2hRmfrh2/p6FE2iN89UiA9wTBm87CB/WbqIyA8jWLemLOTiO/Ap4umZ2neYYYw W54BQzRBnbYjMSynXc9sFb2YzrOMYrr305f+vuwiC3a7ye4++YS1Vl73AN3LKTk5Pm LBHDFp1H+bzWl2wKQ3474ubEZnhhr/Q6T+Y5vT1jRQ3Yx3sYs8a3oxMkqldUtIDUQg RsCXSyBW1ItoApXl1Y0nB18F8pMwcXj7m3pl9PmOeTgy8OqqGXQYSrBT69zflSTTvy cvp21qH8a6Wrw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A527C68C0D; Tue, 30 Dec 2025 13:52:33 -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 7GKEfxRn3Iiq; Tue, 30 Dec 2025 13:52:33 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127953; bh=rd27jupZFFCdSLf3GwyfIQLGxakFG+b13oEO3F6rXig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MkSpJr6/q+GTWN1ngUJb0cy8tUh42vElODzCpaCndiE54kZHAv0X9Z0CFIxFV2Dek XCpSWLhFbkd1n0ZDz1GPs/jBpcpa4g1YgG097HEYQFW+aKJqEUMdErEPDLL4HV40w+ p+tPIhmAUi1fDr66UHuBV15/xqtLvo8UkS2wr7xdy8qzW1UzBil3XPPziRz/wmOV5b YEOLDzvyeUpa+eqO6Rauq6OJUQGxaEmW4Ar4fpmP1OCyWWYJYONmX/veoNCvTrGg4i 1E05ged1iqVA7ISolpLSKlSljRS15e4j3xPSqwyNQO9FGjJcb7MbqTATa3VZoD4m0+ jJVqB9hP4GoEw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 171A068BF0; Tue, 30 Dec 2025 13:52:33 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:43 -0700 Message-ID: <20251230205157.3383926-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 3RTURXE6C666BNVEFRH6UAWYY5737KFI X-Message-ID-Hash: 3RTURXE6C666BNVEFRH6UAWYY5737KFI 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: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/14] linux: percpu_counter: Add initialized field 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 an 'initialized' field to struct percpu_counter to track whether a counter has been properly initialized. Update percpu_counter_init() to set this field and percpu_counter_initialized() to check it. This is needed because ext4 uses percpu_counter_initialized() to check if counters are ready before accessing them. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/percpu_counter.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index 58d52d01310..6a8544f7f79 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h @@ -15,6 +15,7 @@ struct percpu_counter { s64 count; s64 counter; /* Alias for count - some code uses this name */ + bool initialized; /* Track if counter has been initialized */ }; static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount, @@ -22,6 +23,7 @@ static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount, { fbc->count = amount; fbc->counter = amount; + fbc->initialized = true; return 0; } @@ -76,7 +78,7 @@ static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) static inline bool percpu_counter_initialized(struct percpu_counter *fbc) { - return true; + return fbc->initialized; } #endif /* _LINUX_PERCPU_COUNTER_H */ From patchwork Tue Dec 30 20:51:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1116 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=1767127960; bh=gQduhyzKKTzzHAok3/wwViW68WIkNY2kIH6AUyXBe68=; 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=eSA6/ORouuvvK3PZGsuYmJn+fa3eUkVW0HnPPlDNhhwjbYXeGRQztVblRdPxIPW0s C7yJfPiMWhari7B5bBll6L6GkR6YySLa4JsCeoX1rYFor9f8mGVcD6BHH0PX+L1t4P NwplUPLS0P42XqpvzaUMZYRRnMhcQ+Rh7V6jZ9zdsOg7Zd4JLk7AeSbKn5RaJmdgaC 2CDV+MXkKFCCtCsZyfkWd6gbjOaKyupcQwuRv8JHw3nHfXzj8hFvXZOXR3JjVSHhzt a+qs/dB2FW3vzhfhtNKzXa5IGjmKP1St6WSjLwX1E6pJZAUN4ZS1A1fEz6p3YLNOUq WEN3ez4WIjeiQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EF5AF68F80 for ; Tue, 30 Dec 2025 13: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 30a2qR67X_pV for ; Tue, 30 Dec 2025 13:52:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127960; bh=gQduhyzKKTzzHAok3/wwViW68WIkNY2kIH6AUyXBe68=; 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=eSA6/ORouuvvK3PZGsuYmJn+fa3eUkVW0HnPPlDNhhwjbYXeGRQztVblRdPxIPW0s C7yJfPiMWhari7B5bBll6L6GkR6YySLa4JsCeoX1rYFor9f8mGVcD6BHH0PX+L1t4P NwplUPLS0P42XqpvzaUMZYRRnMhcQ+Rh7V6jZ9zdsOg7Zd4JLk7AeSbKn5RaJmdgaC 2CDV+MXkKFCCtCsZyfkWd6gbjOaKyupcQwuRv8JHw3nHfXzj8hFvXZOXR3JjVSHhzt a+qs/dB2FW3vzhfhtNKzXa5IGjmKP1St6WSjLwX1E6pJZAUN4ZS1A1fEz6p3YLNOUq WEN3ez4WIjeiQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DFD9A68C13 for ; Tue, 30 Dec 2025 13:52:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127959; bh=sDDUubW9Z4RsLGVKLv2dRkGa11fNTD9qhMbMQY/a21w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONzyWJIr099GHEW0dAXsIWswv29Nka1dqibzdRoCvW7gf/RUPEvexSHvE8fsVMByD suOW61+acyOrXV27DhCBF8J9t3k58xhBdcKWDVUoM1aftAgzRgEE8WrPotqaugA6XS 5lDeZtsDM/5MRkV1Vn3vTBapxIkx6RPzFbYAOFtpQw0k4JJh8lRXOj5AYZrMaNGZfy EyU3iAz7TP5ipqKcMHREDB+bCb1Qwi/zdFbQfmixXkU1Vjen7XUSV7/yKHOy+8Hc2i VzI92zv0+5Ujt+sxpbdvegksHMNlyGn9X20/DAmO7NFNbomCem604PiKqIvOe3Jf6Z GOK4qb8qHADPQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0F74168C13; Tue, 30 Dec 2025 13:52:39 -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 QlWm7wREDpVq; Tue, 30 Dec 2025 13:52:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127954; bh=/soJKjqi+nv7Gb7IHM4NFvbBOdwTNpiWk9pAiRHx4vg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hYN2F6XEVLdfPo2S5OJgGuO1Ei7ASAGtSoh651n6OYIgTqcn9L/CykxtH2dnI8DRx UIPyBY3zXMAumsHIblvrzBrLfgLR4ZeFB/toyf98MKKzpZoqpTh2xuAHGd+o/Sl85b DvAgvH8vjquorp+hDYrhu54yF90w7YfkWLIhx7b0mOaovtJG45fJh58MBzaP5agq3k 40GwVi4ffp8ZuRmp5ChsjxI+0LSrZAK60hsNzcKEMns6VKVCpY7jsDFZrMPwMcWfjT wvqrFptIz+lbwk5PZunZystd0Mobuvxpj3JnbCtfgpaKox2qLc5mqWXucqsEH1U5wp wNInXiV3cS/TA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id EABA668BF0; Tue, 30 Dec 2025 13:52:33 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:44 -0700 Message-ID: <20251230205157.3383926-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: M6FQOSOAYSQ3VTHVUFRAAPYL2AMNP5EO X-Message-ID-Hash: M6FQOSOAYSQ3VTHVUFRAAPYL2AMNP5EO 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: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/14] linux: ext4l: Mark journaled metadata buffers dirty for bh_cache_sync 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 In U-Boot's ext4l implementation, bh_cache_sync() writes all dirty buffers to disk. However, buffers passed through the journal via jbd2_journal_dirty_metadata() were not being marked dirty for bh_cache_sync() to pick up. Add mark_buffer_dirty() after jbd2_journal_dirty_metadata() to ensure these buffers are written by bh_cache_sync(). This is needed because U-Boot's journal implementation does not write buffers to their final locations. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_jbd2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/ext4l/ext4_jbd2.c b/fs/ext4l/ext4_jbd2.c index 84a985ce3a2..d8ae15099e1 100644 --- a/fs/ext4l/ext4_jbd2.c +++ b/fs/ext4l/ext4_jbd2.c @@ -367,6 +367,14 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line, set_buffer_uptodate(bh); if (ext4_handle_valid(handle)) { err = jbd2_journal_dirty_metadata(handle, bh); +#ifdef __UBOOT__ + /* + * Also mark buffer dirty for bh_cache_sync(). + * The journal may not write buffers to final locations, + * so we need bh_cache_sync() to write them. + */ + mark_buffer_dirty(bh); +#endif /* Errors can only happen due to aborted journal or a nasty bug */ if (!is_handle_aborted(handle) && WARN_ON_ONCE(err)) { ext4_journal_abort_handle(where, line, __func__, bh, From patchwork Tue Dec 30 20:51:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1117 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=1767127965; bh=hJgVPFtuitzSqbTW5XT6SvJnenZ+qWoF9kAXVqq7y9k=; 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=IZbv9iOztYD2m8n1UuTQI1lUaIePJv9eHbtxvoOGUayDusGbIXTE/oAS02MQNThfc vRUmkvxcmVR8GhZj8lYH3eLrujq8eEhiaHFlQkg/cOhziPDMjdYbqzBWIyW9eX7z+j zavVPeL+4zcwPzILZZpDRQziy/wAI91E/cS01FhBmMAQWi0sLpzLY+eknqhi5JinYR GfhxaUyvxBBS6EOaJqcLk63lgVymK8wHthumOu5hy7ZF/3VnPb9AcGgB/5oK5iYUNL yc8e8ShNDrledz/b0XPYUOj8whQKMrQK9fuIosILL2IkYap2sSqhBQLU21UvZVYdZI E65IHsuTRhdww== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6E5EB68F80 for ; Tue, 30 Dec 2025 13:52:45 -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 WZe6GowAA8tQ for ; Tue, 30 Dec 2025 13:52:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127965; bh=hJgVPFtuitzSqbTW5XT6SvJnenZ+qWoF9kAXVqq7y9k=; 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=IZbv9iOztYD2m8n1UuTQI1lUaIePJv9eHbtxvoOGUayDusGbIXTE/oAS02MQNThfc vRUmkvxcmVR8GhZj8lYH3eLrujq8eEhiaHFlQkg/cOhziPDMjdYbqzBWIyW9eX7z+j zavVPeL+4zcwPzILZZpDRQziy/wAI91E/cS01FhBmMAQWi0sLpzLY+eknqhi5JinYR GfhxaUyvxBBS6EOaJqcLk63lgVymK8wHthumOu5hy7ZF/3VnPb9AcGgB/5oK5iYUNL yc8e8ShNDrledz/b0XPYUOj8whQKMrQK9fuIosILL2IkYap2sSqhBQLU21UvZVYdZI E65IHsuTRhdww== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5C8A768C0D for ; Tue, 30 Dec 2025 13:52:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127963; bh=SuD9xUko0LIASnokLY2KPabe7wF64b3lOBNMuip2t/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nljO2OlZaU3ebdwJnQoixQwsslIJip6h8VA4XzdYvwyt08EqKHJfI2cJBP36y47Y6 o0O8+qekipm4tzgZ1puX3KDn4WcDo/lrcJNoJvvPnq/rwYsJS6dGBLXVqMpSrq/aMr nXmCO1uaVWIhD+iFm5QGkpTg3L++qJ5++KydruRGitxcRNysjV6FTcunclCd4mfBZB Q2RRMwH0kZGaAJoRBUJUVF8QSLR4neBt2gZwTH4uX4W8TLbNRF+ONMduU+4cjd1g0q TO0LWeRS2NsFy5Y2tWYeHWI8v8vsRERWjkErVKyzHiMt6rBNSpc6bN46prtPxacEZV L/juwTl0S/teA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5672368C0D; Tue, 30 Dec 2025 13:52:43 -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 HEqwBFT5TEmq; Tue, 30 Dec 2025 13:52:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127958; bh=8wNpT0l5sRIQdqAiphXUjaEhRVemP8HKbqy57cc3mnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F+38klTTx0knCchPs0piclvgYbuVsBAQXcYIA2Yg9EroqKg3Uyc3RrWHaSbLmT+as lgDfZZzHK/WIaVnNmgo2onuVwvayIVuUY++v284RJ/QGMbWpZJyljzcjtAdGsHyzfx bAvRf+fmiaiAwaeBVG3VY4p0cAwUD0Gv3TEP93k1Bwh8MWP3vBtbadO08odY7liN/W Py5AQvV4Fkkvfz6CX4AwliHyA9r6er6FfxePvLhaWRx76N8yKyxj9rz5XuymyPVxOq iomM3tsxUZ+U5B0EbfCAYpIyYHRDt7dSTIvsfzFYYQXvoW4KpJuyMOiheRjYFGS9dD 7DPdRLifLXFQg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 92E2864C8A; Tue, 30 Dec 2025 13:52:38 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:45 -0700 Message-ID: <20251230205157.3383926-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: XDAHBZN4OO53YZPK3UHHJLFPDJPV74KU X-Message-ID-Hash: XDAHBZN4OO53YZPK3UHHJLFPDJPV74KU 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: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/14] linux: jbd2: Add validation in jbd2_journal_write_metadata_buffer 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 When debugging journal corruption issues, invalid journal_head or buffer_head pointers can cause crashes that are difficult to diagnose. Add explicit validation of jh_in and its associated buffer_head at the start of jbd2_journal_write_metadata_buffer() to catch corruption early and provide useful debug output rather than crashing with a SIGSEGV. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/jbd2/journal.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 0cd95df8192..138b650fae9 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -305,9 +305,31 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction, struct buffer_head *new_bh; struct folio *new_folio; unsigned int new_offset; - struct buffer_head *bh_in = jh2bh(jh_in); + struct buffer_head *bh_in; journal_t *journal = transaction->t_journal; +#ifdef __UBOOT__ + /* Validate jh_in before dereferencing */ + if (!jh_in || !jh_in->b_bh) { + printf("jbd2: ERROR: invalid jh_in=%p b_bh=%p\n", + jh_in, jh_in ? jh_in->b_bh : NULL); + return -EIO; + } +#endif + bh_in = jh2bh(jh_in); +#ifdef __UBOOT__ + /* Additional validation for buffer head */ + if (!bh_in->b_folio || !bh_in->b_blocknr) { + printf("jbd2: ERROR: bh=%p folio=%p blocknr=%llu b_data=%p b_count=%d\n", + bh_in, bh_in->b_folio, (unsigned long long)bh_in->b_blocknr, + bh_in->b_data, atomic_read(&bh_in->b_count)); + printf("jbd2: ERROR: jh=%p b_jlist=%d b_jcount=%d b_next=%p\n", + jh_in, jh_in->b_jlist, jh_in->b_jcount, + jh_in->b_tnext); + return -EIO; + } +#endif + /* * The buffer really shouldn't be locked: only the current committing * transaction is allowed to write it, so nobody else is allowed From patchwork Tue Dec 30 20:51:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1118 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=1767127967; bh=AWfuxu8/la2itweoGef6qA6cDDH9D7LgAP1eOOX0xhQ=; 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=UC2Dc2KCKb/ivFMYnlaMFbq1hzNeOrAW6Zv8aJyjR1dx6UY4cuPulRN4BniR89ie8 SNXzNF2it0MOdYdkZbyXbT3RjKPjENjW5PJfh99rdqY8N08o0pMdbsaemAXCOVoFLl O5vQVQ+ysnoa9rDsUwwOJ2qbkIPwkXCHhM9L/AwPYeBUlIm7itNqWF278OczIB4nCU kYCx0M+62YyBw5NrVO82Ql+DEyOYUmqmNhDjBwfLxqDrPysKmmoBnsb+wz5d+6YSJ+ 36KUGGoxp6qLzNoxXw3qgLs6KaYfTBSX1HvEyNx2sb/HBNvCmtnipi4D/rACPmh5NK jlHtvDfklAP8g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C677868F86 for ; Tue, 30 Dec 2025 13:52:47 -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 X0ebFnp4WI-L for ; Tue, 30 Dec 2025 13:52:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127965; bh=AWfuxu8/la2itweoGef6qA6cDDH9D7LgAP1eOOX0xhQ=; 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=PoCR9web1fLqBgTx8Df4VVwZUXETykMygiRswPTZsvKnuw77/QXTTDaj4iC3y2z5n YGIoWvOC1J609V/lTJKGoHmTM4/jNWFiO7wKD1+bOxZyHXy1g4W69P/c4ia60/0T78 c7zvKX/IeNexqvY9CCOd2bWESwRyg0XzWnaPD2stRbxQ+7/PsDLIloh9Y8u2wMksA2 pwgLdVdwBk3BZYIs5IqIvP03vgF2KdniEXzY18YpjjLiQ6VcMZyCodOovBaKbkpWlb gTCaNRcZy9tTTp4ZD4zwRryYsNiIYObvwisnVK1pkd5eT3+uj5p+M1E68TwzyNS1w0 uWRRhh+oBP64g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C124364C8A for ; Tue, 30 Dec 2025 13:52:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127963; bh=/7g8dCp5vXealhpdpBDU3UO7JG0T+LBYMbNsA3+hcgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jD9I/FPU9zQC5jSTRVQV81eNl85KDykfeZMs8K41qgCK1YHV/+el3IqbIqeWzK6lz l1WJnpY6gTOcjG20GUH5GAkd/U4IFdK7+jqpyX7EeNqlWxXUx22rCXTHDElHr9rrwx axV95Sfea9qOI4n/DheAAMHcxTyeZtbhmvxjs626NoZXLvoP9RZB60zpI2eY+l8b2V zpsd7E1bpa3nB51wGfww/z89NTMvwgifLnY4Qq9DLbAB3kXxSidxjQrIZdeyUuxC0N KqGmcJllNMzne7WmoVE719mzJdlqRYksETphvjLt6OLB5mmhWOKKp6tAJyp1Yv4MBq ZJCdkuTNF+6Vg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BAE0B64C8A; Tue, 30 Dec 2025 13:52:43 -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 CrHTyv89DHvN; Tue, 30 Dec 2025 13:52:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127963; bh=xQrpGNJ+Ai2wr0eVzOerHCDJNXce5bJmderHgKpmMyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mu9Fq1/HnIkn/cebN4cov28QjtuGnSIzdO5HNagNF4jujInMUPTWjL9ZvSDOzb2w9 MuezsSOyMVee/ixtwoDmCfgFEmiGLnE+TZdGEZy0lpyWCB1U4oSTb96ecCrklOUOW3 Ggiz/L6opxpIHHqjpltn+x4Sr4IdDfbOYEP/4WPq+Bylj4kTtKuPAgBrJhB45YRdYg q1Ee8WAe5aw65nSmo1CbEPuPs4fvxOOeip/toeFvmLEB1bfW0x4xQ1qsxHJKYCcJyV fxPWG645QbVldwv98mWXpSNcMOlQyw9GUHePFYPW6usOQryRLAiHGETnLCxc9dv9CJ xNwP/o8AS+Cow== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2BA9F68C06; Tue, 30 Dec 2025 13:52:43 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:46 -0700 Message-ID: <20251230205157.3383926-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5GYKZKIAMSPN26HYT6WEW3XIQII22JZB X-Message-ID-Hash: 5GYKZKIAMSPN26HYT6WEW3XIQII22JZB 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: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/14] linux: jbd2: Add jbd2_journal_exit_global for clean shutdown 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 In U-Boot, filesystems may be mounted and unmounted multiple times in a single session. The JBD2 global state (caches) was only initialized once and never cleaned up, preventing proper reinitialization. Add jbd2_journal_exit_global() to properly destroy caches and reset the initialization flag. This allows the JBD2 subsystem to be cleanly reinitialized on subsequent mounts. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/jbd2/journal.c | 33 +++++++++++++++++++++++++++++++++ include/linux/jbd2.h | 1 + 2 files changed, 34 insertions(+) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 138b650fae9..f6478c6ca94 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -3140,6 +3140,10 @@ static int __init journal_init(void) return ret; } +#ifdef __UBOOT__ +static bool jbd2_initialized; +#endif + /** * jbd2_journal_init_global() - Initialize JBD2 global state * @@ -3150,18 +3154,47 @@ static int __init journal_init(void) */ int jbd2_journal_init_global(void) { +#ifdef __UBOOT__ + if (jbd2_initialized) + return 0; +#else static bool initialized; if (initialized) return 0; +#endif if (journal_init()) return -ENOMEM; +#ifdef __UBOOT__ + jbd2_initialized = true; +#else initialized = true; +#endif return 0; } +#ifdef __UBOOT__ +/** + * jbd2_journal_exit_global() - Clean up JBD2 global state + * + * This should be called when unmounting the last ext4 filesystem to + * properly clean up all JBD2 caches and reset global state. This is + * important in U-Boot where we may mount/unmount filesystems multiple + * times in a single session. + */ +void jbd2_journal_exit_global(void) +{ + if (!jbd2_initialized) + return; + + jbd2_remove_jbd_stats_proc_entry(); + jbd2_journal_destroy_caches(); + jbd2_initialized = false; +} +#endif + static void __exit journal_exit(void) { #ifdef CONFIG_JBD2_DEBUG diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 41725fb42af..796d896f70f 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -75,6 +75,7 @@ void __jbd2_debug(int level, const char *file, const char *func, extern void *jbd2_alloc(size_t size, gfp_t flags); extern void jbd2_free(void *ptr, size_t size); extern int jbd2_journal_init_global(void); +extern void jbd2_journal_exit_global(void); #define JBD2_MIN_JOURNAL_BLOCKS 1024 #define JBD2_DEFAULT_FAST_COMMIT_BLOCKS 256 From patchwork Tue Dec 30 20:51:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1119 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=1767127972; bh=KLKc4suqUm/JZvR/2p781iMaXk2c93LbPX8t9S8vWsk=; 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=Nbg2Lpox4hhxmAnlTZtCwbaGyLAJLkRo3NQGqyQKevIPj9dGShh4HknEGa09ImfU+ qe1MyOb/I1wqQiUMATdaORkWaQTocqnxGKH+wHh1tqSjBAggm6D7gmVWAMKGXZ1kCQ EiNUUzzF89zwXhQq554qSoLfGBoRtpPtc2OlSG+c+jZwH4p5K8NLSUF/R7fWaPY7aS aV5u4VFvuChYG6cgJkQ/sXq4qi8OG8XhJujoSnVyByQyUNki2IfZcrxdL8aAFlYAKa DdbYZ2rW1KWHQOnQuJdhxFSaHBasUiiHckORnEInKk2JT9vzSaeN80fVXweoLPrlh9 NaeQbAs4ZADBw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 034FC68F80 for ; Tue, 30 Dec 2025 13:52:52 -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 a2K4SfW1Ic2u for ; Tue, 30 Dec 2025 13:52:51 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127971; bh=KLKc4suqUm/JZvR/2p781iMaXk2c93LbPX8t9S8vWsk=; 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=DXC6YeiPf+CAbhqF+tLGNuRtqkvdrV+ksJcVIiJlusyfTL2Wb8LLka/UV0ZHA7RZd JI1EL5UFE9Cjowlkxw4CxkGHdwi+xZEoos8EeNS9RTl+Np4y35kcVETQCC9lmoxhQP ILGSEG/RakaTmrvUcA7+7pb0leVsMJyG2zNgsEshcHLaxDKuDMN2Gzg8gYzImqm8eY co2r5ejwka3ltRFzCmHWmuaes0PxXP0bSXXBMpGYVBqTSKJNhO3ZKjaHKbOFiGkwFS 4GMxBlAWCuSyXh6hd7/5l6o/zhycqxc+SlU/p4tClMtzjeOvTLlMWInRx3v0xd9Z3J ZJ0W6lFshoNJQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E691268C06 for ; Tue, 30 Dec 2025 13:52:51 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127969; bh=eb3J18+f4tJ5ERa0QcoI1y+eWQ4nfY6GFBP87S8xr5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z5N+dWtZ+AFAW6oAUMsf8vVamuQENVAc++2HwAqNnJ0E44KVwwzJa9si6llcWYgvQ Zvpu18Pv6wnYH9zyd56LmlODFf18bZC3Wt9zoAgXGeI6C4ajAd0V5iLCiZI8a6Cd5G opg7/CKoT7cySZ2pkj5eY+lDyBtEet4hLQoUqmmb3cgvOD6+phBTa4oHOQS2BvF3Uk mjkHfmAsaiPs0uO4pkQG/eTcFawKkHL8QRkHyq0tLwlesFVPP5qUHyCdawZLz1XUw/ 9p+4dKdohHkogyCoAGlLqF3WjEvJ8XBffSfw8VaQGTVoOKxTRJCmVbTRBr5cDsJr01 s4XEAwgc5o9LA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1889B68F7D; Tue, 30 Dec 2025 13:52:49 -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 hevPrCEvBLSo; Tue, 30 Dec 2025 13:52:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127964; bh=EyjUo7zAbS29VcNnrtZX62xp14/5xPaPC7U2RakGU6c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZc7VAhHFRYJFJ/HiUKWMXanP0UxDS8N6vxh33BaePWzhiLlfJIbtndPbePgbBwKZ bZOGppSZbudoRo6LZcIbLi0DYchM0dJGscc1u5pzNso81siJGqjT5eO3H4Mmhhau+G jO6rnXUb++W0WDL0vxgA6BwcMMNpPTd3VerPHzLfSfeJDL8qzDZSXsFYkJSQKa6vBi cjoshJB5OGMlmTTRosuEpUzvTlJS02m51wpJ+4sXyO85Zt2R6dFAL62uC1PFShRAY0 IswUwiQbd9oOnafVPXY5JnHGkxQczId17tLKmgggFvZN9j30t6Sg6wmY919Q7zEUJ6 R7Rca/Ttjq7Eg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0AB3668C06; Tue, 30 Dec 2025 13:52:43 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:47 -0700 Message-ID: <20251230205157.3383926-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UV4K643HDDWLVLZJASFGJBBDK2NKKGIB X-Message-ID-Hash: UV4K643HDDWLVLZJASFGJBBDK2NKKGIB 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: Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/14] linux: slab: Convert kmem_cache functions to declarations 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 Convert kmem_cache_free() and kmem_cache_destroy() from inline functions to declarations, so implementations can be provided in lib/linux_compat.c Also simplify kmem_cache_create macro. Co-developed-by: Claude Signed-off-by: Simon Glass --- include/linux/slab.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 2b374641534..599916218d7 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -84,14 +84,15 @@ static inline void *krealloc(const void *p, size_t new_size, gfp_t flags) void *kmemdup(const void *src, size_t len, gfp_t gfp); -/* kmem_cache stubs */ struct kmem_cache { int sz; }; struct kmem_cache *get_mem(int element_sz); -#define kmem_cache_create(a, sz, c, d, e) ({ (void)(a); (void)(e); get_mem(sz); }) +#define kmem_cache_create(a, sz, c, d, e) get_mem(sz) void *kmem_cache_alloc(struct kmem_cache *obj, gfp_t flag); +void kmem_cache_free(struct kmem_cache *cachep, void *obj); +void kmem_cache_destroy(struct kmem_cache *cachep); static inline void *kmem_cache_zalloc(struct kmem_cache *obj, gfp_t flags) { @@ -102,14 +103,4 @@ static inline void *kmem_cache_zalloc(struct kmem_cache *obj, gfp_t flags) return ret; } -static inline void kmem_cache_free(struct kmem_cache *cachep, void *obj) -{ - free(obj); -} - -static inline void kmem_cache_destroy(struct kmem_cache *cachep) -{ - free(cachep); -} - #endif /* _LINUX_SLAB_H */ From patchwork Tue Dec 30 20:51:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1120 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=1767127972; bh=hIDrgfXIpx7M3SdDjOBCRVG7RsBsLwBO3ORr9AvXR/k=; 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=h/0ULPH9Tu1y+jX0lkUtD7ZxFNVIJ6vYsr+uIU+EbuUtYizZwynS9FlQkSSS/njTs h1AX9B+cSPZ6azF3cqdkzLXjWHIf8mdyB62JGHc7e1CZGEtJNwsMhxd9knXoXcYCLf SBGDYFytrIB/DcRwFyWwa7Pi68NT4Da9J4FaC6q6XBBzDK1cWnfVvb2rxe8XAMpUdg ncQle67KHXa7wnXXU2r5rv3UTuE12wcfy0Rbj6BOAMndEAR9Agaznjwa7yPwsBHx7i bv0pM7WiYzTHuxA0muCgYeKiwUSJHTiGRqRNokRdbZ6WSCsNiyVpkb6vzqEuNJN68s 9tku1iTgt+O9g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 705AB68F91 for ; Tue, 30 Dec 2025 13:52:52 -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 WAV-0PEzwMzg for ; Tue, 30 Dec 2025 13:52:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127972; bh=hIDrgfXIpx7M3SdDjOBCRVG7RsBsLwBO3ORr9AvXR/k=; 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=h/0ULPH9Tu1y+jX0lkUtD7ZxFNVIJ6vYsr+uIU+EbuUtYizZwynS9FlQkSSS/njTs h1AX9B+cSPZ6azF3cqdkzLXjWHIf8mdyB62JGHc7e1CZGEtJNwsMhxd9knXoXcYCLf SBGDYFytrIB/DcRwFyWwa7Pi68NT4Da9J4FaC6q6XBBzDK1cWnfVvb2rxe8XAMpUdg ncQle67KHXa7wnXXU2r5rv3UTuE12wcfy0Rbj6BOAMndEAR9Agaznjwa7yPwsBHx7i bv0pM7WiYzTHuxA0muCgYeKiwUSJHTiGRqRNokRdbZ6WSCsNiyVpkb6vzqEuNJN68s 9tku1iTgt+O9g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5FFF168C06 for ; Tue, 30 Dec 2025 13:52:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127969; bh=rn/Liv0Lb9fkQgXfQInp97bYqLSIbhMvIqs1z76QnwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JjxE6Qff7pc/5BlAjN5bd0MoyWjhBZMW3MImQJfZlQVAn/2p/SYLS2Omy3wi894Od ZlyV8kx/NPO7RKZbiqkEmcQaIScwrQrsaEbGwoq95ZiEXipwwJIUgtieWv9PggKVbG //dmTHMFTWYf1MwlmlbkZjYTEgSbLELg1BU8tAaD6lOJf9EDZjNcAh0TZY8eE2qBPR fenvAUkHl4lK1PH1ua4jvNlQO9dLoMTj+irBAdF2hweSpdPUXr3x6IjMwfXqKlwKSD g7SLFAavuVkPhY3w9KsYxEFyV9+j9NvYHpN2TP2n6cYTSWEGPQQ8+LjS82n/FNaWbF fw2Xfnc/iVczA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2C9D168C06; Tue, 30 Dec 2025 13:52:49 -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 rRdH-mD6ohp7; Tue, 30 Dec 2025 13:52:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127968; bh=ywpJC4maZM5ExH1D8BWDsOmGKaydBrMKL9catILbT74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p27/EqTfbMiK8LjbdQTpTyHnmxz++FYnG28FQcuc9yTooNRI1beqrd131nAtpZhQt u4T5DkIMrtSka4hTMd1Xtv7p1JxXHu0eQfIzDF+XeKz1ukHmwFyALwU3GxJ8O5Y3d3 MI7a9FTOiKCR53w7AMbiOAA3YDkZkjQKKiN0D1dtk+uuTGGi8MPyhWUq0PD8ep/Y73 tzcyHhDcVnRIsCDvfQ4w+CMT1jedC5dHoHe9RqmGlLTAFQo0/pBZ/q/Zjg0dHIIcCQ 9IxvfRNEg6RV+GhCD8tlwG1YHwhCTs4H66SBJINb3gxYV4DPhNgBaY8Y+XHGIeRhqu HqukhnKRp3oLg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9821A64C8A; Tue, 30 Dec 2025 13:52:48 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:48 -0700 Message-ID: <20251230205157.3383926-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GXORKN5IARZYDREY72AECOGM3OFC7TW2 X-Message-ID-Hash: GXORKN5IARZYDREY72AECOGM3OFC7TW2 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: Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/14] linux: ext4l: Mark ext4_groupinfo_slab_names unused 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 __maybe_unused to ext4_groupinfo_slab_names since U-Boot's kmem_cache_create macro ignores the name parameter, making the array appear unused to the compiler. Co-developed-by: Claude Signed-off-by: Simon Glass --- fs/ext4l/mballoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4l/mballoc.c b/fs/ext4l/mballoc.c index 6b0926a597b..1d44d9b5cb6 100644 --- a/fs/ext4l/mballoc.c +++ b/fs/ext4l/mballoc.c @@ -409,7 +409,7 @@ static struct kmem_cache *ext4_free_data_cachep; #define NR_GRPINFO_CACHES 8 static struct kmem_cache *ext4_groupinfo_caches[NR_GRPINFO_CACHES]; -static const char * const ext4_groupinfo_slab_names[NR_GRPINFO_CACHES] = { +static const char * const ext4_groupinfo_slab_names[NR_GRPINFO_CACHES] __maybe_unused = { "ext4_groupinfo_1k", "ext4_groupinfo_2k", "ext4_groupinfo_4k", "ext4_groupinfo_8k", "ext4_groupinfo_16k", "ext4_groupinfo_32k", "ext4_groupinfo_64k", "ext4_groupinfo_128k" From patchwork Tue Dec 30 20:51:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1121 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=1767127974; bh=+C5bcEIvpFJ5w2mQzX38s4zZKGWRlE3Ld9vMVQSJcnw=; 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=nT8jibFrFigKOQ/5O4ym22eHIbTEw322U7Aa6xDheeguczJi3XVlYvXAR25IYpaSf vK3yIw7VF2YlpRIDPC0cw5TdWrVa76IHgDS4B/9t7gWIR4jemVtmWTRiudjhLp+XzK 0YfoQ/X01MDrtElOdkju+J4KYYmeSCdmmg4yQWSCJClOMqmFsxY9nfPXqgosIVLcCS EUgVe9EkFXqL0vYDRKq1ouXtbACp2oww1KJxcRGYvBlgM872h72g+5hgGi5rvuQ8HC jPKkVtiB1UPi/g5wYbuDTIPIoazbwyqe3oZNtyuhId+IniCPZjs4dMrF1Inhxjj+3Z XLOM76OWiK8hw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C6E2868BF0 for ; Tue, 30 Dec 2025 13:52:54 -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 y_3F4PDKkOJK for ; Tue, 30 Dec 2025 13:52:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127972; bh=+C5bcEIvpFJ5w2mQzX38s4zZKGWRlE3Ld9vMVQSJcnw=; 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=ICHeV5JDHCDncMp4K470PhSVV56rBvjhbdAZLJBvuzYophXR21dEfa4lZLaAdRTPG vIfJHDPsaXrkp0clsvHVwGNn/qn3ZHGPgro3pzc/eHIyvm53JP2uf+x1MKncJuJp4h IPrSV/UTzpF1BS4Rw2nduv3Brmbp8gdGfYxQuuN4UARysp5EvSjFUvY8n246v34LPR sMFnqkTtGzim21I0HmBeWPGR3k9r/zdg/jfABQ3T2NF1Vh/ZKZom+0lBqUzMUmiflK LPjaoWFidrgxnZLUiGOTIY+/ueNYBrHRsJvGGJpo026/3vYHirioggdMrVF3DWG03n paXADNQyWKgHA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CDF3868C06 for ; Tue, 30 Dec 2025 13:52:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127969; bh=IGKpA3DS5yiaClTHfzuJFkTGgnsso8xifTwrATBPu18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EiO4LYyYz1WyKX9gO3kOEAirEyoPzIoamcSGM3QUGJ72p4RbAx/fBvuTnx5UNpii4 Qh41SibDv/TJjbNCCFNsu9wCrHjJgFt+XZJJOGBeky4FoLKrBBL4T39fJMir+qZy3E RpsR7JsBvYlGO9jTlao4Hqc34h+Bcd06kZffKOP4HmdBvHyvelb9MWcv8+YTkvtrMB tNS7UVLd3XatinSl/qBLZJxVfSv/lpFAY3+RCfuMzv/iMW1d2phrzSghdKwh2wWKiE XI2FTONphkNAoyqzJAMD1r9eUiZKS9fIO+MGNMadSxoeArer52nLUJ3W0VehWl8Itu bXrbC5d8d6tNg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DE76668C0D; Tue, 30 Dec 2025 13:52:49 -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 57QcFPPQ-hDr; Tue, 30 Dec 2025 13:52:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127969; bh=jb2okEEnXLVvrFTPRvKhojcjRQxQGGsIhSanpTfiPUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m5Giwu75veVGrB/APyXA6ihh6/ltZLV0Rgy0pG6pqMnvBvBiQeR0k4ylG1R2Hh1hv DGgpmgQDkqWXWgcwYayGB0tJWTb5itHGkfTKfIhPgVpu5SZs5J8x89VVGJFPDkvKEZ jqSMdHB4wERQ/Jm0lw+WqK1P88SyMHr1iegbOmyLlZP8eq3XyEH8yAngdG+beOhbYd QmWc28WlPZKAj77uGBrntsi2OG/79LR6VTPhMQvnRUJL1RfyAYXSjzBv63lv/S/Zgx Oq/o0emhaL7Rdu4Z6x2FkyyyzGNJ5HV++gcMteJq4zLTlBOsFp0UqLePPWsSeDinec wxLv8EQeh3TsQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 60C4064C8A; Tue, 30 Dec 2025 13:52:49 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:49 -0700 Message-ID: <20251230205157.3383926-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ORT6EUL6JZVHKUGHQ5HBSL5T7W753SPW X-Message-ID-Hash: ORT6EUL6JZVHKUGHQ5HBSL5T7W753SPW 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: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 12/14] linux: ext4l: Export ext4_commit_super function 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 Remove static from ext4_commit_super() to allow calling it from ext4l interface code to sync superblock after write operations. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ext4l/super.c b/fs/ext4l/super.c index 57653c8acb7..9ed6f907b7a 100644 --- a/fs/ext4l/super.c +++ b/fs/ext4l/super.c @@ -38,7 +38,6 @@ static int ext4_load_journal(struct super_block *, struct ext4_super_block *, unsigned long journal_devnum); static int ext4_show_options(struct seq_file *seq, struct dentry *root); static void ext4_update_super(struct super_block *sb); -static int ext4_commit_super(struct super_block *sb); static int ext4_mark_recovery_complete(struct super_block *sb, struct ext4_super_block *es); static int ext4_clear_journal_err(struct super_block *sb, @@ -6153,7 +6152,7 @@ static void ext4_update_super(struct super_block *sb) unlock_buffer(sbh); } -static int ext4_commit_super(struct super_block *sb) +int ext4_commit_super(struct super_block *sb) { struct buffer_head *sbh = EXT4_SB(sb)->s_sbh; From patchwork Tue Dec 30 20:51:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1122 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=1767127978; bh=P/e0MwWim/zfhD1uFAWMBp9pZuwLUmAo4yvkuWXjVNs=; 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=R7PXe+uQGB9mPwra7RgJ9z1cbRTMOfXdpEujfTRJ9C9MHMWnyT7e0dwZTRICxzk7A ilvTmOiXI+tXCBYfxJPCJpo6+zeTMxkKjtR95hp0ggnvZiGgXG66Wwl6fu+jjQ08Ws 58U4xgTGD+rFBZOsLLgGau0HxtzMJAkMY2gB0RRcCQrYLD7rlhbrK8jPnQTanW2mvf ejwBPeEO7aHlbMmndnLVraSmD3ddKGb6XvAcivXU/pTFI6oHZLmD/fhPUXG23d2+Pq iTf5SVL7wIREHnSwiJBAdt7aMecOj3BMh/E/U3sWLzpfX9Z7r9AQHYAfhg9+hupzST DqB0pNZ4z9zvw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A237068F7D for ; Tue, 30 Dec 2025 13:52:58 -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 byVFKz-XPoiy for ; Tue, 30 Dec 2025 13:52:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127978; bh=P/e0MwWim/zfhD1uFAWMBp9pZuwLUmAo4yvkuWXjVNs=; 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=R7PXe+uQGB9mPwra7RgJ9z1cbRTMOfXdpEujfTRJ9C9MHMWnyT7e0dwZTRICxzk7A ilvTmOiXI+tXCBYfxJPCJpo6+zeTMxkKjtR95hp0ggnvZiGgXG66Wwl6fu+jjQ08Ws 58U4xgTGD+rFBZOsLLgGau0HxtzMJAkMY2gB0RRcCQrYLD7rlhbrK8jPnQTanW2mvf ejwBPeEO7aHlbMmndnLVraSmD3ddKGb6XvAcivXU/pTFI6oHZLmD/fhPUXG23d2+Pq iTf5SVL7wIREHnSwiJBAdt7aMecOj3BMh/E/U3sWLzpfX9Z7r9AQHYAfhg9+hupzST DqB0pNZ4z9zvw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8D3AE68C0D for ; Tue, 30 Dec 2025 13:52:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127976; bh=Q47JGQ+7r5vj99HTZTUzkDrb04NWWczuHAeLsbNkEU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BhfrSMfgendgmEt8Hxp6hk89WqqBAqdK7m3RQGncoZ9TgNA+lLKuOMmm7zGOaMCyu BjJYVQgkJwKu7e4UquzDs2D0xp8NItjmHS58fUMjkruVFhFgtGHTlQYQ94oekgY+g1 cO3Gi2rwFHmHJi71BBpRJAvUZuvFrP9hL7q33BuzjcsltEeXl/J/5ummrLhXisO0y9 I3hUSmS6rW7X4roM8M+8qHG4hyVH/IdFT99krAHBuoUhAHPRAkZCdLUcHLPnGQRsuF aQa93ehiMb0UdAt+rhZD5fpY6hRFfiv2wyVAf5A9c7Q5ysDQKIYCYejZrXGOATJNKV CV/TFFPbHczHg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 129FB68BF0; Tue, 30 Dec 2025 13:52:56 -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 qEmRK4i7b51a; Tue, 30 Dec 2025 13:52:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127970; bh=1nTqTqigSPyj2C772ocXdAvIPBGPENt9z1EgCPOjht4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kG6aOX961nWJFyK/UmhQtXCxvy7OxjXqbfR4cYGdvf7ihaLYWvA70sXWcTE/yoDuS Wmb3UCfUsPQc5MAj5HIquoJJn3AHsdavDbNzT3ABzPtsbGc+ScNCk7N9YInFcI02uF 2qYTgYZgrLoFkizCPdvus2T8oEhZNq7BWK/GiY+XalvZvJsQCq8iqZLjkRiqOxXzG6 smi9Vhz6ZsCAokn+xa4bwFoPHWu2omN2rBH5hM9hzw1dnsBLK9R7po6bcKBN7U3Glc 9SvcaRSjmhVQGLJrDjjwAQbwwsKLwU3QHiGNK6pme3wkYvghTMileo5pHDCV+RR00M EaidaKfHSKvXQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2D4F864C8A; Tue, 30 Dec 2025 13:52:50 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:50 -0700 Message-ID: <20251230205157.3383926-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZNX6P7FCCZJNBBNABKH2EAX64MV7FNKA X-Message-ID-Hash: ZNX6P7FCCZJNBBNABKH2EAX64MV7FNKA 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: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 13/14] linux: ext4l: Make cache init/exit functions reentrant for U-Boot 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 In U-Boot, filesystems may be mounted and unmounted multiple times in a single session. The ext4 cache initialization functions would fail on subsequent mounts because the caches were already initialized but pointers were not reset on exit. Add early return checks in init functions when already initialized, and reset cache pointers to NULL in exit functions to allow clean reinitialization. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/block_validity.c | 10 ++++++++++ fs/ext4l/extents_status.c | 6 ++++++ fs/ext4l/mballoc.c | 13 +++++++++++++ 3 files changed, 29 insertions(+) diff --git a/fs/ext4l/block_validity.c b/fs/ext4l/block_validity.c index bff72dcd27c..f110d7ef4c7 100644 --- a/fs/ext4l/block_validity.c +++ b/fs/ext4l/block_validity.c @@ -23,6 +23,12 @@ static struct kmem_cache *ext4_system_zone_cachep; int __init ext4_init_system_zone(void) { +#ifdef __UBOOT__ + /* Already initialized - skip in multiple mount scenarios */ + if (ext4_system_zone_cachep) + return 0; +#endif + ext4_system_zone_cachep = KMEM_CACHE(ext4_system_zone, 0); if (ext4_system_zone_cachep == NULL) return -ENOMEM; @@ -33,6 +39,10 @@ void ext4_exit_system_zone(void) { rcu_barrier(); kmem_cache_destroy(ext4_system_zone_cachep); +#ifdef __UBOOT__ + /* Reset pointer for clean reinitialization */ + ext4_system_zone_cachep = NULL; +#endif } static inline int can_merge(struct ext4_system_zone *entry1, diff --git a/fs/ext4l/extents_status.c b/fs/ext4l/extents_status.c index a3ab26624e7..f557c7c23c2 100644 --- a/fs/ext4l/extents_status.c +++ b/fs/ext4l/extents_status.c @@ -189,6 +189,12 @@ static int __revise_pending(struct inode *inode, ext4_lblk_t lblk, int __init ext4_init_es(void) { +#ifdef __UBOOT__ + /* Already initialized - skip in multiple mount scenarios */ + if (ext4_es_cachep) + return 0; +#endif + ext4_es_cachep = KMEM_CACHE(extent_status, SLAB_RECLAIM_ACCOUNT); if (ext4_es_cachep == NULL) return -ENOMEM; diff --git a/fs/ext4l/mballoc.c b/fs/ext4l/mballoc.c index 1d44d9b5cb6..47863efd1cb 100644 --- a/fs/ext4l/mballoc.c +++ b/fs/ext4l/mballoc.c @@ -4008,6 +4008,12 @@ void ext4_process_freed_data(struct super_block *sb, tid_t commit_tid) int __init ext4_init_mballoc(void) { +#ifdef __UBOOT__ + /* Already initialized - skip in multiple mount scenarios */ + if (ext4_pspace_cachep) + return 0; +#endif + ext4_pspace_cachep = KMEM_CACHE(ext4_prealloc_space, SLAB_RECLAIM_ACCOUNT); if (ext4_pspace_cachep == NULL) @@ -4044,6 +4050,13 @@ void ext4_exit_mballoc(void) kmem_cache_destroy(ext4_ac_cachep); kmem_cache_destroy(ext4_free_data_cachep); ext4_groupinfo_destroy_slabs(); + +#ifdef __UBOOT__ + /* Reset pointers for clean reinitialization */ + ext4_pspace_cachep = NULL; + ext4_ac_cachep = NULL; + ext4_free_data_cachep = NULL; +#endif } #define EXT4_MB_BITMAP_MARKED_CHECK 0x0001 From patchwork Tue Dec 30 20:51:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1123 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=1767127979; bh=MYohzdmgtZ3eFucAGTocZnCPIMAeKj+HUL9CnCnzrAg=; 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=P8REFfIk0P+4kQnYkYAg4AzVueOW8UJmVPw8Rl6soBJa/n9UpEDZQB7RqP3wLPXp+ R9vRCRU92PX3YwoPeNvv2teyB8nuTlZsGgqBEFTlZlCRfHepaF6hNaQWVczWGILLmu vCd36dNeFWchnMzBpxIhLjkQf2iOGByH3UxpqV/wKpzXp+ru8ji4iBq3a4EFt/uuUp 3gPfxo8nfty99Ync84QCH0vm05Ryet78HIg2w0aencVmKe54Ocvii/dRxgRSHkGugu VP6hPQXdMB5BBNsG9peHGqS1mFClf99po84EeoOJJ32BUiJaWetG9+R6TBVbl8vuuh npAWtNNbMKSSw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 100C668F99 for ; Tue, 30 Dec 2025 13:52:59 -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 b2DvUTrQozRR for ; Tue, 30 Dec 2025 13:52:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127979; bh=MYohzdmgtZ3eFucAGTocZnCPIMAeKj+HUL9CnCnzrAg=; 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=P8REFfIk0P+4kQnYkYAg4AzVueOW8UJmVPw8Rl6soBJa/n9UpEDZQB7RqP3wLPXp+ R9vRCRU92PX3YwoPeNvv2teyB8nuTlZsGgqBEFTlZlCRfHepaF6hNaQWVczWGILLmu vCd36dNeFWchnMzBpxIhLjkQf2iOGByH3UxpqV/wKpzXp+ru8ji4iBq3a4EFt/uuUp 3gPfxo8nfty99Ync84QCH0vm05Ryet78HIg2w0aencVmKe54Ocvii/dRxgRSHkGugu VP6hPQXdMB5BBNsG9peHGqS1mFClf99po84EeoOJJ32BUiJaWetG9+R6TBVbl8vuuh npAWtNNbMKSSw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0068068C0D for ; Tue, 30 Dec 2025 13:52:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127976; bh=hzkr3ALsAkp4gtV9dNATBMj25OfIb2g5AeNT9KZ065k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tPrebfnLOVPhg0bUElmm6DUxdwDBAqpkas6oVB/WO1OSLdU3NDcWBlBDTV0KmN/oP bzi4sNgaI67D9xkIVNsTRYZg9RzDk1EjFzzG0c8GonmpKvC5TdtlhiZ4lsRcXyzdBE AGNTnOn2AelcLkfFmXy6hiw89DmPN0o7SNhWzDoM28s8fsDyTPdyQwBL3xMvhiQ1ci x2AF2C/2MTLn1XvwEGw82bMGI9FF7Jlgh4mxvSGI9JsMCrUiCxCeFeaAh5M8f7f9Ok 7dUz+ORvwYcMWLSkW6Y4h/eT5opVqiWstbyA0wW8Y2ex2pnfWORnHJAaTiCQmvktsb Cf/ptXX7YwbOA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 285A564C8A; Tue, 30 Dec 2025 13:52:56 -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 Wxh_bNdXOMQc; Tue, 30 Dec 2025 13:52:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127975; bh=WR01wCWroav8nzh8fve+YnOtRqOzL5saK5Zdd1vCU5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJY9s0DR0aww4bDygh9bCC5V3cRG0Gg+wyeUxmkm9yS+3X8fi0IS5z3wPhVaI3tJ0 sY+KwQc4PLEyaCvDbO/yMe+1gSS/1QAwWQkbv2akXQbRoXH8P+RBcZNPJOQim2nfJN 84XcE8+MF3m/V4kwRB+kE1n1to0HlxTzXpnfpUzIX6F+glEVniUIe+HAPtHMUFtAKm /rXzMYe2XxZViiNVuS90ZfQUaFUDYBsqNZG3OyGBvMJ2brVNu0JQ8GfQ1ELkN6+xtL JM1l6KKgwTIyU9s5YNryRUqP7ryLgXw+bqUMZoyolBt8rHZriM6TvxeVcw4TN6+d+M ftQOvpKHQjplg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BFE6B68F6F; Tue, 30 Dec 2025 13:52:54 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:51 -0700 Message-ID: <20251230205157.3383926-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: YVTN2CKEDIMHG74LIYR4MJN7NR2NUXCM X-Message-ID-Hash: YVTN2CKEDIMHG74LIYR4MJN7NR2NUXCM 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: Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 14/14] linux: ext4l: Initialize len in ext4_ext_find_hole 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 Initialize 'len' to 0 to silence a Clang warning about the potential use of an uninitialised variable. The else branch calls BUG() which never returns, but Clang cannot determine this. Co-developed-by: Claude Signed-off-by: Simon Glass --- fs/ext4l/extents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4l/extents.c b/fs/ext4l/extents.c index 7690f4075db..955f587426b 100644 --- a/fs/ext4l/extents.c +++ b/fs/ext4l/extents.c @@ -2252,7 +2252,7 @@ static ext4_lblk_t ext4_ext_find_hole(struct inode *inode, { int depth = ext_depth(inode); struct ext4_extent *ex; - ext4_lblk_t len; + ext4_lblk_t len = 0; ex = path[depth].p_ext; if (ex == NULL) {