SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
mount: add -writebackCache flag for FUSE writeback caching (#7921)
Chris Lu1424fe6ed518
diff --git a/weed/command/mount.go b/weed/command/mount.goindex 54c7a06912..82b74f7917 100644--- a/weed/command/mount.go+++ b/weed/command/mount.go@@ -47,6 +47,9 @@ type MountOptions struct {rdmaReadOnly *boolrdmaMaxConcurrent *intrdmaTimeoutMs *int++ // FUSE performance options+ writebackCache *bool}var (@@ -102,6 +105,9 @@ func init() {mountCpuProfile = cmdMount.Flag.String("cpuprofile", "", "cpu profile output file")mountMemProfile = cmdMount.Flag.String("memprofile", "", "memory profile output file")mountReadRetryTime = cmdMount.Flag.Duration("readRetryTime", 6*time.Second, "maximum read retry wait time")++ // FUSE performance options+ mountOptions.writebackCache = cmdMount.Flag.Bool("writebackCache", false, "enable FUSE writeback cache for improved write performance (at risk of data loss on crash)")}var cmdMount = &Command{diff --git a/weed/command/mount_std.go b/weed/command/mount_std.goindex de2470017c..7e688fc275 100644--- a/weed/command/mount_std.go+++ b/weed/command/mount_std.go@@ -214,6 +214,10 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {fuseMountOptions.Options = append(fuseMountOptions.Options, fmt.Sprintf("iosize=%d", ioSizeMB*1024*1024))}+ if *option.writebackCache {+ fuseMountOptions.Options = append(fuseMountOptions.Options, "writeback_cache")+ }+// find mount pointmountRoot := filerMountRootPathif mountRoot != "/" && strings.HasSuffix(mountRoot, "/") {@@ -226,34 +230,34 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {}seaweedFileSystem := mount.NewSeaweedFileSystem(&mount.Option{- MountDirectory: dir,- FilerAddresses: filerAddresses,- GrpcDialOption: grpcDialOption,- FilerMountRootPath: mountRoot,- Collection: *option.collection,- Replication: *option.replication,- TtlSec: int32(*option.ttlSec),- DiskType: types.ToDiskType(*option.diskType),- ChunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024,- ConcurrentWriters: *option.concurrentWriters,- ConcurrentReaders: *option.concurrentReaders,- CacheDirForRead: *option.cacheDirForRead,- CacheSizeMBForRead: *option.cacheSizeMBForRead,- CacheDirForWrite: cacheDirForWrite,- CacheMetaTTlSec: *option.cacheMetaTtlSec,- DataCenter: *option.dataCenter,- Quota: int64(*option.collectionQuota) * 1024 * 1024,- MountUid: uid,- MountGid: gid,- MountMode: mountMode,- MountCtime: fileInfo.ModTime(),- MountMtime: time.Now(),- Umask: umask,- VolumeServerAccess: *mountOptions.volumeServerAccess,- Cipher: cipher,- UidGidMapper: uidGidMapper,- DisableXAttr: *option.disableXAttr,- IsMacOs: runtime.GOOS == "darwin",+ MountDirectory: dir,+ FilerAddresses: filerAddresses,+ GrpcDialOption: grpcDialOption,+ FilerMountRootPath: mountRoot,+ Collection: *option.collection,+ Replication: *option.replication,+ TtlSec: int32(*option.ttlSec),+ DiskType: types.ToDiskType(*option.diskType),+ ChunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024,+ ConcurrentWriters: *option.concurrentWriters,+ ConcurrentReaders: *option.concurrentReaders,+ CacheDirForRead: *option.cacheDirForRead,+ CacheSizeMBForRead: *option.cacheSizeMBForRead,+ CacheDirForWrite: cacheDirForWrite,+ CacheMetaTTlSec: *option.cacheMetaTtlSec,+ DataCenter: *option.dataCenter,+ Quota: int64(*option.collectionQuota) * 1024 * 1024,+ MountUid: uid,+ MountGid: gid,+ MountMode: mountMode,+ MountCtime: fileInfo.ModTime(),+ MountMtime: time.Now(),+ Umask: umask,+ VolumeServerAccess: *mountOptions.volumeServerAccess,+ Cipher: cipher,+ UidGidMapper: uidGidMapper,+ DisableXAttr: *option.disableXAttr,+ IsMacOs: runtime.GOOS == "darwin",MetadataFlushSeconds: *option.metadataFlushSeconds,// RDMA acceleration optionsRdmaEnabled: *option.rdmaEnabled,