Commit cb68d31a authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse/nodefs: reduce critical section for memnode.

parent f498bfe0
...@@ -47,16 +47,17 @@ func (fs *memNodeFs) OnUnmount() { ...@@ -47,16 +47,17 @@ func (fs *memNodeFs) OnUnmount() {
func (fs *memNodeFs) newNode() *memNode { func (fs *memNodeFs) newNode() *memNode {
fs.mutex.Lock() fs.mutex.Lock()
id := fs.nextFree
fs.nextFree++
fs.mutex.Unlock()
n := &memNode{ n := &memNode{
Node: NewDefaultNode(), Node: NewDefaultNode(),
fs: fs, fs: fs,
id: fs.nextFree, id: id,
} }
now := time.Now() now := time.Now()
n.info.SetTimes(&now, &now, &now) n.info.SetTimes(&now, &now, &now)
n.info.Mode = fuse.S_IFDIR | 0777 n.info.Mode = fuse.S_IFDIR | 0777
fs.nextFree++
fs.mutex.Unlock()
return n return n
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment