jbd2: Add revoke.c to the build

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>
This commit is contained in:
Simon Glass
2025-12-21 06:50:28 -07:00
parent 87f7e16bfa
commit 81d8264b76
4 changed files with 18 additions and 60 deletions

View File

@@ -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; })

View File

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

View File

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

View File

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