mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
remove unused symlink resolving
This commit is contained in:
parent
88945d9954
commit
bd13a7968f
|
@ -125,7 +125,7 @@ func (wfs *WFS) Init(server *fuse.Server) {
|
||||||
wfs.fuseServer = server
|
wfs.fuseServer = server
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wfs *WFS) maybeReadEntry(inode uint64, followSymLink bool) (path util.FullPath, fh *FileHandle, entry *filer_pb.Entry, targetInode uint64, status fuse.Status) {
|
func (wfs *WFS) maybeReadEntry(inode uint64) (path util.FullPath, fh *FileHandle, entry *filer_pb.Entry, status fuse.Status) {
|
||||||
path, status = wfs.inodeToPath.GetPath(inode)
|
path, status = wfs.inodeToPath.GetPath(inode)
|
||||||
if status != fuse.OK {
|
if status != fuse.OK {
|
||||||
return
|
return
|
||||||
|
@ -139,16 +139,6 @@ func (wfs *WFS) maybeReadEntry(inode uint64, followSymLink bool) (path util.Full
|
||||||
} else {
|
} else {
|
||||||
entry, status = wfs.maybeLoadEntry(path)
|
entry, status = wfs.maybeLoadEntry(path)
|
||||||
}
|
}
|
||||||
targetInode = inode
|
|
||||||
if status == fuse.OK && followSymLink && entry.FileMode()&os.ModeSymlink != 0 {
|
|
||||||
if entry != nil && entry.Attributes != nil && entry.Attributes.Inode != 0 {
|
|
||||||
targetInode = entry.Attributes.Inode
|
|
||||||
}
|
|
||||||
target := util.FullPath(filepath.Join(string(path), "../"+entry.Attributes.SymlinkTarget))
|
|
||||||
targetParent, _ := target.DirAndName()
|
|
||||||
wfs.inodeToPath.EnsurePath(util.FullPath(targetParent), true)
|
|
||||||
entry, status = wfs.maybeLoadEntry(target)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ func (wfs *WFS) GetAttr(cancel <-chan struct{}, input *fuse.GetAttrIn, out *fuse
|
||||||
}
|
}
|
||||||
|
|
||||||
inode := input.NodeId
|
inode := input.NodeId
|
||||||
_, _, entry, inode, status := wfs.maybeReadEntry(inode, false)
|
_, _, entry, status := wfs.maybeReadEntry(inode)
|
||||||
if status == fuse.OK {
|
if status == fuse.OK {
|
||||||
out.AttrValid = 1
|
out.AttrValid = 1
|
||||||
wfs.setAttrByPbEntry(&out.Attr, inode, entry)
|
wfs.setAttrByPbEntry(&out.Attr, inode, entry)
|
||||||
|
@ -40,7 +40,7 @@ func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse
|
||||||
return fuse.Status(syscall.ENOSPC)
|
return fuse.Status(syscall.ENOSPC)
|
||||||
}
|
}
|
||||||
|
|
||||||
path, fh, entry, inode, status := wfs.maybeReadEntry(input.NodeId, false)
|
path, fh, entry, status := wfs.maybeReadEntry(input.NodeId)
|
||||||
if status != fuse.OK {
|
if status != fuse.OK {
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse
|
||||||
}
|
}
|
||||||
|
|
||||||
out.AttrValid = 1
|
out.AttrValid = 1
|
||||||
wfs.setAttrByPbEntry(&out.Attr, inode, entry)
|
wfs.setAttrByPbEntry(&out.Attr, input.NodeId, entry)
|
||||||
|
|
||||||
if fh != nil {
|
if fh != nil {
|
||||||
fh.dirtyMetadata = true
|
fh.dirtyMetadata = true
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) {
|
func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) {
|
||||||
var entry *filer_pb.Entry
|
var entry *filer_pb.Entry
|
||||||
_, _, entry, inode, status = wfs.maybeReadEntry(inode, true)
|
_, _, entry, status = wfs.maybeReadEntry(inode)
|
||||||
if status == fuse.OK {
|
if status == fuse.OK {
|
||||||
// need to AcquireFileHandle again to ensure correct handle counter
|
// need to AcquireFileHandle again to ensure correct handle counter
|
||||||
fileHandle = wfs.fhmap.AcquireFileHandle(wfs, inode, entry)
|
fileHandle = wfs.fhmap.AcquireFileHandle(wfs, inode, entry)
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (wfs *WFS) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr str
|
||||||
return 0, fuse.EINVAL
|
return 0, fuse.EINVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, entry, _, status := wfs.maybeReadEntry(header.NodeId, false)
|
_, _, entry, status := wfs.maybeReadEntry(header.NodeId)
|
||||||
if status != fuse.OK {
|
if status != fuse.OK {
|
||||||
return 0, status
|
return 0, status
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ func (wfs *WFS) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
path, fh, entry, _, status := wfs.maybeReadEntry(input.NodeId, false)
|
path, fh, entry, status := wfs.maybeReadEntry(input.NodeId)
|
||||||
if status != fuse.OK {
|
if status != fuse.OK {
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ func (wfs *WFS) ListXAttr(cancel <-chan struct{}, header *fuse.InHeader, dest []
|
||||||
return 0, fuse.Status(syscall.ENOTSUP)
|
return 0, fuse.Status(syscall.ENOTSUP)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, entry, _, status := wfs.maybeReadEntry(header.NodeId, false)
|
_, _, entry, status := wfs.maybeReadEntry(header.NodeId)
|
||||||
if status != fuse.OK {
|
if status != fuse.OK {
|
||||||
return 0, status
|
return 0, status
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ func (wfs *WFS) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr
|
||||||
if len(attr) == 0 {
|
if len(attr) == 0 {
|
||||||
return fuse.EINVAL
|
return fuse.EINVAL
|
||||||
}
|
}
|
||||||
path, fh, entry, _, status := wfs.maybeReadEntry(header.NodeId, false)
|
path, fh, entry, status := wfs.maybeReadEntry(header.NodeId)
|
||||||
if status != fuse.OK {
|
if status != fuse.OK {
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue