Commit 72dbac68 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Add FileSystemConnector.InodeHandleCount(), and use it in AutoUnionFs.

parent e7ded495
......@@ -65,6 +65,8 @@ func main() {
state.Debug = *debug
gofs.SetMountState(state)
gofs.SetFileSystemConnector(conn)
state.Loop()
time.Sleep(1 *time.Second)
}
......@@ -137,6 +137,12 @@ func (me *FileSystemConnector) forgetUpdate(node *Inode, forgetCount int) {
me.recursiveConsiderDropInode(node)
}
// InodeCount returns the number of inodes registered with the kernel.
func (me *FileSystemConnector) InodeHandleCount() int {
return me.inodeMap.Count()
}
func (me *FileSystemConnector) considerDropInode(node *Inode) {
node.treeLock.Lock()
defer node.treeLock.Unlock()
......
......@@ -35,6 +35,7 @@ type AutoUnionFs struct {
options *AutoUnionFsOptions
mountState *fuse.MountState
connector *fuse.FileSystemConnector
}
type AutoUnionFsOptions struct {
......@@ -350,6 +351,10 @@ func (me *AutoUnionFs) SetMountState(state *fuse.MountState) {
me.mountState = state
}
func (me *AutoUnionFs) SetFileSystemConnector(conn *fuse.FileSystemConnector) {
me.connector = conn
}
func (me *AutoUnionFs) DebugData() string {
if me.mountState == nil {
return "AutoUnionFs.mountState not set"
......@@ -373,6 +378,10 @@ func (me *AutoUnionFs) DebugData() string {
msg += fmt.Sprintf("Op counts: %v\n", counts)
}
if me.connector != nil {
msg += fmt.Sprintf("Live inodes: %d\n", me.connector.InodeHandleCount())
}
return msg
}
......
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