Am 01.07.2025 um 13:44 hat Hanna Czenczek geschrieben:
> FUSE allows creating multiple request queues by "cloning" /dev/fuse FDs
> (via open("/dev/fuse") + ioctl(FUSE_DEV_IOC_CLONE)).
>
> We can use this to implement multi-threading.
>
> For configuration, we don't need any more information beyond the simple
> array provided by the core block export interface: The FUSE kernel
> driver feeds these FDs in a round-robin fashion, so all of them are
> equivalent and we want to have exactly one per thread.
> [...]
> @@ -451,6 +553,16 @@ static void fuse_export_delete(BlockExport *blk_exp)
> {
> FuseExport *exp = container_of(blk_exp, FuseExport, common);
>
> + for (int i = 0; i < exp->num_queues; i++) {
> + FuseQueue *q = &exp->queues[i];
> +
> + /* Queue 0's FD belongs to the FUSE session */
> + if (i > 0 && q->fuse_fd >= 0) {
Why not start the loop with i = 1 instead of starting at 0 and then not
doing anything in the first iteration?
(I love the >= 0, running FUSE over stdin must be fun. :-))
> + close(q->fuse_fd);
> + }
> + }
> + g_free(exp->queues);
> +
> if (exp->fuse_session) {
> if (exp->mounted) {
> fuse_session_unmount(exp->fuse_session);
Kevin