Skip to content

[Feature] Production-Readiness Stabilization of Mnemofs #18530

@Sumit6307

Description

@Sumit6307

Is your feature request related to a problem? Please describe.

Yes. The newer flash file system in NuttX, mnemofs, is a great architectural addition but is currently marked as experimental and contains several structural inefficiencies and incomplete POSIX compliance features. As noted in multiple TODO and FUTURE TODO comments across fs/mnemofs/, the current implementation suffers from:

  1. Inefficient Directory Traversal: mnemofs_fsobj.c currently performs double traversals for path resolution, creating overhead.
  2. Missing Timestamps: POSIX mtime, atime, and ctime are not fully implemented/updated during journal atomic commits (noted in mnemofs.c and mnemofs_journal.c).
  3. Memory Leaks during Block Flush: The flush operation has known issues ("does not work properly, and causes memory [leaks]"), which is critical for flash wear-leveling and system stability in long-running embedded IoT applications.

Describe the solution you'd like

I propose a comprehensive stabilization pass over mnemofs focusing on robustness, POSIX standard compliance, and maintaining strict self-compatibility. The planned solution includes:

  • Single Traversal Refactoring: Rewriting the directory lookup mechanisms to utilize a single-pass traversal, decoupling the LRU cache dependencies from Journal atomic commits to increase lookup throughput without increasing RAM footprint.
  • Timestamping Integration: Properly passing POSIX time references down through the VFS inode layer into the mnemofs master nodes, updating timestamps gracefully without causing massive flash rewrite amplification.
  • Flush Mechanism Overhaul: Investigating and rewriting the block flush mechanism to permanently resolve memory leaks, verifying stability under heavy multi-threaded write loads over long periods.
  • Hardware Validation: Adding extensive runtime test coverage using apps/ostest and apps/fs/fstests verified on real hardware, generating complete build and runtime logs to prove zero regressions.

This work will be done iteratively through small, highly-focused, non-breaking Pull Requests to allow manageable reviews by the maintainers.

Describe alternatives you've considered

I propose a comprehensive stabilization pass over mnemofs focusing on robustness, POSIX standard compliance, and maintaining strict self-compatibility. The planned solution includes:

  • Single Traversal Refactoring: Rewriting the directory lookup mechanisms to utilize a single-pass traversal, decoupling the LRU cache dependencies from Journal atomic commits to increase lookup throughput without increasing RAM footprint.
  • Timestamping Integration: Properly passing POSIX time references down through the VFS inode layer into the mnemofs master nodes, updating timestamps gracefully without causing massive flash rewrite amplification.
  • Flush Mechanism Overhaul: Investigating and rewriting the block flush mechanism to permanently resolve memory leaks, verifying stability under heavy multi-threaded write loads over long periods.
  • Hardware Validation: Adding extensive runtime test coverage using apps/ostest and apps/fs/fstests verified on real hardware, generating complete build and runtime logs to prove zero regressions.

This work will be done iteratively through small, highly-focused, non-breaking Pull Requests to allow manageable reviews by the maintainers.

Verification

  • I have verified before submitting the report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions