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
add a hard link marker to 16byte + maker, for future extensions
Chris Lu474e2b6ac389
diff --git a/weed/filesys/dir_link.go b/weed/filesys/dir_link.goindex 368ded442c..f6bc41b56d 100644--- a/weed/filesys/dir_link.go+++ b/weed/filesys/dir_link.go@@ -18,6 +18,10 @@ var _ = fs.NodeLinker(&Dir{})var _ = fs.NodeSymlinker(&Dir{})var _ = fs.NodeReadlinker(&File{})+const (+ HARD_LINK_MARKER = '\x01'+)+func (dir *Dir) Link(ctx context.Context, req *fuse.LinkRequest, old fs.Node) (fs.Node, error) {oldFile, ok := old.(*File)@@ -33,7 +37,7 @@ func (dir *Dir) Link(ctx context.Context, req *fuse.LinkRequest, old fs.Node) (f// update old file to hardlink modeif len(oldFile.entry.HardLinkId) == 0 {- oldFile.entry.HardLinkId = util.RandomBytes(16)+ oldFile.entry.HardLinkId = append(util.RandomBytes(16), HARD_LINK_MARKER)oldFile.entry.HardLinkCounter = 1}oldFile.entry.HardLinkCounter++