#fuse #storage #device-mapper

userland-io

It’s like FUSE but for the block layer

4 releases

0.1.0-alpha.4 Dec 17, 2020
0.1.0-alpha.3 Dec 16, 2020
0.1.0-alpha.1 Dec 15, 2020

#21 in #fuse

23 downloads per month

MIT license

20KB
465 lines

userland-io

Crates.io documentation MIT licensed

Motivation

Developing a virtual block device in Linux kernel is a hard task. You must understand not only device-mapper framework but also the subsystems around it. Writing a complicated code in C language will spend a ton of time and the code output is usually hard to maintain. How do I know this? Because I've implemented dm-writeboost.

When I met Rust language, soon I fell in love with the beautiful language and came to think of how it would be nice to write virtual block device in this language. With Rust, concurrent programming is not a difficult task while it is just like hell with C. Moreover, we can make use of sophisticated ecosystem and libraries from Rust community.

fuse-rs is such a framework for filesystem layer but there nothing exists for block layer. That's why I started this project.

Architecture

The client IO is coming from NBD. The TCP connection is split into read half and write half so reading and writing are executed simultaneously. The NBD requests are interpreted and changed into generic request.

Right half of the figure is generic storage layer. The generic request in passed from the transport in queue. The executor sends it to storage engine asynchonously so all the requests are processed concurrently.

Architecture

Futurework

  • I think it would be so nice to have a working transport in Windows and Mac.
  • A new target called dm-user is proposed to upstream. dm-user is a DM target to proxy kernel bio to userland just like FUSE. This would bring better performance than with NBD because there is no TCP communication involved. If dm-user is merged, I will implement new transport in which IOs are coming from dm-user.

Dependencies

~5.5MB
~97K SLoC