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,