* 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.
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package mount
|
|
|
|
import (
|
|
"github.com/seaweedfs/go-fuse/v2/fuse"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/filer"
|
|
"github.com/seaweedfs/seaweedfs/weed/glog"
|
|
)
|
|
|
|
// Lookup is called by the kernel when the VFS wants to know
|
|
// about a file inside a directory. Many lookup calls can
|
|
// occur in parallel, but only one call happens for each (dir,
|
|
// name) pair.
|
|
|
|
func (wfs *WFS) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name string, out *fuse.EntryOut) (code fuse.Status) {
|
|
|
|
if s := checkName(name); s != fuse.OK {
|
|
return s
|
|
}
|
|
|
|
dirPath, code := wfs.inodeToPath.GetPath(header.NodeId)
|
|
if code != fuse.OK {
|
|
return
|
|
}
|
|
|
|
fullFilePath := dirPath.Child(name)
|
|
|
|
// Use shared lookup logic that checks cache first, then filer if needed
|
|
localEntry, status := wfs.lookupEntry(fullFilePath)
|
|
if status != fuse.OK {
|
|
return status
|
|
}
|
|
|
|
inode := wfs.inodeToPath.Lookup(fullFilePath, localEntry.Crtime.Unix(), localEntry.IsDirectory(), len(localEntry.HardLinkId) > 0, localEntry.Inode, true)
|
|
|
|
if fh, found := wfs.fhMap.FindFileHandle(inode); found {
|
|
fh.entryLock.RLock()
|
|
if entry := fh.GetEntry().GetEntry(); entry != nil {
|
|
glog.V(4).Infof("lookup opened file %s size %d", dirPath.Child(localEntry.Name()), filer.FileSize(entry))
|
|
localEntry = filer.FromPbEntry(string(dirPath), entry)
|
|
}
|
|
fh.entryLock.RUnlock()
|
|
}
|
|
|
|
wfs.outputFilerEntry(out, inode, localEntry)
|
|
|
|
return fuse.OK
|
|
|
|
}
|