Deallocate removed directories.

geesefs-0-30-9
Aaron Jacobs 2015-03-03 14:48:21 +11:00
parent 3076da562e
commit d8905b0d05
1 changed files with 9 additions and 2 deletions

View File

@ -169,6 +169,12 @@ func (fs *memFS) allocateInode(
return return
} }
// EXCLUSIVE_LOCKS_REQUIRED(fs.mu)
func (fs *memFS) deallocateInode(id fuse.InodeID) {
fs.freeInodes = append(fs.freeInodes, id)
fs.inodes[id] = nil
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// FileSystem methods // FileSystem methods
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@ -326,8 +332,9 @@ func (fs *memFS) RmDir(
// Remove the entry within the parent. // Remove the entry within the parent.
parent.RemoveChild(req.Name) parent.RemoveChild(req.Name)
// TODO(jacobsa): Remove the child when it's forgotten. (Can we get a failing // TODO(jacobsa): Don't remove the child until it's forgotten. Can we get a
// test by looking at inode ID allocation?) // failing test by continuing to read from an opened dir handle?
fs.deallocateInode(childID)
return return
} }