aboutsummaryrefslogtreecommitdiff
path: root/weed/mount/inode_to_path.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-02-16 16:49:03 -0800
committerchrislu <chris.lu@gmail.com>2022-02-16 16:49:03 -0800
commit6ac066d1dc03335adeacf17b923b8208418c9124 (patch)
tree75e06d2b9f7761be482904322ef4ef8e084c8bb0 /weed/mount/inode_to_path.go
parenta129bda7d98bdbd8ca41c3aeb94739582686a6f1 (diff)
downloadseaweedfs-6ac066d1dc03335adeacf17b923b8208418c9124.tar.xz
seaweedfs-6ac066d1dc03335adeacf17b923b8208418c9124.zip
count lookup or not
Diffstat (limited to 'weed/mount/inode_to_path.go')
-rw-r--r--weed/mount/inode_to_path.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/weed/mount/inode_to_path.go b/weed/mount/inode_to_path.go
index ffb0cc02f..edea91a5d 100644
--- a/weed/mount/inode_to_path.go
+++ b/weed/mount/inode_to_path.go
@@ -30,7 +30,7 @@ func NewInodeToPath() *InodeToPath {
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()
defer i.Unlock()
inode, found := i.path2inode[path]
@@ -38,9 +38,15 @@ func (i *InodeToPath) Lookup(path util.FullPath, isDirectory bool) uint64 {
inode = i.nextInodeId
i.nextInodeId++
i.path2inode[path] = inode
- i.inode2path[inode] = &InodeEntry{path, 1, isDirectory, false}
+ if !isLookup {
+ i.inode2path[inode] = &InodeEntry{path, 0, isDirectory, false}
+ } else {
+ i.inode2path[inode] = &InodeEntry{path, 1, isDirectory, false}
+ }
} else {
- i.inode2path[inode].nlookup++
+ if isLookup {
+ i.inode2path[inode].nlookup++
+ }
}
return inode
}