[Concept,13/26] fs: ext4l: Initialise multi-block allocator

Message ID 20251222115639.700578-14-sjg@u-boot.org
State New
Headers
Series fs: ext4l: Add support for mounting ext4 filesystems (part G) |

Commit Message

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

Call ext4_init_mballoc() from ext4l_probe() when CONFIG_EXT4_WRITE
is enabled to initialise the multi-block allocator caches before
any write operations.

Include ext4.h to get the function declaration.

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

 fs/ext4l/interface.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Patch

diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c
index 546017efd16..ca71843b58e 100644
--- a/fs/ext4l/interface.c
+++ b/fs/ext4l/interface.c
@@ -41,6 +41,13 @@  int ext4l_probe(struct blk_desc *fs_dev_desc,
 			return ret;
 	}
 
+	/* Initialise multi-block allocator for write support */
+	if (IS_ENABLED(CONFIG_EXT4_WRITE)) {
+		ret = ext4_init_mballoc();
+		if (ret)
+			return ret;
+	}
+
 	buf = malloc(BLOCK_SIZE + 512);
 	if (!buf)
 		return -ENOMEM;