【特性描述】
部分情况下,fuse的文件系统只是充当了访问fuse的进程与下层文件系统之间的桥梁,文件的读写在用户态没有额外的操作或检查,直接由用户态的守护进程转发给下层文件系统处理。当前的fuse没有透传的能力,读写操作必须经过用户态守护进程,涉及多次上下文切换、唤醒、拷贝操作。如果可以识别这些用户态仅作为桥梁的情况,由内核fuse直接转发给下层文件系统而不是fuse守护进程,就可以减少这些开销,显著提供读写性能。
【特性收益】
Fuse passthrough性能测试符合预期:
读性能提升1倍+
写性能提升5.6倍
【适用场景】
蚂蚁场景下存在fuse直接对接tmpfs场景,传统的通过fuse用户态内核态进行交付存在极大的通信消耗,新增passthrough模式,在打开文件后,后续的读写直接通过fuse透传到tmpfs,达成io密集场景下10%性能提升。
同时,社区存在若干针对fuse的各类较小优化,同步至olk有利于对外竞争力构建。
【交付个人/团队】乔一凡
fuse passthrough依赖fuse的iomode模块、overlay部分特性以及backing file功能,其中backing file功能是从overlayfs提取出来的,因此需要额外合入patchset
涉及patchset:
- Rename and export some vfs helpers,对应编号01-02
https://lore.kernel.org/all/20230908132900.2983519-1-amir73il@gmail.com/
- Fuse iomode module,对应编号03-10:
https://lore.kernel.org/all/20240208170603.2078871-1-amir73il@gmail.com/
其中fuse: fix VM_MAYSHARE and direct_io_allow_mmap已合入
- overlayfs aio cleanups + 一个前置补丁,顺序同主线一致,对应编号11 12 13 14
https://lore.kernel.org/all/20230912173653.3317828-1-amir73il@gmail.com/
https://lore.kernel.org/all/20230928064636.487317-1-amir73il@gmail.com/
- Reduce impact of overlayfs backing files fake path,对应编号15-17
https://lore.kernel.org/all/20231009153712.1566422-1-amir73il@gmail.com/
- ovl: add helper ovl_file_modified(), 对应编号18
- overlayfs lock order changes,对应编号19 - 22
https://lore.kernel.org/all/20230816152334.924960-1-amir73il@gmail.com/
- tidy up file permission hooks,对应编号23 - 38
https://lore.kernel.org/all/20231122122715.2561213-1-amir73il@gmail.com/
bakcing file需要该补丁集在overlayfs和公共路径的修改
- Intruduce stacking filesystem vfs helpers(backing file补丁),对应编号39 - 42
https://lore.kernel.org/all/20231221095410.801061-2-amir73il@gmail.com/
- Fuse passthrough patchset,对应编号43-50
https://lore.kernel.org/all/20240206142453.1906268-1-amir73il@gmail.com/
- 后续bugfix,编号51-63:
10.1 FUSE passthrough fixes,编号51 52,其中fuse: prepare for long lived reference on backing file社区没合
https://lore.kernel.org/all/20240407155758.575216-1-amir73il@gmail.com/
10.2 fuse: verify zero padding in fuse_backing_map,编号53
https://lore.kernel.org/all/20240422064008.936525-1-amir73il@gmail.com/
10.3 fuse: respect FOPEN_KEEP_CACHE on opendir,编号54
https://docs.nvidia.com/doca/archive/2-9-2-lts-ovs-update/doca+nvme+emulation+application+guide/index.html
10.4 fuse: use exclusive lock when FUSE_I_CACHE_IO_MODE is set,编号55
https://lore.kernel.org/all/20240914085131.3871317-1-yangyun50@huawei.com/
10.5 ovl: fix dentry reference leak after changes to underlying layers,编号56
10.6 ovl: relax WARN_ON in ovl_verify_area(),编号57
https://lore.kernel.org/all/2024050133-CVE-2024-27069-5b70@gregkh/
10.7 remap_range: merge do_clone_file_range() into vfs_clone_file_range(),编号58
https://lore.kernel.org/all/20240202102258.1582671-1-amir73il@gmail.com/
10.8 fs: fix __sb_write_started() kerneldoc formatting,编号59
https://lore.kernel.org/all/20231228100608.3123987-1-vegard.nossum@oracle.com/
10.9 fuse: disable the combination of passthrough and writeback cache,编号60
https://lore.kernel.org/all/20240703173020.623069-1-bschubert@ddn.com/
10.10 Fix regression in libfuse test_copy_file_range(),编号61 62
https://lore.kernel.org/all/20241014192759.863031-2-amir73il@gmail.com/
10.11 backing-file: convert to using fops->splice_write,编号63
https://lore.kernel.org/all/20240708072208.25244-1-ed.tsai@mediatek.com/
10.12 Avert possible deadlock with splice() and fanotify, 编号64-66
https://lore.kernel.org/all/20231130141624.3338942-1-amir73il@gmail.com/
10.13 开启config,编号67