> For the complete documentation index, see [llms.txt](https://sliu583.gitbook.io/blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sliu583.gitbook.io/blog/specific-work/seminar-and-talk/fall-21-reading-list/high-velocity-kernel-file-systems-with-bento.md).

# High Velocity Kernel File Systems with Bento

* Kernel File System Development is slow&#x20;
  * High development and deployment velocity are critical to modern cloud systems&#x20;
  * Linux kernel development and deployment are slow
  * File systems are particularly affected due to advances in storage hardware and new demands by cloud systems&#x20;
* Existing techniques aren't efficient&#x20;
  * ![](/files/Z60Ek0ooYANjG5Zzpljd)
  * eBPF: in-kernel VM that runs user-provided program at pre-specified points, but quite restricted&#x20;
* Goals
  * High performance: has low performance overhead
  * Safety: prevention of bugs in the file system
  * General programmability: supports a wide variety of potential file systems&#x20;
  * Compatibility: works with Linux and existing Linux binaries&#x20;
  * Live Upgrade: can redeploy file systems without service downtime&#x20;
  * User-level debugging: file system can be debugged easily with a variety of tools&#x20;
  * Open Source&#x20;
* Bento
  * File systems are implemented in safe Rust
    * Imposes little overhead and supports most designs&#x20;
  * How can we integrate a safe Rust system in the kernel?
  * How can we dynamically replace the file system?
  * How can we support user-level execution?&#x20;

![](/files/r1AnDgh7ff42nDFM8SOi)

BentoFS&#x20;

* Standalone C kernel module that hooks into VFS
* Maintains an active list of file systems&#x20;
* Translate VFS calls to FUSE low-level API&#x20;
* Forwards call to the correct FS&#x20;

FS module&#x20;

* Contains the file system and two Rust libraries: libBentoFS and libBentoKS

libBentoFS

* Between BentoFS and the file system&#x20;
* Converts unsafe C from BentoFS to safe Rust
  * Converts C types to Rust types
  * Converts pointers to references&#x20;

libBentoKS

* Between the file system and the rest of the kernel
* Provides access to efficient, well-tested kernel services
* Provides safe abstractions around kernel services&#x20;
  * Ensures correct ownership
  * Handles resource allocation and deallocation&#x20;

Live Upgrade

* Live upgrade component in BentoFS
* When an upgrade module is inserted
  * BentoFS stop calls to the file system
  * Old file system cleans up and returns state struct&#x20;
  * New file system initializes using state and returns&#x20;
  * BentoFS swaps pointers and allows calls to proceed&#x20;

Userspace Execution&#x20;

* Bento file system can be run in userspace without any changes to the code
* Most interfaces provided by libBentoFS and libBentoKS are identical to existing userspace interfaces&#x20;
* File system can be compiled to run in userspace using a build flag&#x20;

Evaluation&#x20;

* Competitive performance?
* How does live upgrade impact availability?&#x20;
