From: Simon Glass <simon.glass@canonical.com> Add revoke.c to the jbd2 Makefile and update its includes to use the compatibility layer. Add stubs for hash_64 and __find_get_block_nonatomic() Remove JBD2 revoke function stubs that are now provided by revoke.c. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 5 ++++ fs/ext4l/stub.c | 57 +++++++++---------------------------------- fs/jbd2/Makefile | 2 +- fs/jbd2/revoke.c | 14 +---------- 4 files changed, 18 insertions(+), 60 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 25756d29cf6..f43c3a999f9 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1365,6 +1365,9 @@ typedef unsigned int projid_t; #include <log.h> #define ilog2(n) (fls(n) - 1) +/* hash_64 - simple 64-bit hash */ +#define hash_64(val, bits) ((unsigned long)((val) >> (64 - (bits)))) + /* Trace stubs for inode.c */ #define trace_ext4_begin_ordered_truncate(...) do { } while (0) #define trace_ext4_evict_inode(...) do { } while (0) @@ -2569,6 +2572,8 @@ struct seq_operations { /* Block device operations */ #define sb_find_get_block_nonatomic(sb, block) \ ({ (void)(sb); (void)(block); (struct buffer_head *)NULL; }) +#define __find_get_block_nonatomic(bdev, block, size) \ + ({ (void)(bdev); (void)(block); (void)(size); (struct buffer_head *)NULL; }) #define bdev_discard_granularity(bdev) \ ({ (void)(bdev); 0U; }) diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index b1b5bb93cd8..989ae2c85c1 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -80,11 +80,7 @@ int jbd2_journal_forget(handle_t *handle, struct buffer_head *bh) return 0; } -int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr, - struct buffer_head *bh) -{ - return 0; -} +/* jbd2_journal_revoke is now in revoke.c */ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh) { @@ -784,18 +780,9 @@ void jbd2_journal_refile_buffer(void *journal, void *jh) { } -void jbd2_clear_buffer_revoked_flags(void *journal) -{ -} - -void jbd2_journal_switch_revoke_table(void *journal) -{ -} - -void jbd2_journal_write_revoke_records(void *journal, void *transaction, - int write_flags) -{ -} +/* jbd2_clear_buffer_revoked_flags is now in revoke.c */ +/* jbd2_journal_switch_revoke_table is now in revoke.c */ +/* jbd2_journal_write_revoke_records is now in revoke.c */ void jbd2_buffer_abort_trigger(void *jh, void *triggers) { @@ -817,39 +804,17 @@ void __jbd2_journal_refile_buffer(void *jh) /* cond_resched_lock is now a macro in ext4_uboot.h */ /* - * JBD2 stubs for journal.c - functions from recovery.c, revoke.c, transaction.c + * JBD2 stubs for journal.c - functions from transaction.c */ -int jbd2_journal_destroy_revoke(void *journal) -{ - return 0; -} /* 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_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) -{ -} +/* jbd2_journal_destroy_revoke is now in revoke.c */ +/* jbd2_journal_init_revoke_table is now in revoke.c */ +/* jbd2_journal_test_revoke is now in revoke.c */ +/* jbd2_journal_set_revoke is now in revoke.c */ +/* jbd2_journal_clear_revoke is now in revoke.c */ +/* jbd2_journal_destroy_revoke_table is now in revoke.c */ void jbd2_buffer_frozen_trigger(void *jh, void *mapped_data, void *triggers) { diff --git a/fs/jbd2/Makefile b/fs/jbd2/Makefile index bcc1f47177b..5501c364abc 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 recovery.o +obj-y := checkpoint.o commit.o journal.o recovery.o revoke.o diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index 1467f679074..b5e6fa6cf96 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c @@ -77,20 +77,8 @@ * needed. */ -#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/slab.h> -#include <linux/list.h> -#include <linux/init.h> -#include <linux/bio.h> -#include <linux/log2.h> -#include <linux/hash.h> -#endif static struct kmem_cache *jbd2_revoke_record_cache; static struct kmem_cache *jbd2_revoke_table_cache; -- 2.43.0