From patchwork Thu Jan 8 18:51:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1354 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=1767898377; bh=xyHyVLbb0+NXWm+Of8FzJyDNCGpPvCTuzP19aRIE4b8=; 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=OqwVqbqs4CQ2f14fHDfuxWhgt1TQuVu/aMrXf4k27T9Ninw/1Zxn0x8GWgxfPGWaz YLTmiOEQpZcSQg+fPXBmzZjK26MVK6q+bLZ86Z61V/rPchJlt7l8zJBSpYrh8Kg6KJ V1ApiG8LDS5c+a/lBCpbqZQSgq7djZsgSDyQZFexMGCsqghdCnSLK0WPR90ErKT2+i bXGoDQWNek5Hfva34mEUkQqNfM8tF1HsmllPQpZtTK3vJp29tbcChs0Yyc03JL+1Yi UFNrG5DiVB6qrWyQ/gT1cHjuTGpHweW5mN96PAMDpkoJxgufQqY5yZmYEVIAKLLZ0V Q+d4AVg5MWUFQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B3CE9691D0 for ; Thu, 8 Jan 2026 11:52:57 -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 eE5PdqF-a6B8 for ; Thu, 8 Jan 2026 11:52:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898377; bh=xyHyVLbb0+NXWm+Of8FzJyDNCGpPvCTuzP19aRIE4b8=; 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=OqwVqbqs4CQ2f14fHDfuxWhgt1TQuVu/aMrXf4k27T9Ninw/1Zxn0x8GWgxfPGWaz YLTmiOEQpZcSQg+fPXBmzZjK26MVK6q+bLZ86Z61V/rPchJlt7l8zJBSpYrh8Kg6KJ V1ApiG8LDS5c+a/lBCpbqZQSgq7djZsgSDyQZFexMGCsqghdCnSLK0WPR90ErKT2+i bXGoDQWNek5Hfva34mEUkQqNfM8tF1HsmllPQpZtTK3vJp29tbcChs0Yyc03JL+1Yi UFNrG5DiVB6qrWyQ/gT1cHjuTGpHweW5mN96PAMDpkoJxgufQqY5yZmYEVIAKLLZ0V Q+d4AVg5MWUFQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A27B9691CC for ; Thu, 8 Jan 2026 11:52:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898377; bh=Rp2kh0vyBDM7mKYgfuKg66y2EhW0itjj0sslsm35ML0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wS6U/3OBcJmIHyvgKL6Rg0s8C2SJui7UX/cJx330p4BxSsWNfW/mOjFdWyikS6yoY QIL1tn/YU68z5z0kGoW8OI6YGLiuzXJjnSzH23MBkJZ1hEwDlkafgjMFoBRz731p/L VWfxp5wekaKYhkhyHsHeSOiQrshqywHdzrdeN847Gl2io0EiLwzJVoDXmB97Dg4qDj vuwaHx+H9I/ZZJwRAM3YdbEDXNkPmwxweA3comrZhormE0sAPCV9g17THGoGmKbQKO yXHrLfNhKQOoaMT5sDXoXwXz2KPmc/QEONS6dRGV12fah6PQDl+/9KN7TOo14d6sG7 RpEv0DiDatY4g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1503269101; Thu, 8 Jan 2026 11:52:57 -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 ci7W63ibU1dw; Thu, 8 Jan 2026 11:52:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767898373; bh=Oc8BYuhj/+txlJWo9R1pcbBdZ0cXped1NNOCn+7iPqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZgwviVLtHOJ/057Ow6D32eSMoyAEFdmCm6R4g48+5jM8ujdVqXNmHTbA11swjNHVg O6JjrvavPP083YJBHpa1ZE2TgrGXT3iGFl7VxHHPYcuo79iM8RMe2uA07tbB0x78Wx mc97uBHv1lzMHnB2A2b4Pew4Y1CXBsI3PMGNqxaeu8UqH2sR9qUCOXR5LjHwECFONE 6iw1TwCabwW15zgiDDjXrkRbICi/lUTyrWtuPDDODY5oWgNkvX5s7MehyU8IQgBCHk SwSpkuv1hOD0aURqda0hhLTXGUlylnDosITAcyRh6DuyhxSAW5AQs8Aa4MMsVldFdv f2DW40FjIVPNQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A709669057; Thu, 8 Jan 2026 11:52:52 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 8 Jan 2026 11:51:28 -0700 Message-ID: <20260108185149.1995917-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108185149.1995917-1-sjg@u-boot.org> References: <20260108185149.1995917-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FSVGG5ZNKHF3G2GIMNLOX6RHR5THQ7Z3 X-Message-ID-Hash: FSVGG5ZNKHF3G2GIMNLOX6RHR5THQ7Z3 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 13/21] ext4l: Add a CONFIG_EXT4_FAST_COMMIT_REPLAY option 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 new Kconfig option to control fast commit replay support. Fast commit replay is needed to recover filesystems that were not cleanly unmounted and have pending fast commit records. However, this adds to code size (~8K). Enable it by default, since filesystems are likely to need this. When disabled: - Filesystems with pending fast commits cannot be recovered - Only safe if filesystems are created with -O ^fast_commit or always cleanly unmounted Guard the replay functions in fast_commit.c and provide inline stubs in ext4.h. Update firefly-rk3288_defconfig to disable this feature for space savings. Co-developed-by: Claude Signed-off-by: Simon Glass --- fs/ext4l/Kconfig | 17 +++++++++++++++++ fs/ext4l/ext4.h | 27 ++++++++++++++++++++++----- fs/ext4l/fast_commit.c | 4 ++++ 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/fs/ext4l/Kconfig b/fs/ext4l/Kconfig index 3d7578f5073..22b290778b7 100644 --- a/fs/ext4l/Kconfig +++ b/fs/ext4l/Kconfig @@ -125,3 +125,20 @@ config EXT4_MBALLOC_PREFETCH reduced during lazy initialization. If unsure, say Y. + +config EXT4_FAST_COMMIT_REPLAY + bool "Enable ext4 fast commit replay support" + depends on FS_EXT4L + default y + help + Enable support for replaying fast commit records during mount. + Fast commit is a journal optimization that records fine-grained + changes. If a filesystem was not cleanly unmounted and has + pending fast commit records, this option is needed to recover. + + Disabling this saves space (~8K) but means filesystems with + pending fast commits cannot be recovered. Only disable if you're + certain your filesystems won't have fast commit records (e.g., + created with -O ^fast_commit). + + If unsure, say Y. diff --git a/fs/ext4l/ext4.h b/fs/ext4l/ext4.h index d01955bf59a..b8e9f2d8c95 100644 --- a/fs/ext4l/ext4.h +++ b/fs/ext4l/ext4.h @@ -2946,6 +2946,28 @@ extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate); int ext4_fc_info_show(struct seq_file *seq, void *v); void ext4_fc_init(struct super_block *sb, journal_t *journal); void ext4_fc_init_inode(struct inode *inode); + +#ifdef CONFIG_EXT4_FAST_COMMIT_REPLAY +bool ext4_fc_replay_check_excluded(struct super_block *sb, ext4_fsblk_t block); +void ext4_fc_replay_cleanup(struct super_block *sb); +int ext4_fc_record_regions(struct super_block *sb, int ino, + ext4_lblk_t lblk, ext4_fsblk_t pblk, + int len, int replay); +#else +static inline bool ext4_fc_replay_check_excluded(struct super_block *sb, + ext4_fsblk_t block) +{ + return false; +} +static inline void ext4_fc_replay_cleanup(struct super_block *sb) {} +static inline int ext4_fc_record_regions(struct super_block *sb, int ino, + ext4_lblk_t lblk, ext4_fsblk_t pblk, + int len, int replay) +{ + return 0; +} +#endif + void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t start, ext4_lblk_t end); void __ext4_fc_track_unlink(handle_t *handle, struct inode *inode, @@ -2960,14 +2982,9 @@ void ext4_fc_track_create(handle_t *handle, struct dentry *dentry); void ext4_fc_track_inode(handle_t *handle, struct inode *inode); void ext4_fc_mark_ineligible(struct super_block *sb, int reason, handle_t *handle); void ext4_fc_del(struct inode *inode); -bool ext4_fc_replay_check_excluded(struct super_block *sb, ext4_fsblk_t block); -void ext4_fc_replay_cleanup(struct super_block *sb); int ext4_fc_commit(journal_t *journal, tid_t commit_tid); int __init ext4_fc_init_dentry_cache(void); void ext4_fc_destroy_dentry_cache(void); -int ext4_fc_record_regions(struct super_block *sb, int ino, - ext4_lblk_t lblk, ext4_fsblk_t pblk, - int len, int replay); /* mballoc.c */ extern const struct seq_operations ext4_mb_seq_groups_ops; diff --git a/fs/ext4l/fast_commit.c b/fs/ext4l/fast_commit.c index ea5be3a079c..4383579ccb1 100644 --- a/fs/ext4l/fast_commit.c +++ b/fs/ext4l/fast_commit.c @@ -1360,6 +1360,7 @@ static void ext4_fc_cleanup(journal_t *journal, int full, tid_t tid) trace_ext4_fc_stats(sb); } +#ifdef CONFIG_EXT4_FAST_COMMIT_REPLAY /* Ext4 Replay Path Routines */ /* Helper struct for dentry replay routines */ @@ -2277,6 +2278,7 @@ static int ext4_fc_replay(journal_t *journal, struct buffer_head *bh, } return ret; } +#endif /* CONFIG_EXT4_FAST_COMMIT_REPLAY */ void ext4_fc_init(struct super_block *sb, journal_t *journal) { @@ -2285,7 +2287,9 @@ void ext4_fc_init(struct super_block *sb, journal_t *journal) * could still have fast commit blocks that need to be replayed even if * fast commit has now been turned off. */ +#ifdef CONFIG_EXT4_FAST_COMMIT_REPLAY journal->j_fc_replay_callback = ext4_fc_replay; +#endif if (!test_opt2(sb, JOURNAL_FAST_COMMIT)) return; journal->j_fc_cleanup_callback = ext4_fc_cleanup;