From: Simon Glass <simon.glass@canonical.com> Add fsync.c which provides filesystem sync operations. Changes needed: - Add ext4_uboot.h include to fsync.c - Remove redundant Linux header includes - Add trace_ext4_sync_file_enter/exit stubs - Add dentry operation stubs (d_find_any_alias, dget_parent) - Add sync operation stubs (sync_mapping_buffers, sync_inode_metadata, generic_buffers_fsync_noflush, file_write_and_wait_range, file_check_and_advance_wb_err) - Add jbd2_trans_will_send_data_barrier stub - Remove ext4_sync_file stub from stub.c (now in fsync.c) Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/Makefile | 2 +- fs/ext4l/ext4_uboot.h | 13 +++++++++++++ fs/ext4l/fsync.c | 9 +-------- fs/ext4l/stub.c | 10 ++++++---- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index 73083e82cd8..96caa289be0 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -6,7 +6,7 @@ obj-y := interface.o stub.o obj-y += balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \ - extents_status.o file.o hash.o ialloc.o \ + extents_status.o file.o fsync.o hash.o ialloc.o \ indirect.o inode.o \ super.o xattr_hurd.o xattr_trusted.o \ xattr_user.o orphan.o diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 5f466dbf005..0f0e9c91a12 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1289,6 +1289,19 @@ typedef unsigned int projid_t; #define trace_ext4_write_begin(...) do { } while (0) #define trace_ext4_write_end(...) do { } while (0) #define trace_ext4_journalled_write_end(...) do { } while (0) +#define trace_ext4_sync_file_enter(...) do { } while (0) +#define trace_ext4_sync_file_exit(...) do { } while (0) + +/* Dentry operations - stubs */ +#define d_find_any_alias(i) ({ (void)(i); (struct dentry *)NULL; }) +#define dget_parent(d) ({ (void)(d); (struct dentry *)NULL; }) + +/* Sync operations - stubs */ +#define sync_mapping_buffers(m) ({ (void)(m); 0; }) +#define sync_inode_metadata(i, w) ({ (void)(i); (void)(w); 0; }) +#define generic_buffers_fsync_noflush(f, s, e, d) ({ (void)(f); (void)(s); (void)(e); (void)(d); 0; }) +#define file_write_and_wait_range(f, s, e) ({ (void)(f); (void)(s); (void)(e); 0; }) +#define file_check_and_advance_wb_err(f) ({ (void)(f); 0; }) /* DAX stubs - DAX not supported in U-Boot */ #define IS_DAX(inode) (0) diff --git a/fs/ext4l/fsync.c b/fs/ext4l/fsync.c index e476c6de307..42a9e2bdbff 100644 --- a/fs/ext4l/fsync.c +++ b/fs/ext4l/fsync.c @@ -23,18 +23,11 @@ * we can depend on generic_block_fdatasync() to sync the data blocks. */ -#include <linux/time.h> -#include <linux/fs.h> -#include <linux/sched.h> -#include <linux/writeback.h> -#include <linux/blkdev.h> -#include <linux/buffer_head.h> +#include "ext4_uboot.h" #include "ext4.h" #include "ext4_jbd2.h" -#include <trace/events/ext4.h> - /* * If we're not journaling and this is a just-created file, we have to * sync our parent directory (if it was freshly created) since diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index b378eab97a3..4dac514340c 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -107,6 +107,11 @@ int jbd2__journal_restart(void *handle, int nblocks, int revoke_records, return 0; } +int jbd2_trans_will_send_data_barrier(journal_t *journal, unsigned long tid) +{ + return 0; +} + /* * Stubs for balloc.c */ @@ -512,10 +517,7 @@ int ext4_dirblock_csum_verify(struct inode *inode, struct buffer_head *bh) /* ext4_ioctl is now in super.c */ -int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) -{ - return 0; -} +/* ext4_sync_file is now in fsync.c */ /* * Stubs for super.c -- 2.43.0