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
2e08b9e3
Commit
2e08b9e3
authored
Sep 27, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop gc, clear out backing store in Clear() instead.
parent
7475c1f3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
34 deletions
+14
-34
unionfs/memunionfs.go
unionfs/memunionfs.go
+12
-31
unionfs/memunionfs_test.go
unionfs/memunionfs_test.go
+2
-3
No files found.
unionfs/memunionfs.go
View file @
2e08b9e3
...
...
@@ -65,34 +65,6 @@ func (me *MemUnionFs) release() {
me
.
cond
.
Broadcast
()
}
func
(
me
*
MemUnionFs
)
gc
()
{
f
,
err
:=
os
.
Open
(
me
.
backingStore
)
if
err
!=
nil
{
return
}
defer
f
.
Close
()
names
,
err
:=
f
.
Readdirnames
(
-
1
)
if
err
!=
nil
{
return
}
me
.
mutex
.
Lock
()
seen
:=
map
[
string
]
bool
{}
me
.
root
.
markUsed
(
seen
)
del
:=
[]
string
{}
for
_
,
n
:=
range
names
{
full
:=
filepath
.
Join
(
me
.
backingStore
,
n
)
if
!
seen
[
full
]
{
del
=
append
(
del
,
full
)
}
}
me
.
mutex
.
Unlock
()
for
_
,
n
:=
range
del
{
os
.
Remove
(
n
)
}
}
func
(
me
*
MemUnionFs
)
Reap
()
map
[
string
]
*
Result
{
me
.
mutex
.
Lock
()
defer
me
.
mutex
.
Unlock
()
...
...
@@ -139,6 +111,18 @@ func (me *MemUnionFs) Clear() {
defer
me
.
mutex
.
Unlock
()
me
.
deleted
=
make
(
map
[
string
]
bool
)
me
.
root
.
Clear
(
""
)
f
,
err
:=
os
.
Open
(
me
.
backingStore
)
if
err
!=
nil
{
return
}
defer
f
.
Close
()
names
,
err
:=
f
.
Readdirnames
(
-
1
)
if
err
!=
nil
{
return
}
for
_
,
n
:=
range
names
{
os
.
Remove
(
filepath
.
Join
(
me
.
backingStore
,
n
))
}
}
func
(
me
*
MemUnionFs
)
Update
(
results
map
[
string
]
*
Result
)
{
...
...
@@ -201,9 +185,6 @@ func (me *MemUnionFs) Update(results map[string]*Result) {
func
(
me
*
MemUnionFs
)
getFilename
()
string
{
id
:=
me
.
nextFree
me
.
nextFree
++
if
me
.
nextFree
%
1000
==
0
{
// go me.gc()
}
return
fmt
.
Sprintf
(
"%s/%d"
,
me
.
backingStore
,
id
)
}
...
...
unionfs/memunionfs_test.go
View file @
2e08b9e3
...
...
@@ -776,7 +776,6 @@ func TestMemUnionFsRenameDirWithDeletions(t *testing.T) {
}
}
func
TestMemUnionGc
(
t
*
testing
.
T
)
{
wd
,
ufs
,
clean
:=
setupMemUfs
(
t
)
defer
clean
()
...
...
@@ -785,11 +784,11 @@ func TestMemUnionGc(t *testing.T) {
writeToFile
(
wd
+
"/mount/file2"
,
"other-content"
)
err
:=
os
.
Remove
(
wd
+
"/mount/file1"
)
CheckSuccess
(
err
)
ufs
.
gc
()
ufs
.
Clear
()
entries
,
err
:=
ioutil
.
ReadDir
(
wd
+
"/backing"
)
CheckSuccess
(
err
)
if
len
(
entries
)
!=
1
{
if
len
(
entries
)
!=
0
{
t
.
Fatalf
(
"should have 1 file after backing store gc: %v"
,
entries
)
}
}
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