ext4l: Add fast_commit.c to build

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.

Series-to: concept
Cover-letter:
ext4l: Add more ext4 files to the build (part E)
This adds more files to the build. Most are fairly small but some still
require a fair few additions to ext4_uboot.h and the stub.c files.

At this point, we are close to having all the files in place, so can
move on to actually making ext4 work.
END

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-20 17:46:29 -07:00
committed by Simon Glass
parent 6447413a63
commit 717c508ac9
5 changed files with 137 additions and 77 deletions

View File

@@ -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

View File

@@ -114,11 +114,6 @@ struct rb_root {
/* percpu_counter - use Linux header */
#include <linux/percpu_counter.h>
/* 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__ */

View File

@@ -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 <linux/lockdep.h>
/*
* 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",

View File

@@ -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 */

View File

@@ -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 */