[Concept,06/15] jbd2: Add checkpoint.c to the build
Commit Message
From: Simon Glass <simon.glass@canonical.com>
Update checkpoint.c includes to use ext4_uboot.h compatibility layer.
Add jbd2/Makefile and include jbd2 in the build via fs/Makefile
Add necessary stubs and definitions:
- JBD2 trace stubs (trace_jbd2_checkpoint, etc.)
- mutex_lock_io, write_dirty_buffer, spin_needbreak stubs
- bd_dev field to struct block_device
- Temporary JBD2 function stubs until other jbd2 files are added
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/Makefile | 1 +
fs/ext4l/ext4_uboot.h | 14 ++++++++++++++
fs/ext4l/stub.c | 33 +++++++++++++++++++++++++++++++++
fs/jbd2/Makefile | 6 ++++++
fs/jbd2/checkpoint.c | 7 +------
include/linux/fs.h | 1 +
6 files changed, 56 insertions(+), 6 deletions(-)
create mode 100644 fs/jbd2/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_CMD_CRAMFS) += cramfs/
obj-$(CONFIG_FS_EXFAT) += exfat/
obj-$(CONFIG_FS_EXT4) += ext4/
obj-$(CONFIG_FS_EXT4L) += ext4l/
+obj-$(CONFIG_FS_EXT4L) += jbd2/
obj-$(CONFIG_FS_FAT) += fat/
obj-$(CONFIG_FS_JFFS2) += jffs2/
obj-$(CONFIG_SANDBOX) += sandbox/
@@ -2768,4 +2768,18 @@ struct wait_bit_entry {
/* get_current_ioprio - I/O priority (not used in U-Boot) */
#define get_current_ioprio() (0)
+/* JBD2 checkpoint.c stubs */
+#define mutex_lock_io(m) mutex_lock(m)
+#define write_dirty_buffer(bh, flags) sync_dirty_buffer(bh)
+#define spin_needbreak(l) ({ (void)(l); 0; })
+
+/* JBD2 trace stubs */
+#define trace_jbd2_checkpoint(j, r) do { (void)(j); (void)(r); } while (0)
+#define trace_jbd2_shrink_checkpoint_list(j, f, t, l, n, d) \
+ do { (void)(j); (void)(f); (void)(t); (void)(l); (void)(n); (void)(d); } while (0)
+#define trace_jbd2_checkpoint_stats(d, tid, stats) \
+ do { (void)(d); (void)(tid); (void)(stats); } while (0)
+#define trace_jbd2_drop_transaction(j, t) \
+ do { (void)(j); (void)(t); } while (0)
+
#endif /* __EXT4_UBOOT_H__ */
@@ -827,3 +827,36 @@ int dquot_alloc_block(struct inode *inode, loff_t nr)
void dquot_free_block(struct inode *inode, loff_t nr)
{
}
+
+/*
+ * JBD2 stubs - temporary stubs until other jbd2 files are added
+ * Note: These use void* to avoid pulling in jbd2.h types which would conflict
+ */
+
+int jbd2_journal_get_log_tail(void *journal, void *tid, unsigned long *block)
+{
+ return 0;
+}
+
+int __jbd2_update_log_tail(void *journal, unsigned int tid, unsigned long block)
+{
+ return 0;
+}
+
+void *jbd2_journal_grab_journal_head(struct buffer_head *bh)
+{
+ return NULL;
+}
+
+void jbd2_journal_put_journal_head(void *jh)
+{
+}
+
+void jbd2_journal_free_transaction(void *transaction)
+{
+}
+
+int jbd2_log_start_commit(void *journal, unsigned int tid)
+{
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for JBD2 journaling layer (used by ext4l)
+#
+
+obj-y := checkpoint.o
@@ -14,13 +14,8 @@
* reused.
*/
-#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/blkdev.h>
-#include <trace/events/jbd2.h>
/*
* Unlink a buffer from a transaction checkpoint list.
@@ -65,6 +65,7 @@ struct block_device {
struct address_space *bd_mapping;
void *bd_disk;
struct super_block *bd_super;
+ dev_t bd_dev;
};
/* errseq functions - stubs */