[Concept,05/14] linux: fs: Add folio cache to address_space

Message ID 20251230205157.3383926-6-sjg@u-boot.org
State New
Headers
Series ext4l: Linux adaptation patches for ext4 write support |

Commit Message

Simon Glass Dec. 30, 2025, 8:51 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add a simple folio cache array to struct address_space for U-Boot's
folio management, avoiding the need for Linux's XArray/radix tree
infrastructure.

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

 include/linux/fs.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Patch

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 090ee192061..0bf0d3b0379 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -50,6 +50,11 @@  struct path {
 
 /* Buffer operations are in buffer_head.h */
 
+#ifdef __UBOOT__
+/* Maximum number of cached folios per address_space */
+#define FOLIO_CACHE_MAX 64
+#endif
+
 /* address_space - extended for inode.c */
 struct address_space {
 	struct inode *host;
@@ -58,6 +63,11 @@  struct address_space {
 	unsigned long writeback_index;
 	struct list_head i_private_list;
 	const struct address_space_operations *a_ops;
+#ifdef __UBOOT__
+	/* Simple folio cache for U-Boot (no XA/radix tree) */
+	struct folio *folio_cache[FOLIO_CACHE_MAX];
+	int folio_cache_count;
+#endif
 };
 
 /* block_device - minimal stub */