mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-23 14:30:46 +02:00
fix(mount): add -posixDirNlink option for correct directory nlink
Add optional POSIX-compliant directory nlink counting (nlink = 2 + number_of_subdirectories) behind the -posixDirNlink flag. This requires listing cached directory entries on every stat, which has a performance cost, so it's off by default. When disabled (default), directories report nlink=2, which is the POSIX-compliant baseline for empty directories and a common default in distributed filesystems. - Set nlink baseline to 2 for all directories (was 1) - Add applyDirNlink() gated behind option.PosixDirNlink - Add -posixDirNlink CLI flag
This commit is contained in:
1 parent
cd82a9cb4b
commit
178532e63a
5 files changed
+44
-4
No files matched your search
@@ -56,6 +56,7 @@ type MountOptions struct {
|
||||
distributedLock *bool
|
||||
|
||||
// FUSE performance options
|
||||
posixDirNlink *bool
|
||||
writebackCache *bool
|
||||
asyncDio *bool
|
||||
cacheSymlink *bool
|
||||
@@ -132,6 +133,7 @@ func init() {
|
||||
mountOptions.distributedLock = cmdMount.Flag.Bool("dlm", false, "enable distributed lock for cross-mount write coordination (only one mount can write a file at a time)")
|
||||
|
||||
// FUSE performance options
|
||||
mountOptions.posixDirNlink = cmdMount.Flag.Bool("posix.dirNLink", false, "report POSIX-compliant directory nlink (2 + subdirectory count); costs one directory listing per stat")
|
||||
mountOptions.writebackCache = cmdMount.Flag.Bool("writebackCache", false, "enable FUSE writeback cache for improved write performance (at risk of data loss on crash)")
|
||||
mountOptions.asyncDio = cmdMount.Flag.Bool("asyncDio", false, "enable async direct I/O for better concurrency")
|
||||
mountOptions.cacheSymlink = cmdMount.Flag.Bool("cacheSymlink", false, "enable symlink caching to reduce metadata lookups")
|
||||
|
||||
@@ -354,6 +354,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
|
||||
DirIdleEvictSec: *option.dirIdleEvictSec,
|
||||
EnableDistributedLock: option.distributedLock != nil && *option.distributedLock,
|
||||
WritebackCache: option.writebackCache != nil && *option.writebackCache,
|
||||
PosixDirNlink: option.posixDirNlink != nil && *option.posixDirNlink,
|
||||
})
|
||||
|
||||
// create mount root
|
||||
|
||||
Reference in new issue
Block a user