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
Kirill Smelkov
go-fuse
Commits
c676bc1c
Commit
c676bc1c
authored
Jun 14, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ef20d933
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
0 deletions
+105
-0
fuse/ievicttrace
fuse/ievicttrace
+21
-0
fuse/test/ievict_test.go.old
fuse/test/ievict_test.go.old
+84
-0
No files found.
fuse/ievicttrace
0 → 100755
View file @
c676bc1c
#!/usr/bin/env bpftrace
# ievicttrace - trace from where / how inodes are evicted by Linux kernel
#include <linux/fs.h>
/*
kprobe:evict {
@ievict[kstack] = count();
}
interval:s:3 {
print(@ievict);
clear(@ievict);
}
*/
kprobe:fuse_evict_inode {
$inode = (inode *)arg0;
$t = elapsed / 1000;
printf("%d.%d EVICT i%d: %s\n", $t/1000000, $t%1000000, $inode->i_ino, kstack);
}
fuse/test/ievict_test.go.old
0 → 100644
View file @
c676bc1c
package
test
//
demonstrate
that
idir
can
be
evicted
/
forgotten
while
its
child
ifile
is
active
import
(
"os"
"testing"
"time"
"github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/hanwen/go-fuse/internal/testutil"
"lab.nexedi.com/kirr/go123/exc"
)
func
TestIEvict
(
t
*
testing
.
T
)
{
X
:=
exc
.
Raiseif
dir
:=
testutil
.
TempDir
()
defer
func
()
{
err
:=
os
.
Remove
(
dir
);
X
(
err
)
}()
//
setup
a
filesystem
with
/
->
A
->
B
->
file
root
:=
nodefs
.
NewDefaultNode
()
opts
:=
nodefs
.
NewOptions
()
//
entry
timeout
=
1
s
opts
.
Debug
=
testutil
.
VerboseTest
()
srv
,
fsconn
,
err
:=
nodefs
.
MountRoot
(
dir
,
root
,
opts
);
X
(
err
)
Adir
:=
nodefs
.
NewDefaultNode
()
Bdir
:=
nodefs
.
NewDefaultNode
()
root
.
Inode
().
NewChild
(
"A"
,
true
,
Adir
)
Adir
.
Inode
().
NewChild
(
"B"
,
true
,
Bdir
)
data0
:=
"hello world"
file
:=
NewDataNode
([]
byte
(
data0
))
Bdir
.
Inode
().
NewChild
(
"hello.txt"
,
false
,
file
)
go
srv
.
Serve
()
err
=
srv
.
WaitMount
();
X
(
err
)
defer
func
()
{
err
:=
srv
.
Unmount
();
X
(
err
)
}()
//
open
file
,
this
will
Lookup
A
,
Lookup
B
,
Lookup
file
,
and
open
file
f
,
err
:=
os
.
Open
(
dir
+
"/A/B/hello.txt"
);
X
(
err
)
defer
func
()
{
println
(
"closed"
)
time
.
Sleep
(
5
*
time
.
Second
)
println
()
}()
defer
f
.
Close
()
//
sleep
3
s
:
during
this
time
dentry
root
[
"A"
]
should
be
timed
out
and
invalidated
.
//
the
kernel
evicts
inode
for
A
println
()
time
.
Sleep
(
1
*
time
.
Second
)
//
os
.
Stat
(
dir
+
"/A"
)
//
st
:=
fsconn
.
EntryNotify
(
root
.
Inode
(),
"A"
)
//
st
:=
fsconn
.
EntryNotify
(
Adir
.
Inode
(),
"B"
)
//
st
:=
fsconn
.
DeleteNotify
(
root
.
Inode
(),
Adir
.
Inode
(),
"A"
)
st
:=
fsconn
.
DeleteNotify
(
Bdir
.
Inode
(),
file
.
Inode
(),
"hello.txt"
)
if
!st.Ok() {
t
.
Fatalf
(
"entry_notify: %s"
,
st
)
}
time
.
Sleep
(
1
*
time
.
Second
)
println
()
st
=
fsconn
.
DeleteNotify
(
Adir
.
Inode
(),
Bdir
.
Inode
(),
"B"
)
if
!st.Ok() {
t
.
Fatalf
(
"entry_notify: %s"
,
st
)
}
time
.
Sleep
(
1
*
time
.
Second
)
println
()
//
now
issue
read
for
file
.
buf
:=
make
([]
byte
,
1024
)
_
,
err
=
f
.
Read
(
buf
);
X
(
err
)
time
.
Sleep
(
1
*
time
.
Second
)
println
()
}
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