diff options
| author | chrislu <chris.lu@gmail.com> | 2024-08-10 10:01:57 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2024-08-10 10:01:57 -0700 |
| commit | 7438648d1cfacd5ca570dd029d1bdb5fd271bd70 (patch) | |
| tree | cf12b49473be0373cb03d83470ddc75708454171 /weed/mount/filehandle_map.go | |
| parent | 49893267e978cc3fda00dc991e00099742fb5a9d (diff) | |
| parent | 63c707f9c1b4dc469ec39c446563c324ce4ccb6f (diff) | |
| download | seaweedfs-7438648d1cfacd5ca570dd029d1bdb5fd271bd70.tar.xz seaweedfs-7438648d1cfacd5ca570dd029d1bdb5fd271bd70.zip | |
Merge branch 'master' into mq
Diffstat (limited to 'weed/mount/filehandle_map.go')
| -rw-r--r-- | weed/mount/filehandle_map.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/weed/mount/filehandle_map.go b/weed/mount/filehandle_map.go index f0051f061..852ef9e35 100644 --- a/weed/mount/filehandle_map.go +++ b/weed/mount/filehandle_map.go @@ -1,6 +1,7 @@ package mount import ( + "github.com/seaweedfs/seaweedfs/weed/util" "sync" "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" @@ -8,7 +9,6 @@ import ( type FileHandleToInode struct { sync.RWMutex - nextFh FileHandleId inode2fh map[uint64]*FileHandle fh2inode map[FileHandleId]uint64 } @@ -17,7 +17,6 @@ func NewFileHandleToInode() *FileHandleToInode { return &FileHandleToInode{ inode2fh: make(map[uint64]*FileHandle), fh2inode: make(map[FileHandleId]uint64), - nextFh: 0, } } @@ -43,14 +42,13 @@ 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++ + fh = newFileHandle(wfs, FileHandleId(util.RandomUint64()), inode, entry) i.inode2fh[inode] = fh i.fh2inode[fh.fh] = inode } else { fh.counter++ } - if fh.GetEntry() != entry { + if fh.GetEntry().GetEntry() != entry { fh.SetEntry(entry) } return fh |
