From: Simon Glass <simon.glass@canonical.com> Add recovery.c to the jbd2 Makefile and update includes to use the ext4l compatibility layer. Add stubs for revoke.c functions that recovery.c depends on and tweak a few so things build. Fix sync_blockdev to return int instead of void. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 4 +++- fs/ext4l/stub.c | 24 +++++++++++++++++++++--- fs/jbd2/Makefile | 2 +- fs/jbd2/recovery.c | 13 ++----------- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 0d24940e74e..25756d29cf6 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -2162,7 +2162,7 @@ int percpu_init_rwsem(struct percpu_rw_semaphore *sem); void percpu_free_rwsem(struct percpu_rw_semaphore *sem); /* Block device sync - declarations for stub.c */ -void sync_blockdev(struct block_device *bdev); +int sync_blockdev(struct block_device *bdev); void invalidate_bdev(struct block_device *bdev); /* Kobject - declarations for stub.c */ @@ -2867,6 +2867,8 @@ loff_t seq_lseek(struct file *f, loff_t o, int w); /* Block device operations for journal.c */ #define bh_read(bh, flags) ({ (void)(bh); (void)(flags); 0; }) +#define bh_read_nowait(bh, flags) do { (void)(bh); (void)(flags); } while (0) +#define bh_readahead_batch(n, bhs, f) do { (void)(n); (void)(bhs); (void)(f); } while (0) #define truncate_inode_pages_range(m, s, e) \ do { (void)(m); (void)(s); (void)(e); } while (0) #define blkdev_issue_discard(bdev, s, n, gfp) \ diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index c9d1d3f99eb..b1b5bb93cd8 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -576,8 +576,9 @@ void percpu_free_rwsem(struct percpu_rw_semaphore *sem) } /* Block device ops */ -void sync_blockdev(struct block_device *bdev) +int sync_blockdev(struct block_device *bdev) { + return 0; } void invalidate_bdev(struct block_device *bdev) @@ -823,16 +824,33 @@ int jbd2_journal_destroy_revoke(void *journal) return 0; } -int jbd2_journal_recover(void *journal) +/* jbd2_journal_recover is now in recovery.c */ +/* jbd2_journal_skip_recovery is now in recovery.c */ + +/* JBD2 stubs for recovery.c - functions from revoke.c */ +int jbd2_journal_init_revoke_table(void *journal) +{ + return 0; +} + +int jbd2_journal_test_revoke(void *journal, unsigned long blocknr, unsigned int tid) { return 0; } -int jbd2_journal_skip_recovery(void *journal) +int jbd2_journal_set_revoke(void *journal, unsigned long blocknr, unsigned int tid) { return 0; } +void jbd2_journal_clear_revoke(void *journal) +{ +} + +void jbd2_journal_destroy_revoke_table(void *table) +{ +} + void jbd2_buffer_frozen_trigger(void *jh, void *mapped_data, void *triggers) { } diff --git a/fs/jbd2/Makefile b/fs/jbd2/Makefile index f0f84bfb707..bcc1f47177b 100644 --- a/fs/jbd2/Makefile +++ b/fs/jbd2/Makefile @@ -3,4 +3,4 @@ # Makefile for JBD2 journaling layer (used by ext4l) # -obj-y := checkpoint.o commit.o journal.o +obj-y := checkpoint.o commit.o journal.o recovery.o diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index cac8c2cd4a9..ff2266c7316 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -10,17 +10,8 @@ * part of the ext2fs journaling system. */ -#ifndef __KERNEL__ -#include "jfs_user.h" -#else -#include <linux/time.h> -#include <linux/fs.h> +#include "../ext4l/ext4_uboot.h" #include <linux/jbd2.h> -#include <linux/errno.h> -#include <linux/crc32.h> -#include <linux/blkdev.h> -#include <linux/string_choices.h> -#endif /* * Maintain information about the progress of the recovery job, so that @@ -628,7 +619,7 @@ static int do_one_pass(journal_t *journal, * filesystems. */ hash_size = min(roundup_pow_of_two(info->nr_revokes / 8), - 1U << 20); + 1UL << 20); journal->j_revoke = jbd2_journal_init_revoke_table(hash_size); if (!journal->j_revoke) { -- 2.43.0