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
9d49ff98
Commit
9d49ff98
authored
Apr 27, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prespawn all worker threads.
Speedup 15% (lenovo T60, 2 CPUs, 2 stat threads)
parent
b6256e6f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
fuse/fuse.go
fuse/fuse.go
+15
-10
No files found.
fuse/fuse.go
View file @
9d49ff98
...
...
@@ -130,7 +130,6 @@ func NewMountState(fs RawFileSystem) *MountState {
me
.
fileSystem
=
fs
me
.
buffers
=
NewBufferPool
()
return
me
}
func
(
me
*
MountState
)
Latencies
()
map
[
string
]
float64
{
...
...
@@ -186,13 +185,25 @@ func (me *MountState) discardRequest(req *request) {
// Normally, callers should run Loop() and wait for FUSE to exit, but
// tests will want to run this in a goroutine.
//
// If threaded is
set
, each filesystem operation executes in a
// If threaded is
given
, each filesystem operation executes in a
// separate goroutine.
func
(
me
*
MountState
)
Loop
(
threaded
bool
)
{
// To limit scheduling overhead, we spawn multiple read loops.
// This means that the request once read does not need to be
// assigned to another thread, so it avoids a context switch.
if
threaded
{
for
i
:=
0
;
i
<
_BACKGROUND_TASKS
;
i
++
{
go
me
.
loop
()
}
}
me
.
loop
()
me
.
mountFile
.
Close
()
}
func
(
me
*
MountState
)
loop
()
{
// See fuse_kern_chan_receive()
for
{
req
:=
me
.
newRequest
()
err
:=
me
.
readRequest
(
req
)
if
err
!=
nil
{
errNo
:=
OsErrorToErrno
(
err
)
...
...
@@ -216,14 +227,8 @@ func (me *MountState) Loop(threaded bool) {
log
.
Printf
(
"Failed to read from fuse conn: %v"
,
err
)
break
}
if
threaded
{
go
me
.
handle
(
req
)
}
else
{
me
.
handle
(
req
)
}
}
me
.
mountFile
.
Close
()
}
...
...
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