Commit 55831d20 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Add Inode.Live().

parent 84b2ec1f
...@@ -142,7 +142,7 @@ func (me *FileSystemConnector) considerDropInode(n *Inode) (drop bool) { ...@@ -142,7 +142,7 @@ func (me *FileSystemConnector) considerDropInode(n *Inode) (drop bool) {
me.inodeMap.Forget(ch.nodeId) me.inodeMap.Forget(ch.nodeId)
} }
if len(n.children) > 0 || n.lookupCount > 0 { if len(n.children) > 0 || n.Live() {
return false return false
} }
if n == me.rootNode || n.mountPoint != nil { if n == me.rootNode || n.mountPoint != nil {
......
...@@ -59,6 +59,10 @@ func (me *Inode) LockTree() func() { ...@@ -59,6 +59,10 @@ func (me *Inode) LockTree() func() {
return func() { me.treeLock.Unlock() } return func() { me.treeLock.Unlock() }
} }
func (me *Inode) Live() bool {
return me.lookupCount > 0
}
// Returns any open file, preferably a r/w one. // Returns any open file, preferably a r/w one.
func (me *Inode) AnyFile() (file File) { func (me *Inode) AnyFile() (file File) {
me.openFilesMutex.Lock() me.openFilesMutex.Lock()
......
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