[Concept,4/9] fs: ext4l: Add folio helper macros

Message ID 20260107234426.3508161-5-sjg@u-boot.org
State New
Headers
Series Align ext4l with Linux kernel v6.19 implementation |

Commit Message

Simon Glass Jan. 7, 2026, 11:44 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add folio_next_pos() and fgf_set_order() macros to ext4_uboot.h to
match the Linux kernel API.

folio_next_pos() returns the byte position following a folio, useful
for checking if a folio extends past a given position.

fgf_set_order() is a stub that returns 0 since U-Boot doesn't support
large folios. In Linux, this is used to request a specific folio size
when allocating.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 fs/ext4l/ext4_uboot.h | 7 +++++++
 1 file changed, 7 insertions(+)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 943cb31d694..2487d6fc70f 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -1565,7 +1565,14 @@  static inline char *d_path(const struct path *path, char *buf, int buflen)
 #define folio_zero_range(f, s, l)		do { } while (0)
 #define folio_mark_uptodate(f)			do { } while (0)
 #define folio_next_index(f)			((f)->index + 1)
+#define folio_next_pos(f)			((loff_t)folio_next_index(f) << PAGE_SHIFT)
 #define folio_mapped(f)				(0)
+
+/*
+ * fgf_set_order - Set the order (size) for folio allocation
+ * U-Boot doesn't support large folios, so this is a no-op stub.
+ */
+#define fgf_set_order(size)			(0)
 #define folio_clear_dirty_for_io(f)		({ (void)(f); 1; })
 #define folio_clear_uptodate(f)			do { } while (0)
 #define folio_batch_release(fb)			do { } while (0)