From 672340608bbae0cc1bb83262e118486033e26d62 Mon Sep 17 00:00:00 2001 From: Geert Jansen Date: Tue, 2 Jun 2026 14:48:42 +0000 Subject: [PATCH] Expose FUSE_ASYNC_DIO in MountConfig When FUSE handles a read or write operation that is larger than the maximum FUSE message size it has to break up the request into multiple smaller ones. When this flag is set, FUSE will send these smaller requests in parallel to the FUSE server, which can then start the IO for all of them at the same time. This can significanlty increase throughput for remote file systems such as GCSFuse. On current Linux kernels, the FUSE_ASYNC_DIO works for async IO (io_uring and libaio), but not for the traditional Posix read() and write() operations. --- connection.go | 5 +++++ mount_config.go | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/connection.go b/connection.go index ba65e67b..83fd020a 100644 --- a/connection.go +++ b/connection.go @@ -168,6 +168,7 @@ func (c *Connection) Init() error { cacheSymlinks := initOp.Flags&fusekernel.InitCacheSymlinks > 0 noOpenSupport := initOp.Flags&fusekernel.InitNoOpenSupport > 0 noOpendirSupport := initOp.Flags&fusekernel.InitNoOpendirSupport > 0 + asyncDIO := initOp.Flags&fusekernel.InitAsyncDIO > 0 // Respond to the init op. initOp.Library = c.protocol @@ -183,6 +184,10 @@ func (c *Connection) Init() error { initOp.Flags |= fusekernel.InitAsyncRead } + if c.cfg.EnableAsyncDIO && asyncDIO { + initOp.Flags |= fusekernel.InitAsyncDIO + } + // kernel 4.20 increases the max from 32 -> 256 initOp.Flags |= fusekernel.InitMaxPages diff --git a/mount_config.go b/mount_config.go index f95895ad..cc2cfae4 100644 --- a/mount_config.go +++ b/mount_config.go @@ -188,10 +188,12 @@ type MountConfig struct { // If not set, /proc/mounts will show the filesystem type as fuse/fuseblk. Subtype string - // Flag to enable async reads that are received from - // the kernel + // Flag to enable async buffered reads EnableAsyncReads bool + // Flag to enable async direct IO + EnableAsyncDIO bool + // Flag to enable parallel lookup and readdir operations from the // kernel // Ref: https://github.com/torvalds/linux/commit/5c672ab3f0ee0f78f7acad183f34db0f8781a200