FUSE 子系统:设计与 Linux 内核实现
| 中文教程 | English tutorial |
这是一套以当前工作区 Linux 7.2-rc6 源码为基线的 FUSE 系列教程。教程不把 FUSE 简化为“内核把请求转发给用户态”,而是从 VFS 对象、协议身份、缓存一致性、请求状态机和失败恢复五条主线建立完整模型,再逐条落到 fs/fuse/ 的实现。
教程由两个章节、十篇正文组成,中英文内容一一对应。所有页面都是纯 Markdown,不依赖 JavaScript、CSS 或外部渲染库。
第一章:FUSE 子系统设计
第二章:FUSE 代码实现分析
- 源码地图、模块初始化、挂载与 FUSE_INIT
- 路径解析、目录操作、属性与引用记账
- OPEN、缓存读写、Direct I/O、Writeback 与 RELEASE
- 请求分配、队列状态机与 /dev/fuse 传输
- 普通 mmap 与 virtio-fs DAX
- 卸载、Abort、调试方法与性能分析
English contents
Chapter 1: FUSE subsystem design
- Boundaries, layers, and end-to-end architecture
- Core objects, protocol identity, and capability negotiation
- Caching, I/O modes, and coherency
- Concurrency, backpressure, security, and failure
Chapter 2: Linux implementation
- Source map, module initialization, mount, and FUSE_INIT
- Path walking, directory operations, attributes, and references
- OPEN, cached I/O, direct I/O, writeback, and RELEASE
- Request allocation, queue state machine, and /dev/fuse transport
- Ordinary mmap and virtio-fs DAX
- Teardown, abort, debugging, and performance analysis
建议阅读方式
- 第一次阅读按目录顺序完成,先建立对象和生命周期模型,再进入代码。
- 阅读第二章时同时打开 Linux 源码;教程中的调用链均以源码函数名为锚点。
- 调试实际 FUSE 文件系统时,重点记录 opcode、nodeid、fh 和 unique,这四个值分别对应操作、对象、打开实例和请求生命周期。
- 内核版本变化可能调整内部函数名;UAPI 结构、VFS 边界和请求/应答关系是更稳定的知识。