mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-20 22:27:04 +00:00
* fix(filer): derive inodes by hash instead of a snowflake sequencer
Compute the same inode the FUSE mount would: non-hard-linked entries hash path + crtime, hard links hash their shared HardLinkId so every link resolves to one inode. Removes the snowflake inodeSequencer and the SEAWEEDFS_FILER_SNOWFLAKE_ID knob; inodes are now deterministic across filers.
* chore: remove the experimental NFS gateway
The NFS frontend ('weed nfs') was the only consumer of the inode->path index. Remove the weed/server/nfs package, the command and its registration, the integration test harness, and the CI workflow; go mod tidy drops the willscott/go-nfs and go-nfs-client dependencies.
* refactor(filer): drop the inode->path index
With the NFS gateway gone, nothing reads it. A regular file's inode is a pure hash of its path and a hard link's is a hash of its shared HardLinkId -- both derivable on demand -- so the secondary KV index and its write/remove hooks are dead. Removes filer_inode_index.go and the recordInodeIndex hooks from the store wrapper.
27 lines
776 B
Go
27 lines
776 B
Go
package filer
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/util"
|
|
)
|
|
|
|
// ensureEntryInode derives a stable inode the same way the FUSE mount does, so
|
|
// the filer-stored value matches what a mount would otherwise compute and no
|
|
// per-object reverse index is required. Hard links hash their shared
|
|
// HardLinkId, so every link resolves to one inode; other entries hash the path
|
|
// and creation time.
|
|
func (f *Filer) ensureEntryInode(entry *Entry) {
|
|
if entry == nil || entry.Attr.Inode != 0 {
|
|
return
|
|
}
|
|
if entry.Attr.Crtime.IsZero() {
|
|
entry.Attr.Crtime = time.Now()
|
|
}
|
|
if len(entry.HardLinkId) > 0 {
|
|
entry.Attr.Inode = uint64(util.HashStringToLong(string(entry.HardLinkId)))
|
|
return
|
|
}
|
|
entry.Attr.Inode = entry.FullPath.AsInode(entry.Attr.Crtime.Unix())
|
|
}
|