Skip to content

Commit

Permalink
Enable writeback_cache and async_dio FUSE options (#7980)
Browse files Browse the repository at this point in the history
* Enable writeback_cache and async_dio FUSE options

Fixes #7978

- Update mount_std.go to use EnableWriteback and EnableAsyncDio from go-fuse
- Add go.mod replace directive to use local go-fuse with capability support
- Remove temporary workaround that disabled these options

This enables proper FUSE kernel capability negotiation for writeback cache
and async direct I/O, improving performance for small writes and concurrent
direct I/O operations.

* Address PR review comments

- Remove redundant nil checks for writebackCache and asyncDio flags
- Update go.mod replace directive to use seaweedfs/go-fuse fork instead of local path

* Add TODO comment for go.mod replace directive

The replace directive must use a local path until seaweedfs/go-fuse#1 is merged.
After merge, this should be updated to use the proper version.

* Use seaweedfs/go-fuse v2.9.0 instead of local repository

Replace local path with seaweedfs/go-fuse v2.9.0 fork which includes
the writeback_cache and async_dio capability support.

* Use github.com/seaweedfs/go-fuse/v2 directly without replace directive

- Updated all imports to use github.com/seaweedfs/go-fuse/v2
- Removed replace directive from go.mod
- Using seaweedfs/go-fuse v2.0.0-20260106181308-87f90219ce09 which includes:
  * writeback_cache and async_dio support
  * Corrected module path

* Update to seaweedfs/go-fuse v2.9.1

Use v2.9.1 tag which includes the corrected module path
(github.com/seaweedfs/go-fuse/v2) along with writeback_cache
and async_dio support.
  • Loading branch information
Chris Lu authored and GitHub committed Jan 6, 2026
1 parent e10f11b commit d4ecfae
Show file tree
Hide file tree
Showing 29 changed files with 34 additions and 38 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ require (
github.com/gin-gonic/gin v1.11.0
github.com/golang-jwt/jwt/v5 v5.3.0
github.com/google/flatbuffers/go v0.0.0-20230108230133-3b8644d32c50
github.com/hanwen/go-fuse/v2 v2.9.0
github.com/hashicorp/raft v1.7.3
github.com/hashicorp/raft-boltdb/v2 v2.3.1
github.com/hashicorp/vault/api v1.22.0
Expand All @@ -152,6 +151,7 @@ require (
github.com/rdleal/intervalst v1.5.0
github.com/redis/go-redis/v9 v9.17.2
github.com/schollz/progressbar/v3 v3.19.0
github.com/seaweedfs/go-fuse/v2 v2.9.1
github.com/shirou/gopsutil/v4 v4.25.11
github.com/tarantool/go-tarantool/v2 v2.4.1
github.com/tikv/client-go/v2 v2.0.7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+u
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90=
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
github.com/hanwen/go-fuse/v2 v2.9.0 h1:0AOGUkHtbOVeyGLr0tXupiid1Vg7QB7M6YUcdmVdC58=
github.com/hanwen/go-fuse/v2 v2.9.0/go.mod h1:yE6D2PqWwm3CbYRxFXV9xUd8Md5d6NG0WBs5spCswmI=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand Down Expand Up @@ -1621,6 +1619,8 @@ github.com/schollz/progressbar/v3 v3.19.0 h1:Ea18xuIRQXLAUidVDox3AbwfUhD0/1Ivohy
github.com/schollz/progressbar/v3 v3.19.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec=
github.com/seaweedfs/cockroachdb-parser v0.0.0-20251021184156-909763b17138 h1:bX1vBF7GQjPeFQsCAZ8gCQGS/nJQnekL7gZ4Qg/pF4E=
github.com/seaweedfs/cockroachdb-parser v0.0.0-20251021184156-909763b17138/go.mod h1:JSKCh6uCHBz91lQYFYHCyTrSVIPge4SUFVn28iwMNB0=
github.com/seaweedfs/go-fuse/v2 v2.9.1 h1:gnKmfrKreCRGJmekGz5WMnNZqXEf9s9+V2hdWQdvx88=
github.com/seaweedfs/go-fuse/v2 v2.9.1/go.mod h1:zABdmWEa6A0bwaBeEOBUeUkGIZlxUhcdv+V1Dcc/U/I=
github.com/seaweedfs/goexif v1.0.3 h1:ve/OjI7dxPW8X9YQsv3JuVMaxEyF9Rvfd04ouL+Bz30=
github.com/seaweedfs/goexif v1.0.3/go.mod h1:Oni780Z236sXpIQzk1XoJlTwqrJ02smEin9zQeff7Fk=
github.com/seaweedfs/raft v1.1.6 h1:e83Xn0boscPnuSiBllUPeWRVS6JKrqJPYBozgFyBiC0=
Expand Down
10 changes: 3 additions & 7 deletions weed/command/mount_std.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/seaweedfs/seaweedfs/weed/util/version"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/mount"
"github.com/seaweedfs/seaweedfs/weed/mount/meta_cache"
Expand Down Expand Up @@ -216,12 +216,8 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
fuseMountOptions.Options = append(fuseMountOptions.Options, fmt.Sprintf("iosize=%d", ioSizeMB*1024*1024))
}

if option.writebackCache != nil && *option.writebackCache {
fuseMountOptions.Options = append(fuseMountOptions.Options, "writeback_cache")
}
if option.asyncDio != nil && *option.asyncDio {
fuseMountOptions.Options = append(fuseMountOptions.Options, "async_dio")
}
fuseMountOptions.EnableWriteback = *option.writebackCache
fuseMountOptions.EnableAsyncDio = *option.asyncDio
if option.cacheSymlink != nil && *option.cacheSymlink {
fuseMountOptions.EnableSymlinkCaching = true
}
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/error_classifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
"syscall"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/inode_to_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"
"time"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/util"
)
Expand Down
4 changes: 2 additions & 2 deletions weed/mount/weedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"sync/atomic"
"time"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"google.golang.org/grpc"

"github.com/seaweedfs/seaweedfs/weed/filer"
Expand All @@ -26,7 +26,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/util/version"
"github.com/seaweedfs/seaweedfs/weed/wdclient"

"github.com/hanwen/go-fuse/v2/fs"
"github.com/seaweedfs/go-fuse/v2/fs"
)

type Option struct {
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_attr.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"syscall"
"time"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_attr_darwin.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mount

import (
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
)

func setBlksize(out *fuse.Attr, size uint32) {
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_attr_freebsd.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mount

import (
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
)

func setBlksize(out *fuse.Attr, size uint32) {
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_attr_linux.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mount

import (
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
)

func setBlksize(out *fuse.Attr, size uint32) {
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_dir_lookup.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mount

import (
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"

"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_dir_mkrm.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"syscall"
"time"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"

"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_dir_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"sync"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/mount/meta_cache"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_file_copy_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"
"time"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"

"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/util"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_file_io.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mount

import (
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/glog"
)

Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_file_lseek.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/seaweedfs/seaweedfs/weed/util"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"

"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_file_mkrm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"syscall"
"time"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_file_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/seaweedfs/seaweedfs/weed/util"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"

"github.com/seaweedfs/seaweedfs/weed/glog"
)
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_file_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"syscall"
"time"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_file_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"syscall"
"time"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/util"
)
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_filehandle.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mount

import (
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/seaweedfs/weed/util"
)
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"syscall"
"time"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"

"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
Expand Down
4 changes: 2 additions & 2 deletions weed/mount/weedfs_rename.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"syscall"

"github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fs"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mount
import (
"context"
"fmt"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"math"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_symlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"syscall"
"time"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"

"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package mount

import "github.com/hanwen/go-fuse/v2/fuse"
import "github.com/seaweedfs/go-fuse/v2/fuse"

// https://github.com/libfuse/libfuse/blob/48ae2e72b39b6a31cb2194f6f11786b7ca06aac6/include/fuse.h#L778

Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_xattr.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"syscall"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
sys "golang.org/x/sys/unix"
)

Expand Down
2 changes: 1 addition & 1 deletion weed/mount/weedfs_xattr_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mount
import (
"syscall"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
)

func (wfs *WFS) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string, dest []byte) (size uint32, code fuse.Status) {
Expand Down
2 changes: 1 addition & 1 deletion weed/mount/wfs_save.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"syscall"

"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
Expand Down

0 comments on commit d4ecfae

Please sign in to comment.