mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
count lookup or not
This commit is contained in:
parent
a129bda7d9
commit
6ac066d1dc
|
@ -30,7 +30,7 @@ func NewInodeToPath() *InodeToPath {
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *InodeToPath) Lookup(path util.FullPath, isDirectory bool) uint64 {
|
func (i *InodeToPath) Lookup(path util.FullPath, isDirectory bool, isLookup bool) uint64 {
|
||||||
i.Lock()
|
i.Lock()
|
||||||
defer i.Unlock()
|
defer i.Unlock()
|
||||||
inode, found := i.path2inode[path]
|
inode, found := i.path2inode[path]
|
||||||
|
@ -38,10 +38,16 @@ func (i *InodeToPath) Lookup(path util.FullPath, isDirectory bool) uint64 {
|
||||||
inode = i.nextInodeId
|
inode = i.nextInodeId
|
||||||
i.nextInodeId++
|
i.nextInodeId++
|
||||||
i.path2inode[path] = inode
|
i.path2inode[path] = inode
|
||||||
i.inode2path[inode] = &InodeEntry{path, 1, isDirectory, false}
|
if !isLookup {
|
||||||
|
i.inode2path[inode] = &InodeEntry{path, 0, isDirectory, false}
|
||||||
} else {
|
} else {
|
||||||
|
i.inode2path[inode] = &InodeEntry{path, 1, isDirectory, false}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if isLookup {
|
||||||
i.inode2path[inode].nlookup++
|
i.inode2path[inode].nlookup++
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return inode
|
return inode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (wfs *WFS) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name strin
|
||||||
return fuse.ENOENT
|
return fuse.ENOENT
|
||||||
}
|
}
|
||||||
|
|
||||||
inode := wfs.inodeToPath.Lookup(fullFilePath, localEntry.IsDirectory())
|
inode := wfs.inodeToPath.Lookup(fullFilePath, localEntry.IsDirectory(), true)
|
||||||
|
|
||||||
wfs.outputFilerEntry(out, inode, localEntry)
|
wfs.outputFilerEntry(out, inode, localEntry)
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ func (wfs *WFS) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out
|
||||||
return fuse.EIO
|
return fuse.EIO
|
||||||
}
|
}
|
||||||
|
|
||||||
inode := wfs.inodeToPath.Lookup(entryFullPath, true)
|
inode := wfs.inodeToPath.Lookup(entryFullPath, true, true)
|
||||||
|
|
||||||
wfs.outputPbEntry(out, inode, newEntry)
|
wfs.outputPbEntry(out, inode, newEntry)
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ func (wfs *WFS) Mknod(cancel <-chan struct{}, in *fuse.MknodIn, name string, out
|
||||||
return fuse.EIO
|
return fuse.EIO
|
||||||
}
|
}
|
||||||
|
|
||||||
inode := wfs.inodeToPath.Lookup(entryFullPath, false)
|
inode := wfs.inodeToPath.Lookup(entryFullPath, false, true)
|
||||||
|
|
||||||
wfs.outputPbEntry(out, inode, newEntry)
|
wfs.outputPbEntry(out, inode, newEntry)
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ func (wfs *WFS) Link(cancel <-chan struct{}, in *fuse.LinkIn, name string, out *
|
||||||
return fuse.EIO
|
return fuse.EIO
|
||||||
}
|
}
|
||||||
|
|
||||||
inode := wfs.inodeToPath.Lookup(newEntryPath, false)
|
inode := wfs.inodeToPath.Lookup(newEntryPath, false, true)
|
||||||
|
|
||||||
wfs.outputPbEntry(out, inode, request.Entry)
|
wfs.outputPbEntry(out, inode, request.Entry)
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ func (wfs *WFS) Symlink(cancel <-chan struct{}, header *fuse.InHeader, target st
|
||||||
return fuse.EIO
|
return fuse.EIO
|
||||||
}
|
}
|
||||||
|
|
||||||
inode := wfs.inodeToPath.Lookup(entryFullPath, false)
|
inode := wfs.inodeToPath.Lookup(entryFullPath, false, true)
|
||||||
|
|
||||||
wfs.outputPbEntry(out, inode, request.Entry)
|
wfs.outputPbEntry(out, inode, request.Entry)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue