-
Notifications
You must be signed in to change notification settings - Fork 165
Add FUSE_DEV_IOC_CLONE support for multi-threaded reading #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Please add a test for this functionality. Also, I don't really like the idea of making |
|
@stepancheg I think you're working on a similar feature. Want to take a look and lemme know how they overlap, if at all? |
|
I left a comment in the other thread. |
Hi @stepancheg, can you point me there? I might not be on that issue / pull request. Thanks! |
|
It's this one: #572 |
I rebased onto main, so those changes are incorporated now. |
|
The approach @stepancheg described seems better to me, because it provides a simpler interface to users. Can you take a look at that and let me know if your use case requires additional functionality or lower level access? |
bae49e3 to
c321a9e
Compare
Adds support for parallel FUSE request processing using FUSE_DEV_IOC_CLONE: - clone_fd(): Clone the FUSE device fd for multi-threaded reading - from_fd_initialized(): Create session from cloned fd (skips handshake) - proto_version(): Get negotiated protocol version - Make run(), event_loop(), handshake() public for external use - Conditional handshake in run() - skip if already initialized The kernel distributes FUSE requests across all readers, enabling parallel request processing. Reader sessions share the mount with the primary session but can process requests independently. Uses libc::Ioctl type for FUSE_DEV_IOC_CLONE constant to support both glibc (c_ulong) and musl (i32) targets.
ffe3ad3 to
984aaff
Compare
|
I rebased again. #627 won’t work as is (as mentioned) because it doesn’t support the clone fd ioctl. Otherwise, if that was added, it should work. |
multiple event loops can work with and without ioctl. This is how libfuse works — single thread, multiple threads shared fd, or multiple threads clone fd with ioctl. I started without ioctl, because I presume we should make version without ioctl work first, and then add ioctl on top. |
|
Yeah, that makes.
I was saying that there isn’t a perf improvement if we don’t do the clone though. I will submit pull request on top of 627 that does the clone.
Sent from Yahoo Mail for iPhone
On Sunday, February 1, 2026, 6:06 PM, Stepan Koltsov ***@***.***> wrote:
stepancheg left a comment (cberner/fuser#421)
#627 won’t work as is (as mentioned) because it doesn’t support the clone fd ioctl
multiple event loops can work with and without ioctl. This is how libfuse works — single thread, multiple threads shared fd, or multiple threads clone fd with ioctl.
I started without ioctl, because I presume we should make version without ioctl work first, and then add ioctl on top.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
It is perf improvement if filesystem implementation does something non-trivial. But not as big as with ioctl. |
Summary
Add support for multi-threaded FUSE request processing using FUSE_DEV_IOC_CLONE ioctl.
This enables multiple threads to read FUSE requests in parallel from cloned file descriptors, improving throughput for high-concurrency workloads.
API
// Primary session handles INIT and runs in main thread
let session = Session::new(fs, mountpoint, &Config::default())?;
// Clone fd for additional reader threads
let cloned_fd = session.clone_fd()?;
let reader_session = Session::from_fd_initialized(fs_clone, cloned_fd, SessionACL::All);
std::thread::spawn(move || reader_session.run());
session.run()?;
Changes
Tests
Added two integration tests:
Platform Support
clone_fd() is only available on Linux (#[cfg(target_os = "linux")]).