mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add a hard link marker to 16byte + maker, for future extensions
This commit is contained in:
parent
c49e2bb9a3
commit
474e2b6ac3
|
@ -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 mode
|
||||
if 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++
|
||||
|
|
Loading…
Reference in a new issue