A Re-Implementation Of The EROFS File-System In Rust Has Started

Written by Michael Larabel in Linux Storage on 16 September 2024 at 01:00 PM EDT. 62 Comments
LINUX STORAGE
The EROFS read-only open-source file-system has seen initial patches posted today for beginning to re-implement the C code within the Rust programming language for better safety guarantees and the possibility of more performance optimizations.

So far the state of Rust support for file-system drivers on Linux remains in early form. There has been some work like writing an EXT2 driver in Rust but so far no Rust VFS implementation is upstreamed and no big drivers have yet seen a complete transition to Rust.

EROFS logo


Yiyang Wu posted the patches today that begin adding Rust code to the EROFS file-system implementation. The Rust code is inspired by the C code but so far it's very limited. Yiyang Wu commented:
"So here is a patchset to add Rust skeleton codes to the current EROFS implementation. The implementation is deeply inspired by the current C implementation, and it's based on a generic erofs_sys crate written by me. The purpose is to potentially replace some of C codes to make to make full use of Rust's safety features and better optimization guarantees.

Many of the features (like compression inodes) still fall back to C implementation because of my limited time and lack of Rust counterparts. However, the Extended Attributes work purely in Rust."

But the early state of Rust support for Linux storage/file-system drivers does lead to some early adoption issues:
"Note that, since currently there is no mature Rust VFS implementation landed upstream, this patchset only uses C bindings internally and each unsafe operation is examined. This implementation only offers C-ABI-compatible functions impls and gets its exposed to original C implementation as either hooks or function pointers.

Also note that, this patchset only uses already-present self-included EROFS API and it uses as few C bindings generated from bindgen as possible, only inode, dentry, file and dir_context related are used, to be precise."

Those interested in this effort and the 3k lines of Rust code so far for beginning to re-implement EROFS in Rust can see this RFC patch series laying out the initial work.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week