Browse Source

Enable writeback_cache and async_dio FUSE options (#7980)

* 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.
pull/7875/head
Chris Lu 4 days ago
committed by GitHub
parent
commit
d4ecfaeda7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      go.mod
  2. 4
      go.sum
  3. 10
      weed/command/mount_std.go
  4. 2
      weed/mount/error_classifier.go
  5. 2
      weed/mount/inode_to_path.go
  6. 4
      weed/mount/weedfs.go
  7. 2
      weed/mount/weedfs_attr.go
  8. 2
      weed/mount/weedfs_attr_darwin.go
  9. 2
      weed/mount/weedfs_attr_freebsd.go
  10. 2
      weed/mount/weedfs_attr_linux.go
  11. 2
      weed/mount/weedfs_dir_lookup.go
  12. 2
      weed/mount/weedfs_dir_mkrm.go
  13. 2
      weed/mount/weedfs_dir_read.go
  14. 2
      weed/mount/weedfs_file_copy_range.go
  15. 2
      weed/mount/weedfs_file_io.go
  16. 2
      weed/mount/weedfs_file_lseek.go
  17. 2
      weed/mount/weedfs_file_mkrm.go
  18. 2
      weed/mount/weedfs_file_read.go
  19. 2
      weed/mount/weedfs_file_sync.go
  20. 2
      weed/mount/weedfs_file_write.go
  21. 2
      weed/mount/weedfs_filehandle.go
  22. 2
      weed/mount/weedfs_link.go
  23. 4
      weed/mount/weedfs_rename.go
  24. 2
      weed/mount/weedfs_stats.go
  25. 2
      weed/mount/weedfs_symlink.go
  26. 2
      weed/mount/weedfs_unsupported.go
  27. 2
      weed/mount/weedfs_xattr.go
  28. 2
      weed/mount/weedfs_xattr_freebsd.go
  29. 2
      weed/mount/wfs_save.go

2
go.mod

@ -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
@ -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

4
go.sum

@ -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=
@ -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=

10
weed/command/mount_std.go

@ -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"
@ -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
}

2
weed/mount/error_classifier.go

@ -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"
)

2
weed/mount/inode_to_path.go

@ -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"
)

4
weed/mount/weedfs.go

@ -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"
@ -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 {

2
weed/mount/weedfs_attr.go

@ -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"

2
weed/mount/weedfs_attr_darwin.go

@ -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) {

2
weed/mount/weedfs_attr_freebsd.go

@ -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) {

2
weed/mount/weedfs_attr_linux.go

@ -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) {

2
weed/mount/weedfs_dir_lookup.go

@ -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"

2
weed/mount/weedfs_dir_mkrm.go

@ -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"

2
weed/mount/weedfs_dir_read.go

@ -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"

2
weed/mount/weedfs_file_copy_range.go

@ -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"

2
weed/mount/weedfs_file_io.go

@ -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"
)

2
weed/mount/weedfs_file_lseek.go

@ -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"

2
weed/mount/weedfs_file_mkrm.go

@ -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"

2
weed/mount/weedfs_file_read.go

@ -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"
)

2
weed/mount/weedfs_file_sync.go

@ -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"

2
weed/mount/weedfs_file_write.go

@ -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"
)

2
weed/mount/weedfs_filehandle.go

@ -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"
)

2
weed/mount/weedfs_link.go

@ -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"

4
weed/mount/weedfs_rename.go

@ -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"

2
weed/mount/weedfs_stats.go

@ -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"

2
weed/mount/weedfs_symlink.go

@ -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"

2
weed/mount/weedfs_unsupported.go

@ -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

2
weed/mount/weedfs_xattr.go

@ -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"
)

2
weed/mount/weedfs_xattr_freebsd.go

@ -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) {

2
weed/mount/wfs_save.go

@ -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"

Loading…
Cancel
Save