July 15th, 2024

Rust for Filesystems

At the 2024 Linux Summit, Wedson Almeida Filho and Kent Overstreet explored Rust for Linux filesystems. Rust's safety features offer benefits for kernel development, despite concerns about compatibility and adoption challenges.

Read original articleLink Icon
Rust for Filesystems

At the 2024 Linux Storage, Filesystem, Memory Management, and BPF Summit, Wedson Almeida Filho and Kent Overstreet discussed using Rust for Linux filesystems. The project aims to leverage Rust's type system to catch errors at compile time, automate tasks like resource cleanup, and enhance productivity in filesystem development. Rust's features, like eliminating undefined behavior and providing code visibility, are seen as beneficial for kernel development. The discussion included examples of how Rust's type system can simplify complex requirements, although concerns were raised about maintaining compatibility between Rust and C APIs. Some developers expressed skepticism about the transition to Rust and the potential challenges of coordinating changes with kernel developers who may not interact with Rust code. Overall, the use of Rust in filesystem development is seen as a step towards safer and more efficient code, although challenges related to API compatibility and developer adoption remain.

Related

SquirrelFS: Using the Rust compiler to check file-system crash consistency

SquirrelFS: Using the Rust compiler to check file-system crash consistency

The paper introduces SquirrelFS, a crash-safe file system using Rust's typestate pattern for compile-time operation order enforcement. Synchronous Soft Updates ensure crash safety by maintaining metadata update order. SquirrelFS offers correctness guarantees without separate proofs, quickly verifying crash consistency during compilation. Comparative evaluations show SquirrelFS performs similarly or better than NOVA and WineFS.

Spending too much time optimizing for loops

Spending too much time optimizing for loops

Researcher Octave Larose discussed optimizing Rust interpreters, focusing on improving performance for the SOM language. They highlighted enhancing loop efficiency through bytecode and primitives, addressing challenges like Rust limitations and complex designs. Despite performance gains, trade-offs between efficiency and code elegance persist.

The Linux Kernel Matures to Having a Minimum Rust Toolchain Version

The Linux Kernel Matures to Having a Minimum Rust Toolchain Version

The Linux kernel is advancing to support multiple Rust compiler versions, starting with 1.78.0 and adding 1.79.0. This progress aims to stabilize Rust for Linux, enhancing driver and kernel code development efficiency.

Improving 64-bit RISC-V Linux support in Rust

Improving 64-bit RISC-V Linux support in Rust

Ferrous Systems and Codethink collaborate to boost 64-bit RISC-V Linux support in Rust to Tier 1 via the RISE Project. This effort aims to enhance Rust's functionality for diverse platforms, focusing on RISC-V's open instruction set architecture.

2024 FreeBSD Developer Summit: Integration with Rust

2024 FreeBSD Developer Summit: Integration with Rust

The 2024 FreeBSD Developer Summit discussed integrating Rust into FreeBSD for modernization and security. Challenges include Rust's update pace differing from FreeBSD's. Coordination with Rust community is vital for compatibility and stability.

Link Icon 11 comments
By @pornel - 3 months
I don't get how can each file system have a custom lifecycle for inodes, but still use the same functions for inode lifecycle management, but apparently with different semantics? That sounds like the opposite of an abstraction layer, if the same function must be used in different ways depending on implementation details.

If the lifecycle of inodes is filesystem-specific, it should be managed via filesystem-specific functions.

By @gwbas1c - 3 months
Maybe they are asking the wrong questions?

Does Rust need to change to make it easier to call C?

I've done a bit of Rust, and (as a hobbyist,) it's still not clear (to me) how to interoperate with C. (I'm sure someone reading this has done it.) In contrast, in C++ and Objective C, all you need to do is include the right header and call the function. Swift lets you include Objective C files, and you can call C from them.

Maybe Rust as a language needs to bend a little in this case, instead of expecting the kernel developers to bend to the language?

By @sandywaffles - 3 months
I wasn't clear and am not familiar enough with the Linux FS systems to know if this Rust API would be wrapping or re-implementing the C APIs? If it's re-implementing (or rather an additional API) it seems keeping the names the same as the C API would be problematic and lead to more confusion over time, even if initially it helped already-familiar-developers grok whats going on faster.
By @BiteCode_dev - 3 months
Given how those discussions usually go, and the scale of the change, I find that discussion extraordinarily civil.

I disagree with the negative tone of this thread, I'm quite optimistic given how clearly the parties involved were able to communicate the pain points with zero BS.

By @hu3 - 3 months
Some of the comments below the lwn.net page are rather disrespectful.

Imagine getting this comment about the open source project you contribute to:

"Science advances one funeral at a time"

By @simon04 - 3 months
tl;dr?
By @ysw0145 - 3 months
Having more options available in the Linux kernel is always beneficial. However, Rust may not be the solution for everything. While Rust does its best to ensure its programming model is safe, it is still a limited model. Memory issues? Use Rust! Concurrency problems? Switch to Rust! But you can't do everything that C does without using unsafe blocks. Rust can offer a fresh perspective to these problems, but it's not a complete solution.
By @gritzko - 3 months
From the minutes I conclude that Rust-in-the-kernel looks like an additional complexity tax. I mean, if you write an OS from scratch, you can use the full power of your language. Plastering it to the side of an already vast codebase creates additional issues, as we see here.
By @brodouevencode - 3 months
> about the disconnect between the names in the C API and the Rust API, which means that developers cannot look at the C code and know what the equivalent Rust call would be

Ah, the struggle of legacy naming conventions. I've had success in keeping the same name but when I wanted an alternative name I would just wrap the old name with the new name.

But yeah, naming things is hard.

By @pjmlp - 3 months
The disconnect section of the article is a good example of exactly on how not to do the things, and how things can turn out sour if the existing community isn't taken for the ride.