#fuse #path #directory #higher-level #translation #multi-threading

fuse_mt

A higher-level FUSE filesystem library with multi-threading and inode->path translation

14 releases

0.6.1 Sep 19, 2023
0.6.0 Jul 12, 2022
0.5.1 Aug 17, 2020
0.5.0 May 11, 2019
0.3.0 Feb 1, 2017

#492 in Filesystem

Download history 106/week @ 2024-08-10 134/week @ 2024-08-17 262/week @ 2024-08-24 85/week @ 2024-08-31 68/week @ 2024-09-07 26/week @ 2024-09-14 111/week @ 2024-09-21 132/week @ 2024-09-28 102/week @ 2024-10-05 124/week @ 2024-10-12 151/week @ 2024-10-19 88/week @ 2024-10-26 261/week @ 2024-11-02 351/week @ 2024-11-09 447/week @ 2024-11-16 553/week @ 2024-11-23

1,627 downloads per month
Used in 5 crates (4 directly)

MIT/Apache

65KB
1.5K SLoC

FUSE-MT

Build Status Crates.io

Documentation

This code is a wrapper on top of the Rust FUSE crate with the following additions:

  • Dispatch system calls on multiple threads, so that e.g. I/O doesn't block directory listing.
  • Translate inodes into paths, to simplify filesystem implementation.

The fuser crate provides a minimal, low-level access to the FUSE kernel API, whereas this crate is more high-level, like the FUSE C API.

It includes a sample filesystem that uses the crate to pass all system calls through to another filesystem at any arbitrary path.

This is a work-in-progress. Bug reports, pull requests, and other feedback are welcome!

Some random notes on the implementation:

  • The trait that filesystems will implement is called FilesystemMT, and instead of the FUSE crate's convention of having methods return void and including a "reply" parameter, the methods return their values. This feels more idiomatic to me. They also take &Path arguments instead of inode numbers.
  • Currently, only the following calls are dispatched to other threads:
    • read
    • write
    • flush
    • fsync
  • Other calls run synchronously on the main thread because either it is expected that they will complete quickly and/or they require mutating internal state of the InodeTranslator and I want to avoid needing locking in there.
  • The inode/path translation is always done on the main thread.
  • It might be a good idea to limit the number of concurrent read and write operations in flight. I'm not sure yet how many outstanding read/write requests FUSE will issue though, so it might be a non-issue.

Dependencies

~1.8–2.7MB
~45K SLoC