A Re-Implementation Of The EROFS File-System In Rust Has Started
([Linux Storage] 5 Hours Ago
EROFS + Rust)
- Reference: 0001492005
- News link: https://www.phoronix.com/news/EROFS-Rust-Code-Starts
- Source link:
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 [1]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.
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 [2]this RFC patch series laying out the initial work.
[1] https://www.phoronix.com/news/Rust-VFS-Linux-V2-Now-With-EXT2
[2] https://lore.kernel.org/rust-for-linux/20240916135541.98096-1-toolmanp@tlmp.cc/
So far the state of Rust support for file-system drivers on Linux remains in early form. There has been some work like [1]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.
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 [2]this RFC patch series laying out the initial work.
[1] https://www.phoronix.com/news/Rust-VFS-Linux-V2-Now-With-EXT2
[2] https://lore.kernel.org/rust-for-linux/20240916135541.98096-1-toolmanp@tlmp.cc/
milkylainen