aboutsummaryrefslogtreecommitdiff
path: root/weed
diff options
context:
space:
mode:
Diffstat (limited to 'weed')
-rw-r--r--weed/mount/filehandle_map.go5
-rw-r--r--weed/mount/weedfs_dir_read.go5
2 files changed, 2 insertions, 8 deletions
diff --git a/weed/mount/filehandle_map.go b/weed/mount/filehandle_map.go
index 288e0135d..852ef9e35 100644
--- a/weed/mount/filehandle_map.go
+++ b/weed/mount/filehandle_map.go
@@ -9,7 +9,6 @@ import (
type FileHandleToInode struct {
sync.RWMutex
- nextFh FileHandleId
inode2fh map[uint64]*FileHandle
fh2inode map[FileHandleId]uint64
}
@@ -18,7 +17,6 @@ func NewFileHandleToInode() *FileHandleToInode {
return &FileHandleToInode{
inode2fh: make(map[uint64]*FileHandle),
fh2inode: make(map[FileHandleId]uint64),
- nextFh: FileHandleId(util.RandomUint64()),
}
}
@@ -44,8 +42,7 @@ func (i *FileHandleToInode) AcquireFileHandle(wfs *WFS, inode uint64, entry *fil
defer i.Unlock()
fh, found := i.inode2fh[inode]
if !found {
- fh = newFileHandle(wfs, i.nextFh, inode, entry)
- i.nextFh = FileHandleId(util.RandomUint64())
+ fh = newFileHandle(wfs, FileHandleId(util.RandomUint64()), inode, entry)
i.inode2fh[inode] = fh
i.fh2inode[fh.fh] = inode
} else {
diff --git a/weed/mount/weedfs_dir_read.go b/weed/mount/weedfs_dir_read.go
index 26e523a43..c80ecce9e 100644
--- a/weed/mount/weedfs_dir_read.go
+++ b/weed/mount/weedfs_dir_read.go
@@ -44,10 +44,7 @@ func NewDirectoryHandleToInode() *DirectoryHandleToInode {
}
func (wfs *WFS) AcquireDirectoryHandle() (DirectoryHandleId, *DirectoryHandle) {
- wfs.fhmap.Lock()
- fh := wfs.fhmap.nextFh
- wfs.fhmap.nextFh = FileHandleId(util.RandomUint64())
- wfs.fhmap.Unlock()
+ fh := FileHandleId(util.RandomUint64())
wfs.dhmap.Lock()
defer wfs.dhmap.Unlock()