This series adds a memory-backed ("memback") mode to EROFS that
allows mounting an EROFS image directly from a kernel memory region
without going through the block layer.I am sending this as an RFC to get EROFS maintainer feedback on this approach before building the full initramfs series on top of it. The memback mode may also be useful for other use cases beyond initramfs where EROFS images need to be served directly from memory, though it may need further hardening for more general use cases. Previous review feedback on the initramfs patches raised concerns about the block layer dependency — this series addresses that by providing a direct memory-backed path. It also adds support for non-page-aligned memory ranges, which is the common case for initramfs images packed at arbitrary cpio boundaries. Supporting non-page-aligned ranges is essential for true zero-copy access — requiring page alignment would force a copy into an aligned buffer before the data can be used, defeating the purpose. The full initramfs integration (init/ changes) that wires up the EROFS initrd detection and layered mount is available for reference here[0]. It implements support for interleaved cpio and EROFS layers, it supports cpio CPU microcode update prefix, and uses overlayfs+tmpfs for write support. This series was developed with the assistance of Claude Opus 4.6. All patches carry an Assisted-by tag. I am providing the kunit testing and I have tested this change against the initramfs series to boot an EROFS initramfs. I welcome feedback on the approach and implementation. Patch 1 adds the core memback implementation. Patch 2 adds a KUnit test that mounts a compressed EROFS image at a non-page-aligned offset and verifies decompressed file contents. [0] https://github.com/aruiz/linux/tree/wip/erofs-initramfs-memback Signed-off-by: Alberto Ruiz <[email protected]> --- Alberto Ruiz (2): erofs: add memory-backed mode for non-page-aligned mount erofs: add KUnit test for memory-backed compressed mount fs/erofs/Kconfig | 11 ++++ fs/erofs/Makefile | 2 + fs/erofs/data.c | 33 +++++++++- fs/erofs/internal.h | 53 +++++++++++---- fs/erofs/memback.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/erofs/memback_test.c | 151 ++++++++++++++++++++++++++++++++++++++++++ fs/erofs/super.c | 38 +++++++++-- fs/erofs/zdata.c | 16 +++-- 8 files changed, 447 insertions(+), 26 deletions(-) --- base-commit: 6b5a2b7d9bc156e505f09e698d85d6a1547c1206 change-id: 20260617-erofs-memback-0ae2448ba2cc Best regards, -- Alberto Ruiz <[email protected]>
