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
2003d2b2
Commit
2003d2b2
authored
Sep 08, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run gofmt.
parent
aaa7e243
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
45 additions
and
54 deletions
+45
-54
benchmark/stat_test.go
benchmark/stat_test.go
+6
-8
fuse/api.go
fuse/api.go
+3
-3
fuse/cache_test.go
fuse/cache_test.go
+2
-2
fuse/fsconnector.go
fuse/fsconnector.go
+1
-2
fuse/fsmount.go
fuse/fsmount.go
+3
-6
fuse/fsops.go
fuse/fsops.go
+3
-3
fuse/handle.go
fuse/handle.go
+0
-1
fuse/inode.go
fuse/inode.go
+2
-1
fuse/loopback_test.go
fuse/loopback_test.go
+4
-4
fuse/pathfs.go
fuse/pathfs.go
+16
-16
unionfs/autounion.go
unionfs/autounion.go
+1
-1
unionfs/unionfs.go
unionfs/unionfs.go
+1
-1
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+2
-5
zipfs/multizip.go
zipfs/multizip.go
+1
-1
No files found.
benchmark/stat_test.go
View file @
2003d2b2
...
...
@@ -207,10 +207,9 @@ func TestingBOnePass(b *testing.B, threads int, sleepTime float64, files []strin
return
results
}
func
BenchmarkCFuseThreadedStat
(
b
*
testing
.
B
)
{
log
.
Println
(
"benchmarking CFuse"
)
lines
:=
GetTestLines
()
unique
:=
map
[
string
]
int
{}
for
_
,
l
:=
range
lines
{
...
...
@@ -220,7 +219,7 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
unique
[
dir
]
=
1
dir
=
filepath
.
Clean
(
dir
)
dir
,
_
=
filepath
.
Split
(
dir
)
}
}
}
out
:=
[]
string
{}
...
...
@@ -235,11 +234,11 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
f
.
Write
([]
byte
(
fmt
.
Sprintf
(
"/%s
\n
"
,
k
)))
}
f
.
Close
()
log
.
Println
(
"Written:"
,
f
.
Name
())
mountPoint
:=
fuse
.
MakeTempDir
()
wd
,
_
:=
os
.
Getwd
()
cmd
:=
exec
.
Command
(
wd
+
"/cstatfs"
,
mountPoint
)
cmd
:=
exec
.
Command
(
wd
+
"/cstatfs"
,
mountPoint
)
cmd
.
Env
=
append
(
os
.
Environ
(),
fmt
.
Sprintf
(
"STATFS_INPUT=%s"
,
f
.
Name
()))
cmd
.
Start
()
...
...
@@ -248,7 +247,7 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
stop
:=
exec
.
Command
(
bin
,
"-u"
,
mountPoint
)
CheckSuccess
(
err
)
defer
stop
.
Run
()
for
i
,
l
:=
range
lines
{
lines
[
i
]
=
filepath
.
Join
(
mountPoint
,
l
)
}
...
...
@@ -259,6 +258,5 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
log
.
Println
(
"N = "
,
b
.
N
)
threads
:=
runtime
.
GOMAXPROCS
(
0
)
results
:=
TestingBOnePass
(
b
,
threads
,
ttl
*
1.2
,
lines
)
AnalyzeBenchmarkRuns
(
results
)
AnalyzeBenchmarkRuns
(
results
)
}
fuse/api.go
View file @
2003d2b2
...
...
@@ -27,7 +27,7 @@ type FsNode interface {
// The following are called by the FileSystemConnector
Inode
()
*
Inode
SetInode
(
node
*
Inode
)
// RmChild and AddChild run inside the critical section for
// the mutex behind Inode().LockTree().
RmChild
(
name
string
,
child
FsNode
)
...
...
@@ -35,7 +35,7 @@ type FsNode interface {
Lookup
(
name
string
,
context
*
Context
)
(
fi
*
os
.
FileInfo
,
node
FsNode
,
code
Status
)
OnForget
()
// Misc.
Access
(
mode
uint32
,
context
*
Context
)
(
code
Status
)
Readlink
(
c
*
Context
)
([]
byte
,
Status
)
...
...
@@ -160,7 +160,7 @@ type WithFlags struct {
// For debugging.
Description
string
// Put FOPEN_* flags here.
FuseFlags
uint32
...
...
fuse/cache_test.go
View file @
2003d2b2
...
...
@@ -20,7 +20,7 @@ func (me *cacheFs) Open(name string, flags uint32, context *Context) (fuseFile F
return
f
,
c
}
return
&
WithFlags
{
File
:
f
,
File
:
f
,
FuseFlags
:
FOPEN_KEEP_CACHE
,
},
c
...
...
@@ -108,7 +108,7 @@ func (me *nonseekFs) Open(name string, flags uint32, context *Context) (fuseFile
data
:=
bytes
.
Repeat
([]
byte
{
42
},
me
.
Length
)
f
:=
NewReadOnlyFile
(
data
)
return
&
WithFlags
{
File
:
f
,
File
:
f
,
FuseFlags
:
FOPEN_NONSEEKABLE
,
},
OK
}
...
...
fuse/fsconnector.go
View file @
2003d2b2
...
...
@@ -83,7 +83,7 @@ func (me *FileSystemConnector) createChild(parent *Inode, name string, fi *os.Fi
child
=
fsi
.
Inode
()
child
.
addLookupCount
(
1
)
}
out
=
parent
.
mount
.
fileInfoToEntry
(
fi
)
out
.
Ino
=
child
.
nodeId
out
.
NodeId
=
child
.
nodeId
...
...
@@ -337,4 +337,3 @@ func (me *FileSystemConnector) FileNotify(node *Inode, off int64, length int64)
func
(
me
*
FileSystemConnector
)
EntryNotify
(
dir
*
Inode
,
name
string
)
Status
{
return
me
.
fsInit
.
EntryNotify
(
dir
.
nodeId
,
name
)
}
fuse/fsmount.go
View file @
2003d2b2
...
...
@@ -15,7 +15,7 @@ type openedFile struct {
WithFlags
dir
rawDir
dir
rawDir
}
type
fileSystemMount
struct
{
...
...
@@ -50,8 +50,6 @@ func (me *fileSystemMount) mountName() string {
return
""
}
func
(
me
*
fileSystemMount
)
setOwner
(
attr
*
Attr
)
{
if
me
.
options
.
Owner
!=
nil
{
attr
.
Owner
=
*
me
.
options
.
Owner
...
...
@@ -109,9 +107,9 @@ func (me *fileSystemMount) registerFileHandle(node *Inode, dir rawDir, f File, f
node
.
openFilesMutex
.
Lock
()
defer
node
.
openFilesMutex
.
Unlock
()
b
:=
&
openedFile
{
dir
:
dir
,
dir
:
dir
,
WithFlags
:
WithFlags
{
File
:
f
,
File
:
f
,
OpenFlags
:
flags
,
},
}
...
...
@@ -139,4 +137,3 @@ func (me *fileSystemMount) negativeEntry() *EntryOut {
SplitNs
(
me
.
options
.
NegativeTimeout
,
&
out
.
EntryValid
,
&
out
.
EntryValidNsec
)
return
out
}
fuse/fsops.go
View file @
2003d2b2
...
...
@@ -46,7 +46,7 @@ func (me *FileSystemConnector) internalLookup(parent *Inode, name string, contex
if
mount
:=
me
.
findMount
(
parent
,
name
);
mount
!=
nil
{
return
me
.
lookupMountUpdate
(
mount
)
}
lookupNode
,
getattrNode
:=
me
.
preLookup
(
parent
,
name
)
var
fi
*
os
.
FileInfo
...
...
@@ -65,14 +65,14 @@ func (me *FileSystemConnector) internalLookup(parent *Inode, name string, contex
func
(
me
*
FileSystemConnector
)
preLookup
(
parent
*
Inode
,
name
string
)
(
lookupNode
*
Inode
,
attrNode
*
Inode
)
{
parent
.
treeLock
.
Lock
()
defer
parent
.
treeLock
.
Unlock
()
child
:=
parent
.
children
[
name
]
if
child
!=
nil
{
// Make sure the child doesn't die inbetween.
child
.
addLookupCount
(
1
)
return
nil
,
child
}
return
parent
,
nil
}
...
...
fuse/handle.go
View file @
2003d2b2
...
...
@@ -51,7 +51,6 @@ func (me *int32HandleMap) Has(h uint64) bool {
return
me
.
handles
[
uint32
(
h
)]
!=
nil
}
func
(
me
*
int32HandleMap
)
Count
()
int
{
me
.
mutex
.
Lock
()
defer
me
.
mutex
.
Unlock
()
...
...
fuse/inode.go
View file @
2003d2b2
...
...
@@ -5,6 +5,7 @@ import (
"log"
"sync"
)
var
_
=
log
.
Println
// The inode reflects the kernel's idea of the inode.
...
...
@@ -33,7 +34,7 @@ type Inode struct {
// Contains directories that function as mounts. The entries
// are duplicated in children.
mounts
map
[
string
]
*
fileSystemMount
mounts
map
[
string
]
*
fileSystemMount
// Use addLookupCount() to manipulate.
lookupCount
int
...
...
fuse/loopback_test.go
View file @
2003d2b2
...
...
@@ -277,10 +277,10 @@ func TestLinkExisting(t *testing.T) {
defer
me
.
Cleanup
()
c
:=
"hello"
err
:=
ioutil
.
WriteFile
(
me
.
orig
+
"/file1"
,
[]
byte
(
c
),
0644
)
err
:=
ioutil
.
WriteFile
(
me
.
orig
+
"/file1"
,
[]
byte
(
c
),
0644
)
CheckSuccess
(
err
)
err
=
os
.
Link
(
me
.
orig
+
"/file1"
,
me
.
orig
+
"/file2"
)
err
=
os
.
Link
(
me
.
orig
+
"/file1"
,
me
.
orig
+
"/file2"
)
CheckSuccess
(
err
)
f1
,
err
:=
os
.
Lstat
(
me
.
mnt
+
"/file1"
)
...
...
@@ -294,7 +294,7 @@ func TestLinkExisting(t *testing.T) {
c1
,
err
:=
ioutil
.
ReadFile
(
me
.
mnt
+
"/file1"
)
CheckSuccess
(
err
)
if
string
(
c1
)
!=
c
{
t
.
Errorf
(
"Content mismatch relative to original."
)
t
.
Errorf
(
"Content mismatch relative to original."
)
}
}
...
...
fuse/pathfs.go
View file @
2003d2b2
...
...
@@ -17,9 +17,9 @@ type clientInodePath struct {
}
type
PathNodeFs
struct
{
Debug
bool
fs
FileSystem
root
*
pathInode
Debug
bool
fs
FileSystem
root
*
pathInode
connector
*
FileSystemConnector
// Used for dealing with hardlinks.
...
...
@@ -47,7 +47,7 @@ func (me *PathNodeFs) StatFs() *StatfsOut {
return
me
.
fs
.
StatFs
()
}
func
(
me
*
PathNodeFs
)
Node
(
name
string
)
(
*
Inode
)
{
func
(
me
*
PathNodeFs
)
Node
(
name
string
)
*
Inode
{
n
,
rest
:=
me
.
LastNode
(
name
)
if
len
(
rest
)
>
0
{
return
nil
...
...
@@ -59,10 +59,10 @@ func (me *PathNodeFs) LastNode(name string) (*Inode, []string) {
if
name
==
""
{
return
me
.
Root
()
.
Inode
(),
nil
}
name
=
filepath
.
Clean
(
name
)
comps
:=
strings
.
Split
(
name
,
string
(
filepath
.
Separator
))
node
:=
me
.
root
.
Inode
()
for
i
,
c
:=
range
comps
{
next
:=
node
.
GetChild
(
c
)
...
...
@@ -111,8 +111,8 @@ func NewPathNodeFs(fs FileSystem) *PathNodeFs {
root
.
fs
=
fs
me
:=
&
PathNodeFs
{
fs
:
fs
,
root
:
root
,
fs
:
fs
,
root
:
root
,
clientInodeMap
:
map
[
uint64
][]
*
clientInodePath
{},
}
root
.
ifs
=
me
...
...
@@ -137,7 +137,7 @@ type pathInode struct {
// This is to correctly resolve hardlinks of the underlying
// real filesystem.
clientInode
uint64
DefaultFsNode
}
...
...
@@ -168,7 +168,7 @@ func (me *pathInode) GetPath() (path string) {
if
me
.
ifs
.
Debug
{
log
.
Printf
(
"Inode %d = %q"
,
me
.
Inode
()
.
nodeId
,
p
)
}
return
p
}
...
...
@@ -215,8 +215,8 @@ func (me *pathInode) RmChild(name string, child FsNode) {
}
else
{
me
.
ifs
.
clientInodeMap
[
ch
.
clientInode
]
=
nil
,
false
}
}
}
ch
.
Name
=
".deleted"
ch
.
Parent
=
nil
}
...
...
@@ -368,7 +368,7 @@ func (me *pathInode) Create(name string, flags uint32, mode uint32, context *Con
file
,
code
=
me
.
fs
.
Create
(
fullPath
,
flags
,
mode
,
context
)
if
code
.
Ok
()
{
pNode
:=
me
.
createChild
(
name
)
newNode
=
pNode
newNode
=
pNode
fi
=
me
.
fillNewChildAttr
(
fullPath
,
pNode
,
context
)
}
return
...
...
@@ -387,11 +387,11 @@ func (me *pathInode) Open(flags uint32, context *Context) (file File, code Statu
file
,
code
=
me
.
fs
.
Open
(
me
.
GetPath
(),
flags
,
context
)
if
me
.
ifs
.
Debug
{
file
=
&
WithFlags
{
File
:
file
,
File
:
file
,
Description
:
me
.
GetPath
(),
}
}
return
return
}
func
(
me
*
pathInode
)
Lookup
(
name
string
,
context
*
Context
)
(
fi
*
os
.
FileInfo
,
node
FsNode
,
code
Status
)
{
...
...
@@ -439,7 +439,7 @@ func (me *pathInode) GetAttr(file File, context *Context) (fi *os.FileInfo, code
if
fi
!=
nil
{
me
.
setClientInode
(
fi
.
Ino
)
}
if
fi
!=
nil
&&
!
fi
.
IsDirectory
()
&&
fi
.
Nlink
==
0
{
fi
.
Nlink
=
1
}
...
...
unionfs/autounion.go
View file @
2003d2b2
...
...
@@ -31,7 +31,7 @@ type AutoUnionFs struct {
nameRootMap
map
[
string
]
string
root
string
nodeFs
*
fuse
.
PathNodeFs
nodeFs
*
fuse
.
PathNodeFs
options
*
AutoUnionFsOptions
}
...
...
unionfs/unionfs.go
View file @
2003d2b2
...
...
@@ -936,7 +936,7 @@ func (me *UnionFs) Name() string {
type
UnionFsFile
struct
{
fuse
.
File
layer
int
layer
int
}
func
(
me
*
UnionFsFile
)
GetAttr
()
(
*
os
.
FileInfo
,
fuse
.
Status
)
{
...
...
unionfs/unionfs_test.go
View file @
2003d2b2
...
...
@@ -588,7 +588,7 @@ func TestLink(t *testing.T) {
err
:=
ioutil
.
WriteFile
(
fn
,
[]
byte
(
content
),
0666
)
CheckSuccess
(
err
)
err
=
os
.
Link
(
wd
+
"/mount/file"
,
wd
+
"/mount/linked"
)
err
=
os
.
Link
(
wd
+
"/mount/file"
,
wd
+
"/mount/linked"
)
CheckSuccess
(
err
)
fi2
,
err
:=
os
.
Lstat
(
wd
+
"/mount/linked"
)
...
...
@@ -945,7 +945,6 @@ func TestDoubleOpen(t *testing.T) {
}
}
func
TestFdLeak
(
t
*
testing
.
T
)
{
beforeEntries
,
err
:=
ioutil
.
ReadDir
(
"/proc/self/fd"
)
CheckSuccess
(
err
)
...
...
@@ -957,7 +956,7 @@ func TestFdLeak(t *testing.T) {
contents
,
err
:=
ioutil
.
ReadFile
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/file"
,
contents
,
0644
)
err
=
ioutil
.
WriteFile
(
wd
+
"/mount/file"
,
contents
,
0644
)
CheckSuccess
(
err
)
clean
()
...
...
@@ -969,5 +968,3 @@ func TestFdLeak(t *testing.T) {
t
.
Errorf
(
"/proc/self/fd changed size: after %v before %v"
,
len
(
beforeEntries
),
len
(
afterEntries
))
}
}
zipfs/multizip.go
View file @
2003d2b2
...
...
@@ -34,7 +34,7 @@ type MultiZipFs struct {
zips
map
[
string
]
*
MemTreeFs
dirZipFileMap
map
[
string
]
string
nodeFs
*
fuse
.
PathNodeFs
nodeFs
*
fuse
.
PathNodeFs
fuse
.
DefaultFileSystem
}
...
...
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