[Concept,06/10] ext4l: Add inline.c to build

Message ID 20251221113820.812060-7-sjg@u-boot.org
State New
Headers
Series ext4l: Add more ext4 files to the build (part E) |

Commit Message

Simon Glass Dec. 21, 2025, 11:38 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add the ext4 inline data implementation file to the build.

Add stubs to ext4_uboot.h:
- FGP_WRITEBEGIN flag (combined from FGP_LOCK | FGP_WRITE | FGP_CREAT |
  FGP_STABLE)
- kmap_local_folio, kunmap_local for memory mapping
- folio_zero_tail, folio_zero_segment for folio zeroing
- mapping_gfp_mask for address space GFP mask

Remove obsolete inline data stubs from stub.c that are now provided
by inline.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 |  12 +++++
 fs/ext4l/inline.c     |   6 +--
 fs/ext4l/stub.c       | 119 +++---------------------------------------
 4 files changed, 21 insertions(+), 118 deletions(-)
  

Patch

diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile
index efda4ee18b5..80797722fe2 100644
--- a/fs/ext4l/Makefile
+++ b/fs/ext4l/Makefile
@@ -7,6 +7,6 @@  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 fsync.o hash.o ialloc.o \
-		indirect.o inode.o namei.o super.o symlink.o xattr.o \
+		indirect.o inline.o inode.o namei.o super.o symlink.o xattr.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 052067981cd..fc8a2f98bdb 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -1309,6 +1309,18 @@  static inline int generic_error_remove_folio(struct address_space *mapping,
 #define FGP_NOWAIT	0x00000020
 #define FGP_FOR_MMAP	0x00000040
 #define FGP_STABLE	0x00000080
+#define FGP_WRITEBEGIN	(FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE)
+
+/* kmap/kunmap stubs for inline.c */
+#define kmap_local_folio(folio, off)	({ (void)(folio); (void)(off); (void *)NULL; })
+#define kunmap_local(addr)		do { (void)(addr); } while (0)
+
+/* Folio zeroing stubs for inline.c */
+#define folio_zero_tail(f, off, kaddr)	({ (void)(f); (void)(off); (void)(kaddr); (void *)NULL; })
+#define folio_zero_segment(f, s, e)	do { (void)(f); (void)(s); (void)(e); } while (0)
+
+/* mapping_gfp_mask stub */
+#define mapping_gfp_mask(m)		({ (void)(m); GFP_KERNEL; })
 
 /* __filemap_get_folio stub */
 static inline struct folio *__filemap_get_folio(struct address_space *mapping,
diff --git a/fs/ext4l/inline.c b/fs/ext4l/inline.c
index 1b094a4f386..1e5dd731388 100644
--- a/fs/ext4l/inline.c
+++ b/fs/ext4l/inline.c
@@ -4,11 +4,7 @@ 
  * Written by Tao Ma <boyu.mt@taobao.com>
  */
 
-#include <linux/iomap.h>
-#include <linux/fiemap.h>
-#include <linux/namei.h>
-#include <linux/iversion.h>
-#include <linux/sched/mm.h>
+#include "ext4_uboot.h"
 
 #include "ext4_jbd2.h"
 #include "ext4.h"
diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c
index 4dbc055bb72..e5cb69be5b1 100644
--- a/fs/ext4l/stub.c
+++ b/fs/ext4l/stub.c
@@ -183,11 +183,7 @@  void ext4_discard_preallocations(struct inode *inode, unsigned int needed)
 }
 
 /* ext4_is_pending is now in extents_status.c */
-
-int ext4_convert_inline_data(struct inode *inode)
-{
-	return 0;
-}
+/* ext4_convert_inline_data is now in inline.c */
 
 void ext4_fc_mark_ineligible(struct super_block *sb, int reason,
 			     void *handle)
@@ -250,10 +246,7 @@  int ext4_mpage_readpages(void *mapping, void *rac, void *folio)
 	return 0;
 }
 
-int ext4_readpage_inline(struct inode *inode, void *folio)
-{
-	return 0;
-}
+/* ext4_readpage_inline is now in inline.c */
 
 /* Xattr functions are now in xattr.c */
 
@@ -275,11 +268,7 @@  int ext4_fc_commit(void *journal, unsigned int tid)
 
 /* ext4_force_commit is now in super.c */
 
-/* Inline data */
-int ext4_destroy_inline_data(void *handle, struct inode *inode)
-{
-	return 0;
-}
+/* Inline data is now in inline.c */
 
 /* I/O submit */
 void ext4_io_submit_init(void *io, void *wbc)
@@ -364,21 +353,10 @@  int jbd2_journal_inode_ranged_wait(void *handle, struct inode *inode,
 	return 0;
 }
 
-/* Inline data */
-int ext4_inline_data_iomap(struct inode *inode, void *iomap)
-{
-	return 0;
-}
-
+/* Inline data functions are now in inline.c */
 
 /* __xattr_check_inode is now in xattr.c */
 
-int ext4_find_inline_data_nolock(struct inode *inode)
-{
-	return 0;
-}
-
-
 /* File and inode operations symbols */
 /* ext4_file_inode_operations is now in file.c */
 /* ext4_file_operations is now in file.c */
@@ -391,32 +369,7 @@  int ext4_find_inline_data_nolock(struct inode *inode)
 
 /* ext4_update_dynamic_rev is now in super.c */
 
-/* Inline data */
-int ext4_inline_data_truncate(struct inode *inode, int *has_inline)
-{
-	*has_inline = 0;
-	return 0;
-}
-
-int ext4_try_to_write_inline_data(struct address_space *mapping,
-				  struct inode *inode, loff_t pos,
-				  unsigned int len, struct folio **foliop)
-{
-	return 0;
-}
-
-int ext4_generic_write_inline_data(struct address_space *mapping,
-				   struct inode *inode, loff_t pos,
-				   unsigned int len, struct folio **foliop)
-{
-	return 0;
-}
-
-int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned int len,
-			       unsigned int copied, struct folio *folio)
-{
-	return copied;
-}
+/* Inline data stubs are now in inline.c */
 
 /* xattr stubs are now in xattr.c */
 
@@ -432,11 +385,7 @@  void jbd2_journal_init_jbd_inode(void *jinode, struct inode *inode)
 {
 }
 
-/* symlink.c stub */
-void *ext4_read_inline_link(struct inode *inode)
-{
-	return ERR_PTR(-EOPNOTSUPP);
-}
+/* ext4_read_inline_link is now in inline.c */
 
 /*
  * Stubs for dir.c
@@ -452,61 +401,7 @@  ssize_t generic_read_dir(struct file *f, char *buf, size_t count, loff_t *ppos)
 
 /* ext4_htree_fill_tree is now in namei.c */
 
-int ext4_read_inline_dir(struct file *file, void *ctx, void *f_pos)
-{
-	return 0;
-}
-
-struct buffer_head *ext4_find_inline_entry(struct inode *dir, void *fname,
-					   void *res_dir, int *has_inline_data)
-{
-	*has_inline_data = 0;
-	return NULL;
-}
-
-int ext4_try_add_inline_entry(void *handle, void *fname, void *dentry)
-{
-	return -ENOENT;
-}
-
-int ext4_delete_inline_entry(void *handle, struct inode *dir,
-			     void *de_del, struct buffer_head *bh,
-			     int *has_inline_data)
-{
-	*has_inline_data = 0;
-	return -ENOENT;
-}
-
-void ext4_update_final_de(void *de, int de_len, int new_de_len)
-{
-}
-
-int ext4_try_create_inline_dir(void *handle, struct inode *parent,
-			       struct inode *inode)
-{
-	return -ENOENT;
-}
-
-int empty_inline_dir(struct inode *dir, int *has_inline_data)
-{
-	*has_inline_data = 0;
-	return 1;
-}
-
-/* Inline dir stubs */
-int ext4_get_first_inline_block(struct inode *inode, void **de,
-				int *inline_size)
-{
-	return 0;
-}
-
-int ext4_inlinedir_to_tree(struct file *dir, struct inode *inode,
-			   unsigned long long start_hash,
-			   unsigned long long *next_hash,
-			   int has_inline_data)
-{
-	return 0;
-}
+/* Inline dir stubs are now in inline.c */
 
 /* Fast commit stubs */
 void ext4_fc_track_unlink(void *handle, struct dentry *dentry)