diff options
Diffstat (limited to 'weed/mount/weedfs.go')
| -rw-r--r-- | weed/mount/weedfs.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/weed/mount/weedfs.go b/weed/mount/weedfs.go index 849b3ad0c..41896ff87 100644 --- a/weed/mount/weedfs.go +++ b/weed/mount/weedfs.go @@ -15,6 +15,7 @@ import ( "google.golang.org/grpc" "github.com/seaweedfs/seaweedfs/weed/filer" + "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/mount/meta_cache" "github.com/seaweedfs/seaweedfs/weed/pb" "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" @@ -62,6 +63,14 @@ type Option struct { Cipher bool // whether encrypt data on volume server UidGidMapper *meta_cache.UidGidMapper + // RDMA acceleration options + RdmaEnabled bool + RdmaSidecarAddr string + RdmaFallback bool + RdmaReadOnly bool + RdmaMaxConcurrent int + RdmaTimeoutMs int + uniqueCacheDirForRead string uniqueCacheDirForWrite string } @@ -86,6 +95,7 @@ type WFS struct { fuseServer *fuse.Server IsOverQuota bool fhLockTable *util.LockTable[FileHandleId] + rdmaClient *RDMAMountClient FilerConf *filer.FilerConf } @@ -138,8 +148,28 @@ func NewSeaweedFileSystem(option *Option) *WFS { wfs.metaCache.Shutdown() os.RemoveAll(option.getUniqueCacheDirForWrite()) os.RemoveAll(option.getUniqueCacheDirForRead()) + if wfs.rdmaClient != nil { + wfs.rdmaClient.Close() + } }) + // Initialize RDMA client if enabled + if option.RdmaEnabled && option.RdmaSidecarAddr != "" { + rdmaClient, err := NewRDMAMountClient( + option.RdmaSidecarAddr, + wfs.LookupFn(), + option.RdmaMaxConcurrent, + option.RdmaTimeoutMs, + ) + if err != nil { + glog.Warningf("Failed to initialize RDMA client: %v", err) + } else { + wfs.rdmaClient = rdmaClient + glog.Infof("RDMA acceleration enabled: sidecar=%s, maxConcurrent=%d, timeout=%dms", + option.RdmaSidecarAddr, option.RdmaMaxConcurrent, option.RdmaTimeoutMs) + } + } + if wfs.option.ConcurrentWriters > 0 { wfs.concurrentWriters = util.NewLimitedConcurrentExecutor(wfs.option.ConcurrentWriters) wfs.concurrentCopiersSem = make(chan struct{}, wfs.option.ConcurrentWriters) |
