{"id":23658778,"url":"https://github.com/opencloudos/fuse-extent","last_synced_at":"2025-09-01T12:31:22.156Z","repository":{"id":43719003,"uuid":"441036924","full_name":"OpenCloudOS/fuse-extent","owner":"OpenCloudOS","description":"This project is a fuse extent, which contains fuse-crash-recovery framework and fuse-base-ebpf performance improvement. ","archived":false,"fork":false,"pushed_at":"2022-09-24T01:49:12.000Z","size":4213,"stargazers_count":26,"open_issues_count":3,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T16:49:51.538Z","etag":null,"topics":["auto-recovery","ebpf","fuse"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenCloudOS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-23T02:14:09.000Z","updated_at":"2025-03-03T06:57:41.000Z","dependencies_parsed_at":"2023-01-18T14:46:03.181Z","dependency_job_id":null,"html_url":"https://github.com/OpenCloudOS/fuse-extent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OpenCloudOS/fuse-extent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCloudOS%2Ffuse-extent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCloudOS%2Ffuse-extent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCloudOS%2Ffuse-extent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCloudOS%2Ffuse-extent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenCloudOS","download_url":"https://codeload.github.com/OpenCloudOS/fuse-extent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCloudOS%2Ffuse-extent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273122203,"owners_count":25049540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto-recovery","ebpf","fuse"],"created_at":"2024-12-29T00:51:28.342Z","updated_at":"2025-09-01T12:31:21.247Z","avatar_url":"https://github.com/OpenCloudOS.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"![img](images/fuse.png)\n\n# fuse-extent\n\nfuse-extent 项目致力于扩展 fuse 的功能，增强 fuse 的性能。目前主要包括两个子项目：\n1. fuse-crash-recovery 该子项目主要是构建一个基于 fuse 的用户态文件系统的 crash 自动恢复框架。\n2. fuse-based-ebpf 该子项目主要是基于 ebpf 来提升 fuse 的性能。\n\n## fuse-crash-recovery\nLinux内核部分见patch: https://github.com/OpenCloudOS/OpenCloudOS-Kernel/commit/e1c207b3e7cdfd98ce1120a38c979d748e95f95\n\n### 介绍\nFUSE 是一个用户态文件系统的框架。它由内核模块 (fuse.ko)，用户空间库 (libfuse.*) 以及一个挂载程序 (fusermount) 组成，用户借助 libfuse 编写自定义的用户态文件系统。在这个项目中，我们去除对 libfuse 的依赖，使用内核提供的接口，实现一个用户态文件系统，并具有 crash-recovery 功能，在用户态守护进程故障后恢复重启。\n\n### fuse-crash-recovery 第一版（依赖libfuse）\n 基于libfuse(https://github.com/libfuse/libfuse.git)构建。整个方案实现包含两部分，一部分在Linux\n 内核的fuse部分，主要实现在crash恢复阶段将in-flighting的IO请求重新放回fuse的Pending队列中，以待恢复后的\n 用户态fuse文件系统服务重新获取此IO请求；另一部分基于libfuse构建（是否使用libfuse并没有强依赖)，在libfuse\n 的passthrough_ll样例中展示了用户态的实现方式。\n\n 用户态代码路径：\n https://github.com/OpenCloudOS/libfuse branch:fuse-extent\n\n### fuse-crash-recovery 第二版 （不依赖libfuse）\n1. 当前版本不支持 fuseblk；\n2. 实现了主要的文件系统功能（部分文件系统功能未实现，如 symlink 等）；\n3. 同时目前实现的故障恢复功能不支持多线程模式在启用 `--clonefd` 选项，即 `ioctl(FUSE_DEV_IOC_CLONE)` 情况下的故障恢复；\n4. 如果希望自定义的文件系统支持故障恢复功能，那么应该实现 `fuse_crash_recovery_handlers` 中提供的接口，以保存工作进程故障之后需要保存的内存数据结构。\n\n### 构建\n在项目根目录下\n```\nmkdir build \u0026\u0026 cd build\ncmake ..\ncmake --build .\n```\n#### 运行\n构建完成后在根目录下输入如下命令，运行 example 中的文件系统程序，它会将文件系统挂载到根目录的 ./fusedir/testdir 下：\n```\n./build/example/passthrough_cr -d ./fusedir/testdir\n```\n这个用户态文件系统的功能是将挂载目录下的所有文件系统操作重定向到 \"/\" 目录。\n\n### 执行流程\n\n```c\n-\u003e int parse_cmd_opts(struct fuse_args *args, struct fuse_cmd_opts *opts);\n-\u003e struct fuse_session *fuse_session_new(struct fuse_args *args, const struct fuse_ops *ops, int debug, void* userdata);\n--\u003e int parse_mnt_opts(struct fuse_args *args, struct fuse_mnt_opts *opts);\n--\u003e int parse_conn_info(struct fuse_args *args, struct fuse_conn_info *info);\n-\u003e int fuse_set_signal_handlers(struct fuse_session *se);\n-\u003e int fuse_session_mount(struct fuse_session *se, const char *mountpoint);\n-\u003e int fuse_daemonize(int foreground);\n-\u003e int fuse_single_session_loop(struct fuse_session *se) or int fuse_multi_session_loop(struct fuse_session *se, int clonefd, unsigned threads);\n```\n具体流程图如下：\n![执行流程](images/流程图.png)\n\n### 项目文件说明\n1. [fuse_option.h 文件说明](./doc/实现思路/fuse_option.md)：主要包括命令行参数及挂载参数的解析函数；\n2. [fuse_session.h 文件说明](./doc/实现思路/fuse_session.md)：主要包括会话的初始化函数；\n3. [fuse_mount.h 文件说明](./doc/实现思路/fuse_mount.md)：主要包括文件系统的挂载（以及解除挂载）操作函数；\n4. [fuse_loop.h 文件说明](./doc/实现思路/fuse_loop.md)：提供不断从设备文件中读取用户请求并处理（包括单线程和多线程）的函数；\n5. [fuse_operation.h 和 fuse_operation.c 文件说明](./doc/实现思路/fuse_operation.md) 分别定义了用户态文件系统需要实现的函数接口以及不同请求的处理函数；\n6. [fuse_signal.h 文件说明](./doc/实现思路/fuse_signal.md)：提供对某些信号默认处理函数进行重新设置的功能；\n7. [fuse_crash.h 文件说明](./doc/实现思路/fuse_crash.md)：定义了故障恢复需要实现的函数接口以及工作进程和故障修复进程间传递文件描述符的函数；\n8. fuse_helper.h 文件说明：通过调用上述文件中提供的接口，提供在正常模式或是故障恢复模式下启动文件系统的函数；\n9. fuse_req.h 文件说明：定义了工作进程需要处理的请求体及请求队列；\n10. fuse_reply.h 文件说明：包括工作进程完成请求后向内核响应的函数；\n11. fuse_log.h 文件说明：简单地打印日志信息；\n12. fuse_error.h 文件说明：工作进程启动过程中可能发生的错误类型定义；\n13. fuse_kernel.h 文件说明：fuse 内核提供的接口，与 include/uapi/linux/fuse.h 保持一致。\n\n其他过程文档在 doc 目录\n\n### 故障重启测试\n```bash\n\u003e /root/fuse-extent/build/example/passthrough_cr -d /root/fuse-extent/fusedir/testdir\n\u003e cat haha\n\u003e ps -ef|grep pass\nroot     1640224 1640221  0 11:31 pts/0    00:00:00 /root/fuse-extent/build/example/passthrough_cr -d /root/fuse-extent/fusedir/testdir\nroot     1640226 1640224  0 11:31 pts/0    00:00:00 /root/fuse-extent/build/example/passthrough_cr -d /root/fuse-extent/fusedir/testdir\n// kill child process\n\u003e kill -8 1640226\n// output of the cat\n```\n#### 测试环境\n1. fuse kernel version: 7.31\n2. fusermount version: 2.9.7\n3. linux kernel version: 5.4.119\n\n\n## fuse-based-ebpf\n\n### 原理\nfuse-based-ebpf 的优化主要是针对部分操作，如高频的 lookup，通过 ebpf 在内核部分生成 cache，在用户执行 lookup 时无需再与用户态文件系统服务进程交互，从而提升 fuse 文件系统的性能。\n\n### 组件\n组件包括一个libextfuse库（包括epbf程序），内核patch: https://github.com/OpenCloudOS/OpenCloudOS-Kernel/commit/eab7730c17c6ed5d61efdf01e7213674e37d863f.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencloudos%2Ffuse-extent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopencloudos%2Ffuse-extent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencloudos%2Ffuse-extent/lists"}