From patchwork Sun Dec 21 11:38:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1014 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=1766317151; bh=tppaQbmKolcQwBn+nMs6fkJlXkOugyjA0kUHAM94uXI=; 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=trQxizf8lFnpi8/OKv4RM08QVhj6nEDo1bclQT21eSnyyhtQgJ/2v/1y5j0a0z7u+ jNn9DGkaI2IOn6zEYdfK7CsI4H/18kBWiKM9bCj/zI7+uwK1yPHsHDbApYG0yRrAST ILJYsZV3y+azvtq8ScUDSHGar3Cmoqiix0yH6VfPAM8RlzSTBIyUAVugizxWKCj9CC OhRxlpnQkJYf1nLTpRAPyi0BkQo8epUVt5HgfVsoQZC74rrI0D5k59eMCrpHnzKthj ur5lT/a/sGj9zCMMC9PzHClTvJ/67Wbq1wzo09rV11o8mpOEr59Rj71xO9cOYPCOnG oVI5XCH++gCeQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9FEF264CF2 for ; Sun, 21 Dec 2025 04:39:11 -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 vnMNlxwDoNX6 for ; Sun, 21 Dec 2025 04:39:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766317150; bh=tppaQbmKolcQwBn+nMs6fkJlXkOugyjA0kUHAM94uXI=; 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=iOJaptYsj2Hjx4eZzDxqpbj7Z4/kHzMqifHzvqE44YrfzIPMLmaE+856Ycwe74Prg /Z9p46WuFBjR1TEraJQOWDB9+n0Iyul6rjHfk1BWSZ6hBHP9qlTl8XOes94ij1JRtz WAkYNVTYMef6wkQuFf+zS4wNW9fN4mxc67F/Kh9N48lMS5RF93vWgjkgXUu1JEOWmL CyH8XjZsAuGQ3U1rOBqjYfTuNMBsQuwHSwzUIHzx46riMDn6uOlX6LtfqjPQCFKCma k2jGmDhHGRMdLJhC1eNdtj9aHkbIYanVRB+OtydYlfhLb8rYGVyCBMTJDd4ymo8KLm sVSDsDauM6iwg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 776CF64CEA for ; Sun, 21 Dec 2025 04:39:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766317149; bh=kZtr9uYB6hNbRYFBy/Q7TtstkCFgdB/dl5M+Mn0wYJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vgZ1CUIOcKoMr8QNPaN0asxzch+rjdWVj3qpFqq9dLBfyhZMSE7qMkZvOno3+Sj6r mqhp6XrrR6ZnXBKKLbllOsoEKI9xvIPJYn95bTWaAURVqV/1c5SiOkhkipeDDICNak N4zmp7xkbjDyLV4jvFQ68GRt7gBgcycVsau9E+vnthqunH2k1T+irIH9fBqGjTD0Fl 3SBmG4MntBRI51ePlzGU+tJZ4xAWKOaK6IPGA0r7KmjyXbtc9czuFaFLhpGL1NrX48 oltm1EskLxevi0riKh+7ZvtiYeICEqCPCgq+NkJxgV6whoiUxdfLBfdX9CGwCXV3uo IVkFR98F0d1fA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 08CF264D07; Sun, 21 Dec 2025 04:39:09 -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 gUH6rVAGez3E; Sun, 21 Dec 2025 04:39:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766317146; bh=FtdbekDcHBUMbJ4HXONA/yv7tbfdD5XdytEjoH0TgF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wJ70N8ZwbGZAh727RI+vrUxD/JwKeRt1Ln/hT+Lv7fZoYEfXGi3AV6GKE8U87ddGR VKBDRklu5pkXjPyMFXgzWAwCIu+A0EuJ1y4D8HYwQwZcA94db2PcRwbYNazNB/bA+5 aTtJEyq1lz13QDdtfxJYfxxtCK9Vje/zKSLjV6XSAoBuNw+Btn67BdBlyi8imCZodK OJfsewAsWhDgPdQlgi1nqO9Y6QStCxHY22E88PfTaoLhOK25dvFEMaE9IrT1pYeYmi vZ8OHJG0GDV/gsm+j2OZkTDcJ10rjOfsiIMC3tnrH10bLWCRxKsJHfSLQaAnn+Os8z ikssOd8wN9Gzg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 19B7664CF1; Sun, 21 Dec 2025 04:39:06 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 21 Dec 2025 04:38:16 -0700 Message-ID: <20251221113820.812060-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251221113820.812060-1-sjg@u-boot.org> References: <20251221113820.812060-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZXZ3VHUDAJNMEXIHQOJN2YEY5SC64VHM X-Message-ID-Hash: ZXZ3VHUDAJNMEXIHQOJN2YEY5SC64VHM 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 10/10] ext4l: Add fast_commit.c to build 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 the fast commit module (fast_commit.c) to the build. This implements ext4's fast commit journaling feature for improved performance. Stubs added for: - Wait bit operations (DEFINE_WAIT_BIT, bit_waitqueue, etc.) - Dentry name snapshot operations - Fast commit trace functions - JBD2 fast commit functions (jbd2_fc_get_buf, jbd2_fc_begin_commit, etc.) - Dentry allocation (d_alloc, d_drop) - get_current_ioprio, wake_up_bit - REQ_IDLE, REQ_PREFLUSH block I/O flags Move name_snapshot struct definition after qstr is defined. Remove fast commit stub functions now implemented in fast_commit.c. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 2 +- fs/ext4l/ext4_uboot.h | 82 ++++++++++++++++++++++++--- fs/ext4l/fast_commit.c | 6 +- fs/ext4l/stub.c | 118 +++++++++++++++++++-------------------- include/linux/seq_file.h | 6 +- 5 files changed, 137 insertions(+), 77 deletions(-) diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index 3116ac3be39..4003a1f2317 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -11,4 +11,4 @@ obj-y += balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \ namei.o page-io.o readpage.o \ super.o symlink.o xattr.o \ xattr_hurd.o xattr_trusted.o \ - xattr_user.o orphan.o + xattr_user.o fast_commit.o orphan.o diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index a6ffc91b7de..82b68056953 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -114,11 +114,6 @@ struct rb_root { /* percpu_counter - use Linux header */ #include -/* name_snapshot - stub */ -struct name_snapshot { - const char *name; -}; - /* Project ID type */ typedef struct { unsigned int val; } kprojid_t; @@ -552,6 +547,11 @@ struct dentry { struct dentry *d_parent; }; +/* name_snapshot - for dentry name snapshots */ +struct name_snapshot { + struct qstr name; +}; + /* vm_fault_t - stub */ typedef unsigned int vm_fault_t; @@ -1968,10 +1968,6 @@ struct kstatfs { /* seq_file stubs */ struct seq_file; -#define seq_printf(m, fmt, ...) do { } while (0) -#define seq_puts(m, s) do { } while (0) -#define seq_putc(m, c) do { } while (0) -#define seq_escape(m, s, esc) do { } while (0) /* Module stubs */ struct module; @@ -2704,4 +2700,72 @@ typedef void *mempool_t; #define block_read_full_folio(folio, get_block) \ ({ (void)(folio); (void)(get_block); 0; }) +/* + * Stubs for fast_commit.c + */ + +/* Wait bit operations - stubbed for single-threaded U-Boot */ +struct wait_bit_entry { + struct list_head wq_entry; +}; +#define DEFINE_WAIT_BIT(name, word, bit) \ + struct wait_bit_entry name = { } +#define bit_waitqueue(word, bit) \ + ({ (void)(word); (void)(bit); (wait_queue_head_t *)NULL; }) +#define prepare_to_wait(wq, wait, state) \ + do { (void)(wq); (void)(wait); (void)(state); } while (0) +#define finish_wait(wq, wait) \ + do { (void)(wq); (void)(wait); } while (0) + +/* Dentry name snapshot operations */ +#define take_dentry_name_snapshot(snap, dentry) \ + do { (snap)->name = (dentry)->d_name; } while (0) +#define release_dentry_name_snapshot(snap) \ + do { (void)(snap); } while (0) + +/* Fast commit trace stubs */ +#define trace_ext4_fc_track_unlink(handle, inode, dentry, ret) \ + do { (void)(handle); (void)(inode); (void)(dentry); (void)(ret); } while (0) +#define trace_ext4_fc_track_link(handle, inode, dentry, ret) \ + do { (void)(handle); (void)(inode); (void)(dentry); (void)(ret); } while (0) +#define trace_ext4_fc_track_create(handle, inode, dentry, ret) \ + do { (void)(handle); (void)(inode); (void)(dentry); (void)(ret); } while (0) +#define trace_ext4_fc_track_inode(handle, inode, ret) \ + do { (void)(handle); (void)(inode); (void)(ret); } while (0) +#define trace_ext4_fc_track_range(handle, inode, start, end, ret) \ + do { (void)(handle); (void)(inode); (void)(start); (void)(end); (void)(ret); } while (0) + +/* lockdep stubs */ +#define lockdep_assert_not_held(lock) do { (void)(lock); } while (0) + +/* Request flags for block I/O */ +#define REQ_IDLE 0 +#define REQ_PREFLUSH 0 + +/* Fast commit trace stubs */ +#define trace_ext4_fc_cleanup(sb, full, reason) \ + do { (void)(sb); (void)(full); (void)(reason); } while (0) +#define trace_ext4_fc_stats(sb) \ + do { (void)(sb); } while (0) +#define trace_ext4_fc_commit_start(sb, tid) \ + do { (void)(sb); (void)(tid); } while (0) +#define trace_ext4_fc_commit_stop(sb, nblks, status, tid) \ + do { (void)(sb); (void)(nblks); (void)(status); (void)(tid); } while (0) + +/* wake_up_bit - wake up threads waiting on a bit */ +#define wake_up_bit(word, bit) do { (void)(word); (void)(bit); } while (0) + +/* Dentry allocation stubs */ +#define d_alloc(parent, name) ({ (void)(parent); (void)(name); (struct dentry *)NULL; }) +#define d_drop(dentry) do { (void)(dentry); } while (0) + +/* More fast commit trace stubs */ +#define trace_ext4_fc_replay_scan(sb, err, off) \ + do { (void)(sb); (void)(err); (void)(off); } while (0) +#define trace_ext4_fc_replay(sb, tag, ino, priv1, priv2) \ + do { (void)(sb); (void)(tag); (void)(ino); (void)(priv1); (void)(priv2); } while (0) + +/* get_current_ioprio - I/O priority (not used in U-Boot) */ +#define get_current_ioprio() (0) + #endif /* __EXT4_UBOOT_H__ */ diff --git a/fs/ext4l/fast_commit.c b/fs/ext4l/fast_commit.c index fa66b08de99..ea5be3a079c 100644 --- a/fs/ext4l/fast_commit.c +++ b/fs/ext4l/fast_commit.c @@ -7,12 +7,12 @@ * * Ext4 fast commits routines. */ +#include "ext4_uboot.h" + #include "ext4.h" #include "ext4_jbd2.h" #include "ext4_extents.h" #include "mballoc.h" - -#include /* * Ext4 Fast Commits * ----------------- @@ -2291,7 +2291,7 @@ void ext4_fc_init(struct super_block *sb, journal_t *journal) journal->j_fc_cleanup_callback = ext4_fc_cleanup; } -static const char * const fc_ineligible_reasons[] = { +static __maybe_unused const char * const fc_ineligible_reasons[] = { [EXT4_FC_REASON_XATTR] = "Extended attributes changed", [EXT4_FC_REASON_CROSS_RENAME] = "Cross rename", [EXT4_FC_REASON_JOURNAL_FLAG_CHANGE] = "Journal flag changed", diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 87637ecbd8c..2b2b777d1f2 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -175,10 +175,7 @@ struct extent_status; /* ext4_is_pending is now in extents_status.c */ /* ext4_convert_inline_data is now in inline.c */ -void ext4_fc_mark_ineligible(struct super_block *sb, int reason, - void *handle) -{ -} +/* ext4_fc_mark_ineligible is now in fast_commit.c */ /* ext4_es_lookup_extent is now in extents_status.c */ @@ -188,17 +185,62 @@ void ext4_fc_mark_ineligible(struct super_block *sb, int reason, /* ext4_mb_mark_bb is now in mballoc.c */ -void ext4_fc_record_regions(struct super_block *sb, int ino, - unsigned long lblk, unsigned long long pblk, - int len, int mapped) +/* ext4_fc_record_regions is now in fast_commit.c */ + +/* ext4_fc_replay_check_excluded is now in fast_commit.c */ + +/* + * JBD2 fast commit stubs + */ +int jbd2_fc_get_buf(void *journal, struct buffer_head **bh_out) +{ + *bh_out = NULL; + return -ENOSPC; +} + +void jbd2_fc_release_bufs(void *journal) { } -int ext4_fc_replay_check_excluded(struct super_block *sb, unsigned long long blk) +int jbd2_fc_begin_commit(void *journal, unsigned int tid) +{ + return -EOPNOTSUPP; +} + +int jbd2_fc_end_commit(void *journal) { return 0; } +int jbd2_fc_end_commit_fallback(void *journal) +{ + return 0; +} + +int jbd2_submit_inode_data(void *journal, void *jinode) +{ + return 0; +} + +int jbd2_wait_inode_data(void *journal, void *jinode) +{ + return 0; +} + +int jbd2_fc_wait_bufs(void *journal, int num) +{ + return 0; +} + +int jbd2_complete_transaction(void *journal, unsigned int tid) +{ + return 0; +} + +void ext4_reset_inode_seed(struct inode *inode) +{ +} + /* * Stubs for page-io.c */ @@ -257,10 +299,7 @@ int jbd2_journal_inode_ranged_write(void *handle, struct inode *inode, /* ext4_read_bh_lock is now in super.c */ /* Fast commit */ -int ext4_fc_commit(void *journal, unsigned int tid) -{ - return 0; -} +/* ext4_fc_commit is now in fast_commit.c */ /* ext4_force_commit is now in super.c */ @@ -284,12 +323,7 @@ int jbd2_log_wait_commit(void *journal, unsigned int tid) return 0; } -/* Fast commit */ -void ext4_fc_track_range(void *handle, struct inode *inode, - unsigned long long start, unsigned long long end) -{ -} - +/* ext4_fc_track_range is now in fast_commit.c */ /* JBD2 journal update locking */ void jbd2_journal_lock_updates(void *journal) @@ -306,14 +340,8 @@ int jbd2_journal_flush(void *journal, unsigned int flags) } -/* Fast commit */ -void ext4_fc_track_inode(void *handle, struct inode *inode) -{ -} - -void ext4_fc_init_inode(void **head, struct inode *inode) -{ -} +/* ext4_fc_track_inode is now in fast_commit.c */ +/* ext4_fc_init_inode is now in fast_commit.c */ /* JBD2 */ int jbd2_journal_inode_ranged_wait(void *handle, struct inode *inode, @@ -372,33 +400,7 @@ ssize_t generic_read_dir(struct file *f, char *buf, size_t count, loff_t *ppos) /* Inline dir stubs are now in inline.c */ -/* Fast commit stubs */ -void ext4_fc_track_unlink(void *handle, struct dentry *dentry) -{ -} - -void ext4_fc_track_link(void *handle, struct dentry *dentry) -{ -} - -void ext4_fc_track_create(void *handle, struct dentry *dentry) -{ -} - -void __ext4_fc_track_link(void *handle, struct inode *inode, - struct dentry *dentry) -{ -} - -void __ext4_fc_track_unlink(void *handle, struct inode *inode, - struct dentry *dentry) -{ -} - -void __ext4_fc_track_create(void *handle, struct inode *inode, - struct dentry *dentry) -{ -} +/* Fast commit stubs are now in fast_commit.c */ /* fileattr stubs */ int ext4_fileattr_get(struct dentry *dentry, void *fa) @@ -603,10 +605,7 @@ void set_task_ioprio(void *task, int ioprio) { } -/* Fast commit */ -void ext4_fc_init(void *sb, void *journal) -{ -} +/* ext4_fc_init is now in fast_commit.c */ /* Filesystem sync */ int sync_filesystem(void *sb) @@ -784,10 +783,7 @@ char *file_path(struct file *file, char *buf, int buflen) return buf; } -/* Fast commit delete */ -void ext4_fc_del(struct inode *inode) -{ -} +/* ext4_fc_del is now in fast_commit.c */ /* invalidate_inode_buffers is now a macro in ext4_uboot.h */ /* clear_inode is now a macro in ext4_uboot.h */ diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 5b6495d1003..e4139f48e16 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -12,8 +12,8 @@ struct seq_file { struct file *file; }; -#define seq_printf(m, fmt, ...) do { } while (0) -#define seq_puts(m, s) do { } while (0) -#define seq_putc(m, c) do { } while (0) +#define seq_printf(m, fmt, ...) do { (void)(m); } while (0) +#define seq_puts(m, s) do { (void)(m); (void)(s); } while (0) +#define seq_putc(m, c) do { (void)(m); (void)(c); } while (0) #endif /* _LINUX_SEQ_FILE_H */