Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
72dbac68
Commit
72dbac68
authored
Mar 17, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add FileSystemConnector.InodeHandleCount(), and use it in AutoUnionFs.
parent
e7ded495
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
example/autounionfs/main.go
example/autounionfs/main.go
+3
-1
fuse/fsconnector.go
fuse/fsconnector.go
+6
-0
unionfs/autounion.go
unionfs/autounion.go
+9
-0
No files found.
example/autounionfs/main.go
View file @
72dbac68
...
...
@@ -65,6 +65,8 @@ func main() {
state
.
Debug
=
*
debug
gofs
.
SetMountState
(
state
)
gofs
.
SetFileSystemConnector
(
conn
)
state
.
Loop
()
time
.
Sleep
(
1
*
time
.
Second
)
}
fuse/fsconnector.go
View file @
72dbac68
...
...
@@ -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
()
...
...
unionfs/autounion.go
View file @
72dbac68
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment