Files
seaweedFS/weed/mount/error_classifier.go
Chris Lu d4ecfaeda7 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.
2026-01-06 10:50:54 -08:00

50 lines
1.1 KiB
Go

package mount
import (
"strings"
"syscall"
"github.com/seaweedfs/go-fuse/v2/fuse"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func grpcErrorToFuseStatus(err error) fuse.Status {
if err == nil {
return fuse.OK
}
// Unpack error for inspection
if s, ok := status.FromError(err); ok {
switch s.Code() {
case codes.OK:
return fuse.OK
case codes.Canceled, codes.DeadlineExceeded:
return fuse.Status(syscall.ETIMEDOUT)
case codes.Unavailable:
return fuse.Status(syscall.EAGAIN)
case codes.ResourceExhausted:
return fuse.Status(syscall.EAGAIN) // Or syscall.ENOSPC
case codes.PermissionDenied:
return fuse.Status(syscall.EACCES)
case codes.Unauthenticated:
return fuse.Status(syscall.EPERM)
case codes.NotFound:
return fuse.ENOENT
case codes.AlreadyExists:
return fuse.Status(syscall.EEXIST)
case codes.InvalidArgument:
return fuse.EINVAL
}
}
// String matching for errors that don't have proper gRPC codes but are known
errStr := err.Error()
if strings.Contains(errStr, "transport") {
return fuse.Status(syscall.EAGAIN)
}
// Add other string matches if necessary
return fuse.EIO
}